Difference between revisions of "Android on OMAP"

From eLinux.org
Jump to: navigation, search
(Android m5-rc14 home screen with kernel 2.6.19 on OMAP2430)
Line 740: Line 740:
  
 
[[Image:androidarmadillo200804.jpg]]
 
[[Image:androidarmadillo200804.jpg]]
 +
 +
* Android m5-rc14 home screen with kernel 2.6.19 on OMAP2430 [[OSK|OSK]]: 
 +
[[Image:omap2evm.android.PNG]]

Revision as of 01:16, 19 May 2008

This page collects information about and guides you through the installation of Google's Android on TI's ARM based OMAP SoCs.

Note: Only small parts of this page should be TI OMAP specific. The basic tasks should also apply to all other ARM926 or higher based SoCs at least able to run a 2.6.23 Linux kernel.

Note: This article assumes that your are familiar with some basics of embedded ARM Linux. E.g. you should know how to use diff & patch, how to boot your embedded ARM SoC with a recent non-Android Linux, how to use a cross compiler etc.

Android

What is Android (not)

Android is a software stack for mobile devices that includes an operating system, middleware and key applications. See Google's What is Android? page and Benno's What is Android? and What Android isn't page for more details about Android.

Versions

From time to time Google updates their Android releases. At time of writing this article version m5-rc14 was the recent one. You should always use the latest available version. And make sure you use an Android kernel (patch) for your hardware that matches the file system version (see below).

Hardware

Goldfish

Android SDK isn't targeted for a special (ARM) SoC. Instead, they use QEMU to create a virtual ARM SoC called Goldfish. The virtual ARM SoC boots an (currently 2.6.23, m5-rc14) ARM Linux kernel with Goldfish platform support on your (x86) Windows, MacOS X or Linux host.

This virtual ARM SoC comprises:

  • ARM926ej-S CPU
  • Thumb support
  • MMC
  • RTC
  • Keyboard
  • USB Gadget
  • Framebuffer
  • TTY driver
  • NAND
  • Software compiled for ARMv5TEJ instruction set (!) with EABI
  • no TLS yet

Real hardware

Running Android on real hardware, some prerequisites should be fulfilled:

  • SoC with ARM926 or higher (e.g. ARM11) (check ARM MPCore or ARM Cortex regarding TLS issue)
  • You have already a recent (~2.6.23) Linux kernel with Thumb & MMU & EABI etc support running on your target
  • Soc/HW has and Linux kernel supports
    • Display/frame buffer (touchscreen would be good but optional). Frame buffer has to support double buffer/page flipping.
    • Keyboard
    • USB (optional)
    • RTC (optional?)
    • Serial console
    • Some storage, sufficient for ~64MB, e.g. NFS or USB stick or NAND or NOR or MMC/SDcard etc. NFS would be easiest for development
    • Sufficient main memory (SDRAM) >=32MB. While 32MB seems to be enough to start, system will be really slow then. Therefore 32MB is sufficient for proof of concept, but not for a usable system.


Known to work HW

Known to not work HW

Compiler

Getting Android working on real hardware, you need an ARM EABI (good EABI description, ignore the Debian specific stuff) compatible development environment. I.e., your tool chain, your kernel and user space must be compatible to ARM EABI. If you don't like to create your own ARM EABI compatible compiler, linker, library etc. you should use CodeSourcery's ARM GNU/Linux tool chain.

Note: The naming in the CodeSourcery download section is slightly confusing. You need the ARM GNU/Linux named tool chain which is indeed an ARM GNU/Linux EABI tool chain with glibc. The ARM EABI named tool chain there is something normally known as arm-elf tool chain without any Linux support and without glibc.

Code

As mentioned above, the Android SDK contains an emulator where a virtual ARM device runs the Android SW on your host PC. The Linux kernel used in this emulator is available in source code. In contrast, the user space file system (applications) is currently only available as binary as part of the SDK.

To get Android running on real HW, currently you need both, matching SDK and kernel source. You need kernel source to extract Android specific patches to add them to your SoC specific kernel. And SDK to get Android user space file system binaries. While getting Android kernel patches is somehow straight forward, extracting user space file system with Android applications in it is a little bit tricky.

Kernel

On Android project page the source code of the kernel is available. From full kernel tree with Android modifications included you can extract patches. With this, you have to extract the Android specific patches yourself from the complete kernel tree, use already extracted patches or get kernel patches by git.

Patch extraction

See third paragraph of Benno's Android on NEO 1973 article.

  • Download matching version (e.g. m5-rc14) of Android kernel source. Besides complete kernel source this will contain Android specific changes.
  • Download matching (e.g. 2.6.23) stock Linux kernel (or use e.g. git to check out stock kernel version) and diff both kernels to get Android related changes.
  • As we want to run Android on real hardware, you can throw away all QEMU and Goldfish related changes. If you don't want to use yaffs2 file system (e.g. cause you don't have NAND or have it already in your tree), throw away yaffs2 related changes as well. If you use m5-rc14 (or higher?) you can remove OpenBinder related files (/driver/binder) as well. Result should be a generic, no ARM or OMAP specific Android patch you can apply to your (e.g. 2.6.23) kernel for your ARM based SoC.

Note: There seems to be some effort to make Android kernel patches available in a easier usable format.

Extracted patches

At some locations there are ready made patches available. The advantage of this is that you don't have to extract the patches yourself. The disadvantage is that you can't always be sure that they contain everything you need and that they match your SDK/user space file system (see below) version.

Note: Some guys on OMAP mailing list have Android patches extracted (currently from m5-rc14) and are willing to share them. Unfortunately they don't have any permanent web storage yet. If you have and like to help community with providing some web space, contact OMAP list.

Git patches

There are Android kernel patches available using Android's git repository. But have a look to Brian's notes regarding this.

File System

Getting user space file system binaries running in emulator extracted is slightly tricky. We have to extract the binaries as currently access to source code have only Google itself and eventually WindRiver.

Again, there are two ways to get user space binaries: Extracting them your self or taking already extracted ones.

Binary extraction

The user space applications compiled for ARMv5 EABI are part of the Android SDK in system.img and userdata.img in tools/lib/images directory of SDK.

  • Download SDK and unzip it
  • system.img and userdata.img are yaffs2 images. There is no way yet to mount them directly on a host to extract their content. An unyaffs tool is missing, so the only way to get the content is to start the emulator and extract the contents from running emulator.
  • As file system in emulator as no cp or tar command, we use a statically linked BusyBox cross compiled for ARM and use it inside emulator (get it from Benno or build it your own with above tool chain).
  • Set path to emulator tools
export PATH=${PATH}:<path_to>/android-sdk_m5-rc14_linux-x86/tools
  • Create an empty SDcard (image)
mksdcard -l card 100M card.img
  • Start emulator
emulator -sdcard card.img -console -debug-kernel
  • You should now see the SDK kernel booting and emulator starting. Wait until the emulator is ready, then send the ARM busybox from the host into the simulated environment:
adb -d 1 push busybox /data/busybox
  • Inside emulation, set tar (and bzip2) links to busybox, tar /system and /data directories to sdcard.
  • Shutdown emulator, mount card.img
mount -o loop card.img mnt/

and get the images of system and user data.

  • If you look at the extracted size of the userdata image, the extracted one is bigger than the original userdata.img. So by the runtime extraction we get some temporary junk in it. For this, untar extracted userdata and remove a least some of the unnecessary stuff:
    • Remove all content of data/dalvik-cache/. It holds the decompressed files from the apk packages.
    • Remove the static busybox image. We only needed it for extraction and don't need it any more.

Note: Anybody likes to hack this unyaffs tool? Then the system.img and userdata.img extraction would be a lot easier.

Note: A user reports that he doesn't use the extracted data directory at all. He simply mounts a tempfs to /data as it seems that Android runtime creates most (all?) of the necessary files in /data itself at runtime.

Extracted binaries

At some locations there are ready made binaries available. The advantage of this is that you don't have to extract the binaries yourself. The disadvantage is that you can't always be sure that the images contain everything you need and that the images match your kernel patch (see above) version.

Note: Some guys on OMAP mailing list have Android binaries extracted (currently from m5-rc14) and are willing to share them. Unfortunately they don't have any permanent web storage yet (~30MB). If you have and like to help community with providing some web space, contact OMAP list.

Target

This section describes how to configure the software (kernel, file system) to run Android on real hardware target. Before you do this Android specific steps, you should make sure that everything works without any Android specifics. I.e. make sure that the (EABI) kernel boots, you can access all file systems (e.g. NFS or MMC or NOR or NAND etc.) and necessary drivers (e.g. keyboard, touchscreen etc.). Do this with booting into your normal (EABI) file system you always use. We later switch to Android file system then.

Kernel configuration

Make sure your kernel boots normally on your board. Then enable some Android specific configuration (needs kernel patch extracted above) and make sure that your kernel still boots (with your standard file system).

Note: Some of these settings are valid only for m5-rc14 and newer (?) (Binder config, /sys/android_power output) as it changed from older versions to m5-rc14.

EABI

CONFIG_AEABI=y
# CONFIG_OABI_COMPAT is not set

THUMB

CONFIG_ARM_THUMB=y

Android drivers

#
# Android
#
# CONFIG_ANDROID_GADGET is not set
# CONFIG_ANDROID_RAM_CONSOLE is not set
CONFIG_ANDROID_POWER=y
CONFIG_ANDROID_POWER_STAT=y
CONFIG_ANDROID_LOGGER=y
# CONFIG_ANDROID_TIMED_GPIO is not set
CONFIG_ANDROID_BINDER_IPC=y

After you successfully booted the kernel with configuration above (and m5-rc14 kernel patch), make sure you have following /sys files:

/sys/android_power/acquire_partial_wake_lock
/sys/android_power/acquire_full_wake_lock
/sys/android_power/last_user_activity
/sys/android_power/request_sleep
/sys/android_power/acquire_full_wake_lock
/sys/android_power/acquire_partial_wake_lock
/sys/android_power/battery_level
/sys/android_power/battery_level_low
/sys/android_power/battery_level_raw
/sys/android_power/battery_level_scale
/sys/android_power/battery_low_level
/sys/android_power/battery_shutdown_level
/sys/android_power/charging_state
/sys/android_power/release_wake_lock
/sys/android_power/request_state
/sys/android_power/state

File system configuration

We now switch to Android file system extracted above. This should be established on a device with enough space (> ~64MB) and which is accessible on your target. Options are e.g. NFS, NOR or NAND file system, hard disk or USB storage. In a first step it is sufficient if you are able to manually mount it from your (temporary) standard root file system. In a second step it is an option to use it directly as root fs.

The Android file system we establish here on one of the the storage from above is built from four parts:

  • Content of system data image extracted above
  • Content of user data image extracted above (make sure temporary files are removed)
  • Content of Android ram disk image
  • Device file system

To create Android file system, take (empty) storage you selected and start with ram disk:

Android ram disk image can be found as ramdisk.img in tools/lib/images of Android SDK. This is a gziped cpio archive:

cp ramdisk.img ramdisk.gz
gunzip ramdisk.gz
cd target_fs
cpio -iv < ../ramdisk

Result of this should be an root file system tree with:

data
dev
etc
init
proc
sbin
sys
system
tmp
var

Directories data, dev and system are empty. Extract content of extracted user data image to /data and system image to /system directories. E.g.

tar xvfj ../system_m5_rc14.tar.bz2 system/
tar xvfj ../userdata_m5_rc14.tar.bz2 data/

Note: This depends on how you named and stored extracted user data and system image above.

Last step is to create some device nodes in /dev you need for running from this Android file system. There are several options how to establish this. One option is to extract device file system from running Android emulator as well. Second option is to use the same device file system you normally use in your standard file system. Choose the easiest way. If you did this, make sure you have Android specific device nodes with correct major/minor numbers as well.

Note: Copying device nodes the best way is to tar them at source and untar them then at target. For device nodes, cp command isn't the best option due to special device node format.

Start up

Starting Android using the file system and kernel created above, there are three ways:

  • Directly boot from Android kernel into the Android file system. I.e. let the Android kernel directly start init etc. from Android file system.
  • First boot from Android kernel into your standard file system. Then "manually" switch over to Android file system and start Android. This "manual" switch can be done using some scripts.
  • The third way is a mix of the first two ways: Boot into a standard non-Android file system, then switch over to Android but there directly execute init as it would be done by root file system.

Android root file system

There are several ways to directly start Android from (root) file system created above:

  • Directly point your kernel to /init in Android file system. Then kernel will use Android's init as init program and execute it without any manual interaction
  • Use Android's shell and give kernel /system/bin/sh as init program. Then start Android's init manually (/init&) .

Start via scripts

This section describes the second way to start Android. First boot into your normal file system and then switch to Android file system and start Android "manually", i.e. with help of some scripts. From the initial description of this method, this way is also known as the a.sh way (search for a.sh). The scripts used for this depend on your local configuration. You can take below scripts as example and adapt them for your local use.

These example scripts are used to first boot into standard root file system (e.g. JFFS2 in NOR) and then to mount (/mnt/usb) and start Android located on an ext2 formatted USB stick.

start_android.sh in standard root file system:

#!/bin/sh -x
echo "Starting Android..."
fsck.ext2 -pv /dev/sda1
mount /dev/sda1 /mnt/usb
rm -f /mnt/usb/tmp/*
umount /proc
umount /sys
mount -t proc proc /mnt/usb/proc
mount -t sysfs sysfs /mnt/usb/sys
umask 000
chroot /mnt/usb/a.sh

a.sh to start Android at Android file system:

#!/system/bin/sh -x

export PATH=/sbin:/system/sbin:/system/bin:$PATH
export LD_LIBRARY_PATH=/system/lib
export ANDROID_ROOT=/system
export ANDROID_ASSETS=/system/app
export ANDROID_DATA=/data
export EXTERNAL_STORAGE=/sdcard
export DRM_CONTENT=/data/drm/content

/system/bin/app_process -Xzygote /system/bin --zygote &
/system/bin/dbus-daemon --system &
runtime &
/system/bin/sh

Notes:

  • fsck.ext2 -pv /dev/sda1: Make sure ext2 file system is clean. ext2 doesn't like unclean switch off while debugging Android start up ;)
  • rm -f /mnt/usb/tmp/*: Remove Android temporary files before starting Android.
  • mount proc and mount sys: This has to be done somewhere. Depending on your scripts, you can do it in a.sh as well.
  • runtime: For debugging use here /system/bin/strace -f -ff -tt -s 200 runtime&.
  • Starting runtime in background (&) and calling /system/bin/sh afterwards is optional. It gives you the option to have a shell at Android startup to e.g. observe /proc/meminfo, top or ps. Only useful if strace isn't enabled or not so noisy ;)

Start init via scripts

This third way is a mixture of the first two ways: Boot into a standard non-Android file system, then switch over to Android but there directly execute init as it would be done by root file system.

From standard non-Android file system this switch can look like:

mount /dev/sda1 /mnt/usb
rm -f /mnt/usb/tmp/*
umask 000
chroot /mnt/usb /init

Debugging

  • Strace: The main debugging help currently known is strace. Again, a statically linked one is used.
strace -f -ff -tt -s 200 /system/bin/runtime

FAQ

Kernel patch

Q: Above section about kernel patch extraction mentioned that not all changes in Android kernel compared to stock kernel are needed for Android on real HW (e.g. Goldfish, QEMU and YAFFS2 related changes). What exactly do I need?

A: Regarding m5-rc14 and kernel 2.6.23 the (changed) files below seem to be sufficient to run Android on real HW:

arch/arm/Kconfig
arch/arm/kernel/process.c
arch/arm/kernel/signal.c
drivers/android/alarm.c
drivers/android/android_gadget.c
drivers/android/android_kernel_debug.c
drivers/android/android_kernel_debug.h
drivers/android/binder.c
drivers/android/Kconfig
drivers/android/logger.c
drivers/android/Makefile
drivers/android/power.c
drivers/android/ram_console.c
drivers/android/timed_gpio.c
drivers/input/evdev.c
drivers/Kconfig
drivers/misc/Kconfig
drivers/misc/lowmemorykiller/lowmemorykiller.c
drivers/misc/lowmemorykiller/Makefile
drivers/misc/Makefile
fs/inotify_user.c
include/linux/android_alarm.h
include/linux/android_gadget.h
include/linux/android_power.h
include/linux/android_timed_gpio.h
include/linux/binder_module.h
include/linux/binder_type_constants.h
include/linux/logger.h
kernel/power/process.c
drivers/Makefile

OpenBinder

Q: When I extract the kernel patch, I additionally get a drivers/binder/ directory. Why isn't it listed/needed above?

A: The drivers/binder/ directory seems to contain OpenBinder. In Android m5-rc14 this seems to be replaced by drivers/android/binder.c. Therefore we don't need drivers/binder/ with m5-rc14 any more. Note that new binder.c in drivers/android is configured with CONFIG_ANDROID_BINDER_IPC, while drivers/binder was configured by (obsolete) CONFIG_BINDER.

Devices nodes

Q: Do I need special devices nodes? Which?

A: Above we only extracted system and userdata image. If you like, you can extract /dev entries as well. However, starting Android's runtime under strace control should give you a list which devices will be opened. Besides the standard ones you will need (incomplete?):

crw-rw-rw- 1 root root 10,  x Jan  1 00:00 binder
crw-rw-rw- 1 root root 10,  x Jan  1 00:00 log/radio
crw-rw-rw- 1 root root 10,  x Jan  1 00:00 log/events
crw-rw-rw- 1 root root 10,  x Jan  1 00:00 log/main
crw-rw-rw- 1 root root 10,  x Jan  1 00:00 alarm
crw-rw-rw- 1 root root 10,  x Jan  1 00:00 eac
crw-rw-rw- 1 root root 29,  0 Jan  1 00:00 graphics/fb0
more ?

/dev/xxx minor numbers

Q: Which minor number will I need for /dev/xxx entries above? E.g. for /dev/binder?

A: The major number 10 (major number for "misc" devices) above are for new drivers of m5-rc14. The minor numbers would be as given by cat /proc/misc. They are somehow board dependent and may change.

E.g. in m5-rc14 emulator you may get:

# cat /proc/misc
58 binder
59 log_radio
60 log_events
61 log_main
62 alarm
 1 psaux
63 eac

With kernel patch on real HW you may get:

# cat /proc/misc
59 binder
60 log_radio
61 log_events
62 log_main
63 alarm

/dev/fb0

Q: I have /dev/fb0, is this correct?

A: With m5-rc14 Google switched frame buffer interface to /dev/graphics/fb0. So you need:

crw-rw-rw- 1 root root 29,  0 Jan  1 00:00 /dev/graphics/fb0

Blank screen

Q: I did all steps like above, strace output doesn't show any obvious errors, but if I start Android calling runtime I simply get a blank screen. No output (no ANDROID string, no red cycle eye, nothing), just blank screen. As when the frame buffer screen saver starts after ~10min. I use m5-rc14.

A: With m5-rc14 the frame buffer handling changed. You now need a frame buffer driver which supports double buffer/page flipping. Observe the output of strace. If you get:

...
writev(4, [{"\4", 1}, {"SurfaceFlinger\", 15}, {"Client API: OpenGL ES\", 22}], 3) = 38
open("/dev/graphics/fb0", O_RDWR|O_LARGEFILE) = 21
ioctl(21, FBIOGET_FSCREENINFO, 0x43145d9c) = 0
ioctl(21, FBIOGET_VSCREENINFO, 0x43145cfc) = 0
ioctl(21, FBIOPUT_VSCREENINFO, 0x43145cfc) = 0
writev(4, [{"\5", 1}, {"EGLDisplaySurface\", 18}, {"page flipping not supported (yres_virtual=640,  requested=1280)\", 63}], 3) = 82
ioctl(21, FBIOGET_VSCREENINFO, 0x43145cfc) = 0
...

your frame buffer driver doesn't support page flipping.

Note: For above output, strace has to be invoked with -f -ff -tt -s 200 options, else you wouldn't see this.

Page flipping frame buffer

Q: Okay, I get this page flipping not supported message above and have a blank screen. So my frame buffer driver doesn't support double buffer/page flipping. What do I have to change in frame buffer driver to support double buffer/page flipping?

A: This depends on frame buffer driver.

  • For OMAP you can try following hack:
Index: linux-omap-2_6_23/drivers/video/omap/omapfb_main.c
===================================================================
--- linux-omap-2_6_23.orig/drivers/video/omap/omapfb_main.c
+++ linux-omap-2_6_23/drivers/video/omap/omapfb_main.c
@@ -168,7 +168,7 @@ static int ctrl_init(struct omapfb_devic
                /* 12 bpp is packed in 16 bits */
                if (bpp == 12)
                       bpp = 16;
-               def_size = def_vxres * def_vyres * bpp / 8;
+               def_size = def_vxres * def_vyres * 2 * bpp / 8;
                fbdev->mem_desc.region_cnt = 1;
                fbdev->mem_desc.region[0].size = PAGE_ALIGN(def_size);
        }
@@ -415,6 +415,7 @@ static void set_fb_fix(struct fb_info *f
        }
        fix->accel              = FB_ACCEL_OMAP1610;
        fix->line_length        = var->xres_virtual * bpp / 8;
+       fix->ypanstep           = 1;
 }

 static int set_color_mode(struct omapfb_plane_struct *plane,
@@ -1471,7 +1472,7 @@ static int fbinfo_init(struct omapfb_dev
        var->xres = def_vxres;
        var->yres = def_vyres;
        var->xres_virtual = def_vxres;
-       var->yres_virtual = def_vyres;
+       var->yres_virtual = def_vyres * 2;
        var->rotate       = def_rotate;
        var->bits_per_pixel = fbdev->panel->bpp;

(anybody with clean patch? ->contact)

  • For Zaurus/pxafb have a look to following solution. See OESF as well.

Android start crashes

Q: When I start Android like described above, xxx strangely crashes and/or I get strange error messages. I don't use recent (m5-rc14) Android.

A: Make sure that you use kernel patch and file system from most recent Android release (currently m5-rc14). Don't mix kernel patch and file system from different versions.

Power management

Q: I did anything like described above. Systems starts properly, I get Android home screen. But then, system goes to suspend mode and never wakes up. Even if I only use fake Android power management.

A: unknown yet :( There is some guessing and some workaround.

  • Workaround reported from Anil:

Adding keypad support (e.g. on Mistral's OSK2530EVM, OMAP2430 based platform) and "waking" Android while it switches to suspend wakes it again. When Android goes into power saving mode, it prints the following messages

android_power_suspend: enter suspend
android_power_suspend: exit suspend, ret = -38
android_power_suspend: pm_suspend returned with no event

And then, if the UP or DOWN key is pressed on the HW keypad, the system comes back to normal mode and resumes activity with the below given console messages

android_power_wakeup 2->0 at 447592867845
active wake lock PowerManagerService
active wake lock KeyEvents
android_power_suspend: done

TLS issue

Q: What is this TLS issue?

A: Some newer ARM processors support TLS in hardware. With current (m5-rc14) Android release this isn't supported yet.

TLS issue and processors

Q: Which processors have this TLS issue?

A: ARMv6K (MPCORE) and ARMv7 (Cortex). Regarding OMAP, this is OMAP3 (Cortex). OMAP1 (ARM9) and OMAP2 (ARM11) don't have this issue.

TLS issue workaround

Q: I'd like to use (m5-rc14) Android on processors with TLS issue, what can I do?

A: On older ARM's the TLS register is emulated (trapped by the kernel) and on newer ARM's the register actually exists. Android (at least the version for Goldfish) is compiled with the assumption that the TLS register is emulated and thus expects the kernel to trap it. A non-user defined config option called HAS_TLS_REG is set based on the processor version that is configured which controls if the trap code gets added to the kernel. So to get around the TLS issue, you will need to force the option ON even if the processor supports the TLS register. You can force it on for e.g. OMAP3 by doing the following. However, once source is available, you really don't want to do this as it does cause a performance hit.

diff -Naur 2.6_kernel-orig/arch/arm/mm/Kconfig 2.6_kernel-android/arch/arm/mm/Kconfig
--- 2.6_kernel-orig/arch/arm/mm/Kconfig   2007-11-20 12:09:42.000000000-0600
+++ 2.6_kernel-new/arch/arm/mm/Kconfig   2007-12-08 22:23:04.000000000-0600
@@ -675,7 +675,7 @@
 config HAS_TLS_REG
   bool
   depends on !TLS_REG_EMUL
-  default y if SMP || CPU_32v7
+  default y if SMP || CPU_32v7 && !ARCH_OMAP
   help
     This selects support for the CP15 thread register.
     It is defined to be available on some ARMv6 processors (including

(Thanks to Keith Deacon!)

Note: A user report wasn't quite successful regarding this.

Red cycle eye runtime speed

Q: The red cycle eye runs very fast on my board, and the system_server take almost 100% CPU

A: This is usually indicative of lack of vsync/pageflip in the fb driver. The surfaceflinger believes it will be limited by the vsync rate and the startup animation depends on that.

File not found

Q: At Android start up I get some File not found ... error messages like:

Prepping: /system/app/AlarmClock.apk:/system/app/AlarmProvider.apk:...
File not found: /system/app/AlarmClock.apk
File not found: /system/app/AlarmProvider.apk
File not found: /system/app/Anagrams.apk
...
File not found: /system/app/Vending.apk
File not found: /system/app/VoiceDialer.apk
File not found: /system/app/Voicemail.apk
File not found: /system/app/YouTube.apk
Prep complete

Do I have to care about these?

A: No, it doesn't seem so. See Benno's blog, section Manual startup.

Limited main memory

Q: I have only limited main memory (SDRAM, e.g. 32MB). The system basically starts, but it is really sssllllooooowwww, slightly unusable. More or less only a proof of concept. Can I do anything to use Android even on systems with limited main memory?

A: Try to enable lowmemorykiller:

drivers/misc/lowmemorykiller/lowmemorykiller.c

For this, in kernel enable

CONFIG_LOW_MEMORY_KILLER=y

in Device drivers -> Misc devices. At Android startup this then results in messages like

...
send sigkill to 920 (app_process), adj 1, size 1838
...

Some buttons work, some not

Q: Some buttons work, some buttons don't work ... wrong mapping. How to see what key codes certain buttons are bound? And how to edit the mapping in Android?

A: From Brian at OMAP ML:

There's a brute force approach to sorting out input events: run getevent on the emulator and on the target hardware and compare the results. It's in /system/bin. Keylayouts live in /system/usr/keylayout/*.kl and are used to translate from the raw input event codes to android keycodes. Keymaps live in /system/user/keychars/*.kcm.bin (undocumented binary format right now, sorry) and are used to describe how the key events and modifiers and such are related.

Filesystem, JFFS2 and SIGSEGV

Q: Which file system should I use to store Android user files? Is JFFS2 okay? I use JFFS2 and get SIGSEGVs. What can I do?

A: Don't use JFFS2 as file system for Android. Android does not support JFFS. Use an ext2/3 formatted medium. Or use YAFFS2 if you use a NAND device (as emulator does).

Using JFFS2

Q: Okay, I understand from above that Android doesn't support JFFS2. But, maybe there is a hack to try?

A: You could try what Brian reports:

Using JFFS2, what you're might seeing here is the property service in init failing to create and mmap it's arena, which it tries to do in /, which in emulator world is initramfs. The android init/boot model is a little different in that android don't pivot over to a root filesystem, android mounts the system, data, etc partitions under the ramfs on /.

You might be able to hack around this by editing the string "/system_properties" to "/tmp/em_properties" or something like that, assuming you have tmpfs mounted on /tmp.

Nokia N8x0 and Android SDK

Q: I'd like to run Android on Nokia N8x0 (link 1, link 2). Which Android SDK should I use? Can I use m5-rc14/15 SDK?

A: You have to use m3 user space. This works well with m5-rc14/15 kernel patches. So best combination is to use m3 user space with m5 kernel.

m5 user space will not work, because it needs page flipping frame buffer and N8x0 fb driver doesn't support this.

N8x0 and recent OMAP git kernel

Q: I'd like to use recent OMAP git kernel on N8x0. What do I need to run git kernel on N8x0?

A: Have a look to Tony's booting nokia N8x0 with current OMAP git kernel.

N810 keys

Q: How do I get the N810 keyboard to work with Android?

A: Try the following changes to get most of N810 keys working with Android, except Fn and the numbers:

Just update one file: /system/usr/keylayout/qwerty.kl

-key 158   BACK              WAKE_DROPPED
+key 1     BACK              WAKE_DROPPED
 key 230   SOFT_RIGHT        WAKE
 key 60    SOFT_RIGHT        WAKE
 key 107   ENDCALL           WAKE_DROPPED
 key 62    ENDCALL           WAKE_DROPPED
-key 229   SOFT_LEFT         WAKE_DROPPED
+key 62    SOFT_LEFT         WAKE_DROPPED
 key 59    SOFT_LEFT         WAKE_DROPPED
 key 139   SOFT_LEFT         WAKE_DROPPED
 key 228   POUND
 key 227   STAR
 key 231   CALL              WAKE_DROPPED
 key 61    CALL              WAKE_DROPPED
-key 232   DPAD_CENTER       WAKE_DROPPED
+key 96    DPAD_CENTER       WAKE_DROPPED
 key 108   DPAD_DOWN         WAKE_DROPPED
 key 103   DPAD_UP           WAKE_DROPPED
-key 102   HOME              WAKE
+key 63    HOME              WAKE
 key 105   DPAD_LEFT         WAKE_DROPPED
 key 106   DPAD_RIGHT        WAKE_DROPPED
-key 115   VOLUME_UP
-key 114   VOLUME_DOWN
+key 65    VOLUME_UP
+key 66    VOLUME_DOWN

N8x0 touchscreen

Q: Is there any way to get N8x0 touchscreen working with Android?

A: Yes. There is a patch you can apply to a nokia+android patched 2.6.21 kernel and you should have a working touchscreen.

HW interfaces support

Q: Which hardware interfaces or kernel drivers does current Android support?

A: See discussion on OMAP ML:

> I was able to add support for the keypad, touch and network in Android,
> however the interfaces like GPS, Accelerometer, vibrator, hardware 3D
> acceleration, battery etc. are not integrated with Android right now. I
> would appreciate if you could throw some light on these open issues. How
> exactly can these interfaces be integrated with Android? 

We're trying to use the standard kernel/driver interfaces when possible,
but for things that may have a good deal of variation in implementation,
we're looking to provide a very thin "hardware interface library" layer
to adapt between the bottom of the userspace stack and the drivers or
whatnot for specific hardware platforms.  

We'll continue to adopt standardized kernel solutions as they become
available -- We're now using the power supply framework in 2.6.24 for
monitoring battery/charge state (post M5 SDK -- it'll be in the next 
release), for example.

Links

Note:Connect this site using http://www.google.com/translate website.

Note: Some of the infos in above links are from the first versions of Android. Seems that with newer versions (e.g. m5-rc14) some parts changed, e.g. binder interface and /sys/android_power interface.

Contact

See OMAP mailing list for more information.

This page is distilled by Dirk Behme and information added by Lim,GeunSik.

Screenshots

  • Android m5-rc14 home screen with kernel 2.6.23 on OMAP5912 OSK:

Android m5 rc14 omap osk kernel 2 6 23.jpg

  • Android m5-rc14 kernel + m3 image, on a Nokia N810:

Cimg0608.jpg


Cimg0610.jpg


Cimg0611.jpg


  • Android m5-rc15 home screen with kernel 2.6.18 on armadillo-500 1136 (YouTube Movie)

Androidarmadillo200804.jpg

  • Android m5-rc14 home screen with kernel 2.6.19 on OMAP2430 OSK:

Omap2evm.android.PNG