Hi,
I had done some experiment on Android porting to OMAP2430 based
board. This is a custom hardware based on OMAp2430 SoC. The steps followed
are as follows:
Kernel
. The custom hardware board where this effort is taking place has
support for 2.6.23 version of linux kernel. The entire Android porting
activity is being carried out on this basic kernel. This kernel source had
been patched with the android.diff from Benno's blog
(http://benno.id.au/android/android.diff). The kernel configuration has been
done with CONFIG_AEABI support enabled.
. The options shown here have been enabled for the kernel
configuration
CONFIG_AEABI=y
CONFIG_BINDER=y
CONFIG_ANDROID_LOG=y
CONFIG_ANDROID_POWER=y
CONFIG_ANDROID_POWER_STAT=y
. The frame-buffer driver has been modified to support double
buffering. Basically the virtual_yres is twice the original y-resolution
(The memory size is also scaled up accordingly). Also the pan_display
function had been modified to add this support.
This patched kernel has been built using CodeSourcery toolchain.
Root File System
. The Root File System is created using the ramdisk.img, system.img
and userdata.img provided with the Android SDK itself and the directory
structure is replicated exactly same as that of the emulator.
. The device node for the BINDER module /dev/binder has been
re-created after verifying the major number given in /proc/devices for
BINDER
mknod /dev/binder c 253 0
. The Root File System has been exported as an NFS mount.
Initialization
One the board boots up using this custom Android kernel and file system
(which is on NFS), the following commands would be issued at the console:
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
mount -t proc proc /proc
mount -t sysfs sysfs /sys
umask 000
rm -rf /tmp/*
chmod -R a+rw /data /tmp
rm -r /dev/log
ln -s /var/tmp/log /dev/log
touch /dev/log/main
touch /dev/log/event
touch /dev/log/radio
chmod -R a+rw /dev/binder
/system/bin/app_process -Xzygote /system/bin --zygote &
/system/bin/dbus-daemon --system &
/system/bin/runtime
Observations
. The system starts up with binder_open call and after sometime the
red-dot on the display panel starts moving. Meanwhile a set of messages gets
displayed on the console. The system sets up some timeout value and shows
the following text:
. android_power: auto off timeout set to 604800 seconds
. The system throws some assertion failures on the console for the
binder module. The messages are as shown here:
Descriptor2Node failed: desc=12, max=32, node=00000000, strong=0
BND_ASSERT file drivers/binder/binder_thread.c line 636: Failure converting
target descriptor t
o node
[<c003bb18>] (dump_stack+0x0/0x14) from [<c01b172c>]
(binder_thread_Write+0x8dc/0xe3c)
[<c01b0e50>] (binder_thread_Write+0x0/0xe3c) from [<c01b26e0>]
(binder_thread_Control+0x120/0x4
2c)
[<c01b25c0>] (binder_thread_Control+0x0/0x42c) from [<c01a9b18>]
(binder_unlocked_ioctl+0x164/0
x1b0)
[<c01a99b4>] (binder_unlocked_ioctl+0x0/0x1b0) from [<c009afd0>]
(do_ioctl+0x34/0x78)
r7:0000000c r6:c0186201 r5:10affc90 r4:c0186201
[<c009af9c>] (do_ioctl+0x0/0x78) from [<c009b270>] (vfs_ioctl+0x25c/0x284)
r5:10affc90 r4:c3fd0f00
[<c009b014>] (vfs_ioctl+0x0/0x284) from [<c009b2d8>] (sys_ioctl+0x40/0x64)
r7:c3fd0f00 r6:c0186201 r5:10affc90 r4:0000000c
[<c009b298>] (sys_ioctl+0x0/0x64) from [<c0037dc0>]
(ret_fast_syscall+0x0/0x2c)
r7:00000036 r6:00115f38 r5:00000000 r4:c0186201
The runtime process receives SIGKILL and destroys itself. The red-dot stops
moving.
Problems Faced
1. As we do not have build control on Android framework (the core
libraries and middleware), the pre-built binaries shipped with the SDK have
been tried on an ARM v6 machine. We still do not know the sanity of this
approach.
2. The binder module is incorporated into our kernel from the Android
kernel source (through the patch mentioned above). However we do see that
this kernel module throws ASSERTION FAILURES (the details of which have been
given above)
3. The runtime process receives SIGKILL or SIGSEGV and exits. We still
do not know the reason for these signals and the originator of these
signals.
4. As the pre-built binaries do not have symbol information with them
(stripped binaries), it is pretty cumbersome to debug them or run GDB on
them.
5. The only tool available for debugging as of now is a custom built
(statically linked) "strace".
6. Sometimes we do observe that the mmap2 system calls fail and the
strange thing noticed was that the amount of memory requested was a huge
number.
Questions
1. Given the SoC specification and the RAM size of 64MB, is it possible
to execute the pre-built Android binaries on our custom hardware? (please
see Platform Description)
2. Is RTC (Real Time Clock) driver/support a mandatory requirement to
run Android?
3. What is the bare minimum memory (RAM) required to run android with
the default set of applications shipped along with the SDK?
4. Why do we see the binder module assertion failures for
"Descriptor2Node" function?
5. Can the root file system reside on NFS?
6. How exactly we could ensure that there is no memory corruption?
7. Do we need to perform any extra step in order to get Android
functional on our custom hardware?
8. Is there configuration to be enabled in the kernel apart from the
ones mentioned earlier?
9. Is there any specific option to be passed to the toolchain? Or do
wee need to use a specific toolchain?
10. Is there a specific linux kernel version to be used?
Testing with YAFFS2 file system
The root file system for Android has been mounted on an MTD partition on
NAND on OSK 2430 board with YAFFS2 support. To enable this, we have done the
following:
1. The kernel has been patched for the YAFFS2 support. This patch is
part of the Android patch obtained from BENNO's blog. The YAFFS2 support is
built-into the kernel
2. The board is booted out of NFS initially. A tar archive of the NFS
is stored in one of the directories itself.
3. Once the booting is completed, erase the /dev/mtd5 partition using
the flash_eraseall mtd utility.
4. Then mount the partition as YAFFS2 type using the command,
mount -t yaffs2 /dev/mtdblock5 /nand
5. Once the partition is mounted onto the mount point "/nand", untar
the file system archive into it and un-mount the partition.
6. The subsequent booting of the board will be done out of
/dev/mtdblock5 as the root device.
Observations made with the file system on yaffs2 partition
Once the system is booted out of YAFFS2, the Android framework has been
initialized the same way as it is initialized in an NFS based root file
system scenario. The following observations have been made.
The strace shows that the runtime process is trying to post the message
"--allow-disconnect\n--nice-name=system_server\n--setuid=0\n--setgid=0\nandr
oid.server.SystemServer". However when it tries to read the response back,
it gets the following message,
PathClassLoader: can't find '.'
PathClassLoader: can't find '.'
java.lang.NullPointerException
at java.io.BufferedInputStream.fillbuf(BufferedInputStream.java:150)
at java.io.BufferedInputStream.read(BufferedInputStream.java:306)
at java.io.FilterInputStream.read(FilterInputStream.java:137)
at java.util.Properties.load(Properties.java:272)
at
java.util.logging.LogManager.readConfigurationImpl(LogManager.java:532)
at
java.util.logging.LogManager.readConfiguration(LogManager.java:455)
at java.util.logging.LogManager$1.run(LogManager.java:247)
at
java.security.AccessController.doPrivilegedImpl(AccessController.java:173)
at
java.security.AccessController.doPrivileged(AccessController.java:53)
at java.util.logging.LogManager.<clinit>(LogManager.java:233)
at java.util.logging.Logger.initHandler(Logger.java:435)
at java.util.logging.Logger.log(Logger.java:1091)
at java.util.logging.Logger.warning(Logger.java:910)
at java.util.ZoneInfoDB.<clinit>(ZoneInfoDB.java:113)
at java.util.TimeZone.getDefault(TimeZone.java:176)
at java.util.GregorianCalendar.<init>(GregorianCalendar.java:192)
at java.util.GregorianCalendar.<init>(GregorianCalendar.java:151)
at java.util.Date.getYear(Date.java:333)
at java.util.Date.<clinit>(Date.java:44)
at android.dalvik.Zygote.initClass(Native Method)
at android.os.ZygoteInit.preloadClasses(ZygoteInit.java:1082)
at android.os.ZygoteInit.main(ZygoteInit.java:1117)
at android.dalvik.NativeStart.main(Native Method)
getFileType got errno=13 on '/system/framework/framework-res.apk'
getFileType got errno=13 on '/system/framework/framework-res.apk'
Once this message is displayed, the system eventually gets SIGSEV and
segfaults
It would be really great if someone can throw some light on this.
Warm Regards,
Anil
-----Original Message-----
From: linux-omap-open-source-bounces@xxxxxxxxxxxxxx
[mailto:linux-omap-open-source-bounces@xxxxxxxxxxxxxx] On Behalf Of Dirk
Behme
Sent: Friday, February 22, 2008 12:20 PM
To: colorant
Cc: linux-omap@xxxxxxxxxxxxxxx; linux-omap-open-source@xxxxxxxxxxxxxx
Subject: Android on OMAP, was: Anyone porting Android to Omap2430 ?
colorant wrote:
I am trying to porting android to omap2430 , I patch the android
driver to the both 2.6.21 and 2.6.24 kernel.They both don't work, the
startup bar comes out , but the main srceen not showing, the userspace
program crash due to some Segmentation Fault and sometimes some other
errors.
I wonder is there anyone here have the experience of doing this work ?
Yes and no ;) Yes regarding Android, no regarding omap2430.
Can someone shareing some tips on it ?
I'm currently looking if Android can start on good old OMAP5912 OSK
with Mistral display [1]. The advantage (besides it is the only OMAP
board I have ;) ) is that it has a nice form factor, the buttons look
somehow like the Android emulator view and it is well supported by
kernel. The disadvantage is that it has only 32MB, I'm not sure if
this is sufficent to run Android.
I mainly did what
http://androidzaurus.seesaa.net/article/74237419.html
describes:
- Extracting userdata, system and dev from running Android emulator
using a static BusyBox and SDcard simulation (spent some time to get
yaffs2 images userdata and system to mount/extract on host system, but
can't find a working way for this).
- Extracting diff between clean 2.6.23 and Android 2.6.23, throwing
away all goldfisch and qemu related changes, getting an architecture
independent Android patch (mainly drivers/android and drivers/binder)
- Switching back recent OMAP git to 2.6.23 and applying patch
extracted above.
- Setting up an EABI environment: codesourcery toolchain, kernel and
ramdisk (busybox etc).
- Establishing the Android file system (ramdisk, system, userdata,
dev) on a USB stick (can't get CF card working on OSK and 2.6.23.
Anybody has this working?).
- Booting the kernel, mounting USB stick, and then doing the chroot:
-- cut --
# chroot /mnt/usb/ /a.sh
ioctl LOOP_SET_FD failed: Bad file number
ioctl LOOP_SET_FD failed: Bad file number
binder_open: 886:886
binder_open: 888:888
-- cut --
And that's it. No ctrl-c or anything working any more. Only thing I
can do then is restarting the board (and fixing ext2 file system on
then unclean USB stick ;) )
To do:
- Look what the system likes to tell me with "ioctl LOOP_SET_FD
failed: Bad file number".
- Checking major/minor numbers for binder:
[2] mentions
-- cut --
Copy the /dev/binder to /android/dev/binder. This was necessary
because in the emulator the binder device had major number 252 while
in the Zaurus it had 253.
-- cut --
and [3]
-- cut --
6. cat /proc/devices and look for binder device's major number
7. mknod /dev/binder c <major> 0
-- cut --
but seems that I don't have a binder entry in /proc/devices. And I
checked in emulator as well, there isn't a /proc/devices binder entry
(?). Not sure at the moment where to get the correct binder major from.
Where are you exactly at the moment and what are the detailed error
messages?
Best regards
Dirk
Btw: You should use new OMAP list linux-omap@xxxxxxxxxxxxxxx
http://vger.kernel.org/vger-lists.html#linux-omap
and not post to
linux-omap-open-source@xxxxxxxxxxxxxx
any more.
[1] http://elinux.org/OSK
[2]
http://euedge.com/blog/2007/12/06/google-android-runs-on-sharp-zaurus-sl-c76
0/
[3] http://groups.google.com/group/android-internals/msg/49aebf8b665eb1ed?
_______________________________________________
Linux-omap-open-source mailing list
Linux-omap-open-source@xxxxxxxxxxxxxx
http://linux.omap.com/mailman/listinfo/linux-omap-open-source
-------------------------------------------------------DISCLAIMER------------------------------------------------------
The information transmitted herewith is confidential and proprietary information intended only for use by the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.
--------------------------------------------------------------------------------------------------------------------------------
Please do not print this email unless it is absolutely necessary. Spread environmental awareness.