Android Froyo release 9.2 for i.MX
Published on December 7, 2010
Freescale's moving fast on the Android front. It appears that our blog posts are a couple of versions behind.
Release 9.1 from Freescale included a large number of fixes and enhancements:
- Add HW support to i.MX508 RD board
- More stable suspend/resume in various use cases (e.g. suspend/resume when idle / audio playback / camera preview)
- More stable camera/camcorder function
- Improved 720p TVout performance on i.MX51
- Add back dual SD and u-disk
- Add back Factory reset and SW update (EXT4/SD only, UBI/NAND will be in next release)
- Add back dual display
- Add speech codec
- Reduced Android bootup time (35s -> 25s)
- Power consumption in all typical use case are now equal to R8.1 (we have higher power consumption in R9)
And release 9.2 added even more:
- Higher CTS pass rate - only 5 failure cases left among all 23480 cases
- 2 failures are caused by wrong CTS test case
- 1 failure is caused by missing G-sensor HW in our board
- 2 failures are caused by missing Google Map service in our delivery
- Add back "Recovery on UBI/NAND"
Note: Android file system can be on NAND but boot from NAND is not verified in R9.2 - Add RGB888 support in Framework to support 24bit LCD
- More stable USB mass storage operation (e.g. copy several GB files into SD card via USB)
- Fix memory leak when running 3D app which will cause system freeze after running/exit a 3D app for many times
- Fix high CPU usage issue when showing livewallpaper
- Fix system freeze issue when receiving a phone call during video playback
- Fix suspend/resume issue when playback video
- Fix demo app issue and add a new demo for handwriting over text in i.MX508
- Fix many codec related bugs
Our early experiences show the R9.2 release to be more stable and more responsive, and we recommend that all of our customers using Android upgrade as soon as is convenient.
The following notes will walk through steps to get -R9.2
up and running without too much in the way of commentary. For descriptions of the various components, we'll refer you to the original Android porting posts:
- Froyo on Nitrogen-E
- Tweaking Froyo for Nitrogen Part 1: Touch support
- Tweaking Froyo for Nitrogen Part 2: Sound and Media
- Tweaking Froyo for Nitrogen Part 3: Housekeeping and custom WLAN
- Android WLAN: the rest of the story
- Camera driver example code
- OV5642 camera driver under Android
To begin with, you'll need to download the R9.2 package from Freescale and we'll follow the instructions in /opt/imx-android-r9.2/doc/i.MX_Android_R9.2_User_Guide.html
with just a few exceptions:
Get Android Source Code
Get core Android sources:
$ cd ~
$ mkdir myandroid
$ cd myandroid
$ curl https://android.git.kernel.org/repo > ./repo
$ chmod a+x ./repo
$ ./repo init -u git://android.git.kernel.org/platform/manifest.git -b froyo
$ cp /opt/imx-android-r9.2/code/r9.2/default.xml .repo/manifests/default.xml
$ ./repo sync
Use Boundary Devices kernel and bootloader
Get the Boundary Devices kernel instead of the one from kernel.org:
$ cd ~/myandroid
$ git clone https://boundarydevices.com/git-repos/linux-bd.git/ kernel_imx
Get the Boundary Devices U-Boot repository instead of the one from Denx.de:
$ cd ~/myandroid/bootable/bootloader
$ git clone https://boundarydevices.com/git-repos/u-boot-nitrogen.git uboot-imx
If you're going to use the Unigen wireless LAN adapter, install it in external/rtl8172
:
$ cd ~/myandroid/bootable/external/ && git clone https://boundarydevices.com/git-repos/rtl8172.git/
Apply Freescale patches
$ cd ~/myandroid $ . /opt/imx-android-r9.2/code/r9.2/and_patch.sh $ help # You should see "c_patch" function $ c_patch /opt/imx-android-r9.2/code/r9.2 freescale_patches
Apply Boundary Devices patches
To make life a bit easier, we're placing a repo diff
on our web-site at https://boundarydevices.com/imx_android_r9.2_boundary20101207.diff and will add comments with links to as we update things.
Prepare and compile non-Android components
The Linux kernel and U-Boot aren't build as a part of the Android build process so you'll need to compile them by hand.
Note that there are dependencies on kernel versions and Android components (especially the hardware acceleration APIs). You should use the boundary20101115 branch when building the 9.2
release of Android.
We also suggest that you use the boundary20101115 branch of U-Boot, but only because it's the latest.
Linux kernel:
~$ cd myandroid/kernel_imx
~/myandroid/kernel_imx$ git checkout origin/boundary20101115 -b boundary20101115
~/myandroid/kernel_imx$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- nitrogen_android_defconfig
~/myandroid/kernel_imx$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- uImage modules
...
U-Boot:
~$ cd myandroid/bootable/bootloader/uboot-imx
~/myandroid/bootable/bootloader/uboot-imx$ git checkout origin/boundary20101115 -b boundary20101115
~/myandroid/bootable/bootloader/uboot-imx$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- nitrogen_config
~/myandroid/bootable/bootloader/uboot-imx$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- all
...
~/myandroid/bootable/bootloader/uboot-imx$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- nitrogen_bootscript
Compile Android
We still haven't separated our board from the Freescale Babbage, so the Android compilation process is the same as in the Freescale release notes:
~$ cd myandroid/
~/myandroid$ make PRODUCT-imx51_bbg-eng 2>&1 | tee build_imx51_bbg_android.log
...
Create SD card
Since our original post on building Android, we've switched all of our boards to boot to serial EEPROM and are recommending that customers use boot scripts, so the setup of the boot partition has changed. The Freescale Android release also changed the mount commands in init.rc
to ext4
, so we've done the same.
The first step is still to partition the disk. The following is a pretty hairy command-line that will wipe out any existing partitions on your SD card and create a set of 6 partitions for Android.
user@host:~$ echo -e "dn1ndn2ndn3ndn4nnnpn1nn+100Mnnnpn2nn+200Mnnnen3nn+300Mnnnpnnnnnn+100Mnnnn+100Mnnnnntn1nbntn2n83ntn4n83ntn5n83ntn6n83ntn7nbnwn" | sudo fdisk /dev/mmcblk0
user@host:~$ sudo fdisk -l /dev/mmcblk0
Disk /dev/mmcblk0: 3999 MB, 3999268864 bytes
4 heads, 16 sectors/track, 122048 cylinders
Units = cylinders of 64 * 512 = 32768 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/mmcblk0p1 1 3201 102424 b W95 FAT32
/dev/mmcblk0p2 3202 9602 204832 83 Linux
/dev/mmcblk0p3 9603 19203 307232 5 Extended
/dev/mmcblk0p4 19204 122048 3291040 83 Linux
/dev/mmcblk0p5 9603 12803 102424 83 Linux
/dev/mmcblk0p6 12804 16004 102424 83 Linux
/dev/mmcblk0p7 16005 19203 102360 b W95 FAT32
The following commands will create filesystems in the
user@host:~$ sudo mkdosfs /dev/mmcblk0p1 -n BOOT
user@host:~$ sudo mkfs.ext4 /dev/mmcblk0p2 -L SYSTEM
user@host:~$ sudo mkfs.ext4 /dev/mmcblk0p4 -L MEDIA
user@host:~$ sudo mkfs.ext4 /dev/mmcblk0p5 -L DATA
user@host:~$ sudo mkfs.ext4 /dev/mmcblk0p6 -L CACHE
user@host:~$ sudo mkdosfs /dev/mmcblk0p7 -n RECOVERY
user@host:~$ sync
At this stage, you'll want to remove and re-insert your SD card to allow Linux to auto-mount the partitions for copying. If your development station uses gnome-volume-manager
, you should see mounts like the following:
user@host:~$ mount | grep /media | sort
/dev/mmcblk0p1 on /media/BOOT type vfat (rw,nosuid,nodev,uhelper=udisks,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,flush)
/dev/mmcblk0p2 on /media/SYSTEM type ext4 (rw,nosuid,nodev,uhelper=udisks)
/dev/mmcblk0p4 on /media/MEDIA type ext4 (rw,nosuid,nodev,uhelper=udisks)
/dev/mmcblk0p5 on /media/DATA type ext4 (rw,nosuid,nodev,uhelper=udisks)
/dev/mmcblk0p6 on /media/CACHE type ext4 (rw,nosuid,nodev,uhelper=udisks)
/dev/mmcblk0p7 on /media/RECOVERY type vfat (rw,nosuid,nodev,uhelper=udisks,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,flush)
At this point, you're ready to copy files onto the SD card.
The /BOOT
partition needs at least a kernel (uImage
) and RAM-disk (initrd.u-boot
), but you should probably place a boot script and your U-Boot image on the SD card as well, so you know precisely what version is running:
user@host:~$ cp -fv ~/myandroid/kernel_imx/arch/arm/boot/uImage /media/BOOT
user@host:~$ mkimage -A arm -O linux -T ramdisk -n "Initial Ram Disk"
-d ~/myandroid/out/target/product/imx51_bbg/ramdisk.img
/media/BOOT/initrd.u-boot
user@host:~$ cp -fv ~/myandroid/bootable/bootloader/uboot-imx/mx51_ubl_ecspi.bin /media/BOOT/u-boot-nitrogen-20101207.bin
user@host:~$ cp -fv ~/myandroid/bootable/bootloader/uboot-imx/nitrogen_bootscript /media/BOOT/nitrogen_bootscript-20101207
The /SYSTEM
and /DATA
partitions are copied straight out of the Android build tree:
user@host:~$ cp -afvr ~/myandroid/out/target/product/imx51_bbg/system/* /media/SYSTEM/
user@host:~$ cp -afvr ~/myandroid/out/target/product/imx51_bbg/data/* /media/DATA
The /RECOVERY
, /MEDIA
, and /CACHE
partitions aren't created by the Android build process, so we won't go into the details here.
Don't forget to sync the filesystems before removing the card:
user@host:~$ sync && sudo umount /media/*