4/16/2010

Android on Freerunner Cupcake Porting Note

Since it cost me a lot of time to building the android-cupcake and flashing the built image to OpenMoko freerunner, in case you had/have been suffering from such annoyance, a summarized note is briefed below

Revision: v1.0
1         Preparation
1.1         Create $HOME/cupcake

1.2         Create directories
drwxr-xr-x  2 hsiehwei hsiehwei 4096 2010-02-26 11:01 applications
drwxr-xr-x  2 hsiehwei hsiehwei 4096 2010-02-26 12:27 bin
drwxr-xr-x  2 hsiehwei hsiehwei 4096 2010-02-26 11:01 downloads
drwxr-xr-x  2 hsiehwei hsiehwei 4096 2010-02-26 11:01 sdk
drwxr-xr-x 17 hsiehwei hsiehwei 4096 2010-02-26 12:14 src
drwxr-xr-x  2 hsiehwei hsiehwei 4096 2010-02-26 11:01 tools

1.3         Prepare tools (GIT and others)
$ export PATH=$HOME/android/bin:$PATH
$ sudo apt-get install git-core
$ curl http://android.git.kernel.org/repo > ~/android/bin/repo
$ chmod a+x ~/android/bin/repo
$ sudo apt-get install python
$ sudo apt-get install git-core gnupg flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev valgrind libreadline5-dev x11proto-core-dev libx11-dev liblzo2-dev
$ sudo apt-get autoremove gcc g++
$ sudo apt-get install gcc-4.3 g++-4.3
$ sudo apt-get install uboot-mkimage
/* Install Sun-Java-1.5.0 since jdk6 is NOT supported right now. But currently, Ubuntu 9.10 Karmic doesn’t maintain jdk1.5, therefore use Jaunty instead. */
$ sudo cp /etc/sources.list /etc/sources.list.karmic
$ sudo vi /etc/sources.list
/* Perform the following command in vi then save. */
:%s/karmic/jaunty/g
/* Update package database */
$ sodu apt-get update
/* Install jdk1.5 */
$ sudo apt-get install sun-java5-jdk
$ sudo update-java-alternatives –l
java-1.5.0-sun 53 /usr/lib/jvm/java-1.5.0-sun
$ sudo update-java-alternatives –s java-1.5.0-sun

1.4         Download Source Code
$ cd ~/cupcake /src
$ repo init -u git://gitorious.org/android-on-freerunner/freerunner_platform_manifest.git -b cupcake

/* This step would cost a lot time, and fails many times, please re-execute the above command when downloading stops. */
$ repo sync

/* Update projects, copy downloaded code into current directory. Project-path can be found in src/.repo/manifests/default.xml, also in src/.repo/project.list */
$ repo sync

/* Alternatively, use the following steps to build an automatic sync script. */
$ echo “#!/bin/bash” > syncall.sh
$ cat .repo/project.list >> syncall.sh
$ vi syncall.sh
/* Perform the following command in vi then save. */
:%s:^\(\w\+\):repo sync \1:g
$ chmod u+x syncall.sh
$ ./syncall.sh

1.5         Add GAO RFID Driver into the kernel
/* Add gao217003.c into kernel */
$ cd ~/cupcake/src
$ cp path_to_gao217003.c kernel/drivers/usb/misc
$ vi kernel/drivers/usb/misc/Kconfig
/* Configure kconfig, add the following block in the end of the file. */
config USB_GAO_READER
        tristate "GAO USB RFID Reader driver"
        depends on USB
        help
          Driver for GAO USB RFID Reader 217003
$ vi kernel/drivers/usb/misc/Makefile
/* Configure makefile, add the following line into a proper place. */
obj-$(CONFIG_USB_GAO_READER)    += gao217003.o
/* Configure .config, add the following line into section of USB Miscellaneous drivers. */
CONFIG_USB_GAO_READER=y


2         Building
/* Build image */
$ cd ~/cupcake /src
$ make clean TARGET_PRODUCT=freerunner
$ make TARGET_SIMULATOR=false TARGET_PRODUCT=freerunner showcommands

3         Flashing the Neo FreeRunner
/* Download and unpack the android-on-freerunner auto-installer from http://code.google.com/p/android-on-freerunner/, like android-on-freerunner-cupcake-0.1.1.tar.gz */
/* Replace kernel.img, system.img, userdata.img, ramdisk.img with just-built files from ~/cupcake/src/out/target/product/freerunner/ */
/* Copy those files to a microsd drive, and boot neo from the drive, the installation will start automatically */
/* The files we put into the driver look like:
boot/ uImage-GTA02.bin (from android-on-freerunner-cupcake-0.1.1.tar.gz)
kernel.img (we built)
qi.img (from android-on-freerunner-cupcake-0.1.1.tar.gz)
ramdisk.img (we built)
system.img (we built)
uImage (from android-on-freerunner-cupcake-0.1.1.tar.gz)
uImage.bin (from android-on-freerunner-cupcake-0.1.1.tar.gz)
userdata.img (we built) */

References:

[1]       GIT Android on Freerunner, http://gitorious.org/android-on-freerunner
[2]       Acndroid-on-freerunner, http://code.google.com/p/android-on-freerunner/
[3]       Android Open Source Project, http://source.android.com/download
[4]       Build Android Platform, http://mmmyddd.freeshell.net/wiki/android/build.html
[5]       Qi, http://wiki.openmoko.org/wiki/Qi
[6]       Flashing the Neo FreeRunner, http://wiki.openmoko.org/wiki/Flashing_the_Neo_FreeRunner
[7]       Neo FreeRunner 新手手冊 (9) 安裝 Android, SHR, FDOM, Debian SD (SDHC) , http://tony-tu.blogspot.com/2008/12/neo-freerunner-8-android-shr-fdom.html
[8]       Android porting, http://wiki.openmoko.org/wiki/Android_porting
[11]   http://www.mail-archive.com/android-freerunner@android.koolu.org/msg01022.html
[12]   http://www.mail-archive.com/android-freerunner@android.koolu.org/msg01020.html
[13]   http://www.mail-archive.com/android-freerunner@android.koolu.org/msg01023.html
[14]   http://www.mail-archive.com/android-freerunner@android.koolu.org/msg01021.html
[15]   http://www.mail-archive.com/android-freerunner@android.koolu.org/msg01021.html
[16]   http://www.mail-archive.com/android-freerunner@android.koolu.org/msg01049.html

沒有留言:

張貼留言