Contact Us
EnglishRussianGreek
Home Wiki

Porting Android

From GizmoForYou Wiki

Jump to: navigation, search

Contents

Overview

Since Android is considered to be the Next Big Thing on Embedded platforms, we have decided to port it onto the FLOW and have a nifty User Interface for everyone to poke and play with. Also since Android already has many applications for GSM and GPS functionality as well as many others, it only seemed logical to do so.

Instructions posted below are mostly taken from the description that was written by Elvis Dowson without whose help this port would probably never be possible.

You can read the instructions originally posted by Elvis Dowson here. The description outlined here was initially written to be done on Fedora 10 but we also tested it on Fedora 11 and added information on how to do it on Ubuntu 9.04.

Setup the FLOW Build environment

Although we already described how to setup the Build Environment for the FLOW in the FLOW Build Environment section, Elvis was kind enough to write his own description and detailed instructions which are specifically for the Android port and Fedora 10 platform. You can find these instructions at the following location:

The above document describes the basic steps required to bring up the Overo platform using Fedora 10.

Build the android-2.6.29 Kernel image

Download the latest release package to a temporary folder. You can find the latest release at the following locations:

  • GizmoForYou (FLOW Compatible files) - R3 29/12/2009 Mirror1
  • Elvis Dowson Website Mirror2

Extract the contents of the recipe/ user.collection-2009061800.tar.gz file from the download package to the following location:

~/overo-oe/user.collection

After that type the following commands:

cd ~/overo-oe
bitbake x-load
bitbake u-boot-omap3
bitbake linux-omap3-2.6.29
bitbake omap3-android-2.6.29-image

Total estimated build time can vary from 8 to 12 hours depending upon you machine speed.

The Kernel should build with the latest FLOW implementations of Hardware features. The features supported so far are:

  • LCD - SHARP LCD
  • Touchscreen
  • Buttons - All 4 FLOW Buttons
  • WiFi
  • GSM
  • Audio
  • ...

If you get some errors that indicates a dependency loop in ~/overo-oe/user.collection/recipes/linux/linux-omap3_2.6.29.bb, you may patch Bitbake to bypass dependency sanity check adding comments lines 296 to 315 in ~/overo-oe/bitbake/lib/bb/runqueue.py . When the compilation is finished, don't forget to uncomment these lines.

If your compilation fails on a package fetch checksum error, you can bypass it by downloading manually the package and entering these commands:

cat  ~/overo-oe/tmp/checksums.ini >>~/overo-oe/org.openembedded.dev/conf/checksums.ini
cd ~/overo-oe/org.openembedded.dev
python contrib/source-checker/oe-checksums-sorter.py -i conf/checksums.ini

Build the android-1.5 SDK

Below is the description for downloading and building the Android SDK for use on the FLOW which operates on the Gumstix Overo line of platforms.

Prerequisits

Ubuntu users will need to install the following packages.

sudo apt-get install sun-java5-jdk 
sudo apt-get install bison flex gperf curl
sudo apt-get install libc6-dev-i386 zlib1g-dev libx11-dev libstdc++5

If you are on a 64bit Ubuntu environment also install the following packages.

sudo apt-get install ia32-libs 
sudo apt-get install g++-multilib

Installing repo

Create a private bin directory and get the repo script.

mkdir ~/bin
curl http://android.git.kernel.org/repo >~/bin/repo
chmod a+x ~/bin/repo

You need to include the private bin directory in your PATH environment variable.

echo export PATH=”${HOME}/bin:$PATH” >> ~/.bashrc

For the changes to take effect restart Terminal or enter

source ~/.bashrc

Download the Android-1.5 SDK

Download the Android SDK:

cd ~/
mkdir android
cd android
repo init -u git://android.git.kernel.org/platform/manifest.git
repo init -b android-1.5
repo sync

Total estimated download time can vary from 4 to 6 hours depending upon your connetion speed. This repository is over 2.4GB in size compressed.

You may get an error that a the checksum of a required download has no entry in conf/checksums.ini causing repo sync to fail. This can be fixed by adding the following setting to ./build/conf/local.conf

OE_ALLOW_INSECURE_DOWNLOADS = "1"

Patch the Android-1.5 SDK

You will have to manually apply the patches to the android repository. It is a limitation of the Google repo tool, which allows you to create a patch file, but cannot apply a repo generated diff/patch file back to the repository.

You can use the repo-apply script from the Blog section to automate the process.

After creating the script, copy it to you private bin folder created before. Then you are ready to apply the android-1.5 sdk patch file found in the /patches folder of the android package that you downloaded earlier. In fact you may extracted android-2.6.29-source-r07.zip (previously downloaded) to your home folder.

The command line to apply the patch using repo-apply will look something like this then.

repo-apply ~/android-2.6.29-source/200906041400/patch/android-1.5r2.patch ~/android

The repo-apply script will take the patch and split it up into several patches. Then it will apply each individual patch to the corresponding git repository.

Android Patch for Overo Fire

If you are using Overo Fire then you shall need to additionally apply the patch described below to avoid having "vold" errors and eventually crashing android. Also the patches below describe the process on patching Android to use the Marvell WiFi module used on the Overo Fire platform.

MMC & General Patches
--- a/system/core/vold/mmc.c    2009-07-02 16:15:08.000000000 -0400 
+++ b/system/core/vold/mmc.c    2009-07-17 10:35:02.000000000 -0400 
@@ -54,8 +54,14 @@ 
             continue; 
         sprintf(tmp, "%s/%s", SYSFS_CLASS_MMC_PATH, de->d_name); 
-        if (mmc_bootstrap_controller(tmp)) 
+        if (mmc_bootstrap_controller(tmp)) { 
             LOG_ERROR("Error bootstrapping controller '%s' (%m)", 
tmp); 
+        } 
+        else { 
+            //a controller has already been bootstrapped, lets stop 
trying to get more 
+            //TODO: hack fix to get around segfault on boostrapping 
sdio card connected to mmc bus 
+            break; 
+        } 
     } 
     closedir(d); 

Also Apply another patch for the same reason. This fix was suggested after the initial patch so just to be safe apply them both

diff --git a/vold/mmc.c b/vold/mmc.c
index 0f08964..77a954a 100644
--- a/vold/mmc.c
+++ b/vold/mmc.c
@@ -148,6 +148,10 @@ static int mmc_bootstrap_card(char *sysfs_path)
     sprintf(filename, "/sys%s/type", devpath);
     p = read_file(filename, &sz);
     p[strlen(p) - 1] = '\0';
+    if (strcmp(p, "SDIO") == 0) {
+       free(p);
+       return 0;
+    }
     sprintf(tmp, "MMC_TYPE=%s", p);
     free(p);
     uevent_params[1] = (char *) strdup(tmp);

Also apply the below patch for the MMC

 data/etc/vold.conf |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/data/etc/vold.conf b/data/etc/vold.conf
index 7888936..a1c50f7 100644
--- a/data/etc/vold.conf
+++ b/data/etc/vold.conf
@@ -1,9 +1,8 @@
-## vold configuration file for the emulator/SDK
+## vold configuration file for the Gumstix Overo TI OMAP 35xx platform.
 
 volume_sdcard {
     ## This is the direct uevent device path to the SD slot on the device
-    emu_media_path /devices/platform/goldfish_mmc.0/mmc_host/mmc0
-
+    media_path     /devices/platform/mmci-omap.0/mmc_host/mmc0
     media_type     mmc
     mount_point    /sdcard
     ums_path       /devices/platform/usb_mass_storage/lun0
WiFi Patches

In the archive you downloaded you shall also find all the patches necessary for the WiFi to function correctly. Follow the readme.txt instructions on what to do. you don't need to do the last 2 steps of placing the firmware or wlan files in their directories. If you downloaded the "FLOW" user.collection then the script for flashing the microSD should do that for you. Simple configure everything as required and replace the appropriate files on Android.

Kernel Headers

You will also need to copy the kernel header files from the FLOW Build Environment ~/overo-oe/tmp/staging/overo-angstrom-linux-gnueabi/kernel/include/linux to ~/android/bionic/libc/kernel/common/linux-omap3

cp -r ~/overo-oe/tmp/staging/overo-angstrom-linux-gnueabi/kernel/include/linux ~/android/bionic/libc/kernel/common/linux-omap3

Build the android-1.5 SDK

Build the patched Android SDK:

make -j 4

then

make -j 4 sdk


Your SDK is built in: ~/android/out/host/linux-x86/sdk/ Congratulations, you have just finished all required compilations :)

Adaptating Eclipse IDE to work on these builds

Eclipse needs some modifications, you can read more here: http://source.android.com/using-eclipse

After that, install the Android plugin for Eclipse as described here: http://developer.android.com/sdk/eclipse-adt.html then set the Android SDK path generated previously.

Build the Android userland root filesystem

Ensure that you have created a bootable Micro-SD card, with two partitions, one FAT32 partition to hold the MLO, u-boot.bin and uImage files and the other, an ext3 partition to hold the android userland root filesystem.

If you have not done so yet, please follow the instructions outlined in the Setting up the microSD section.

Merge the linux-omap3-2.6.29 and android-2.6.29 root filesystems

Run the android-rootfs-install script, to copy the contents of the linux-omap3 and android userland files to /media/disk (second partition).

Modify the paths in the script to the appropriate partition, since each time you automatically mount the microSD card, the mount points for the second partition can keep changing between /media/disk and /media/disk-1.

This script also copies a touchscreen calibration file, and the init.rc and inittab files required for Android.

Specify the kernel boot parameters

Erase NAND memory to load the latest u-boot changes, by interrupting the boot process and typing the following commands:

nand erase 240000 20000

Reboot the system. Modify the kernel boot parameters for booting from the microSD card, by interrupting the boot process and typing the following commands:

printenv
setenv defaultdisplay lcd43
setenv dvimode 480x640MR-16@60
setenv console ttyS2,115200n8
setenv vram 32M

setenv mmcargs setenv bootargs console=${console} vram=${vram} omapfb.vram=0:8M omapfb.mode=dvi:${dvimode}
omapfb.debug=n omapdss.def_disp=${defaultdisplay} root=/dev/mmcblk0p2 rw rootfstype=ext3 rootwait init=/init

saveenv
boot

You should see the android boot logo and the android desktop after the initial boot. The initial boot takes a bit longer to load due to the *.apk files being converted to *.dex file on startup. A subsequent reboot will occur much faster.

Did you know?

Banner