Build Android Image

This page describes briefly how to create a working Android build based on Android-x86.org using Debian/Ubuntu Linux.

If you want to use a prebuilt image instead, see Android Prebuild Image.

We are using the Donut (1.6) branch with kernel 2.6.32.

For now, we are reusing the eeepc target.

What does work?

 * It boots :-)
 * Graphics is ok, albeit slow
 * eth0 works
 * Touchscreen works
 * Wifi works (you need to reactivate it after a reboot)
 * Sound works
 * Virtual SD card / persistent data can be used (see below)

What does not work?

 * When the display goes to sleep, it flips to a virtual terminal and never recovers
 * Can be solved by pressing Alt-F1, Alt-F7) if a keyboard is connected
 * Time sync (you need to set the correct data/time manually)
 * Maybe include NTP?

TODO

 * Create an own joggler target for android-x86
 * Fix the problems above
 * Add a framebuffer driver for Intel GMA500/Poulsbo to speed up GUI
 * Maybe we can use the driver from the Gentoo repo?
 * http://sources.gentoo.org/viewcvs.py/gentoo-x86/x11-drivers/psb-kmod/psb-kmod-4.41.1_p10-r1.ebuild?view=markup
 * http://sources.gentoo.org/viewcvs.py/gentoo-x86/x11-drivers/psb-firmware/psb-firmware-0.30_p3.ebuild?view=markup
 * I've uploaded a patched version of this driver:
 * http://www.flattermann.net/files/joggler/linux-2.6.32.1-drm-for-psb.tar.bz2
 * It does NOT work yet (hangs at "modprobe psb"), but maybe somebody wants to give it a try
 * Note: The firmware file ("msvdx_fw.bin") must be placed in /etc/firmware!
 * The driver was going down a path of sdvo instead of lvds - I changed i915_reg.h to remove the IS_POULSBO(dev) from the IS_I9XX define
 * The driver needs drm_acpi_ignore = 1 to setup LVDS in intel_lvds.c
 * Driver does not crash now and creates a /dev/fb0 - Another crash to sort out now :)
 * setting 	if (0) { //get the BLC init data from VBT in intel_lvds.c stops the crash
 * http://pastebin.com/aj96ZZws - for dmesg
 * Tested the framebuffer with http://pastebin.com/FBEPn0hS which gave the following output but hung when writing to the fb, completes with the writes removed by the ifdef
 * http://pastebin.com/q1VkCmBm
 * This patch for intel moorestown (similar gx hardware) is present in the meego kernel and may be useful - linux-2.6.34-img-graphics-driver.patch - need to backport it to an android era kernel.
 * Sophomore reported the following gave him a working framebuffer in #joggler 31.05.10 but was having X issues, confirmed by che09 working with debian testing
 * http://ppa.launchpad.net/gma500/ppa/ubuntu/pool/main/p/psb-kernel-source/
 * boot line - video=efifb:off enable_mtrr_cleanup
 * driver - options psb disable_vsync=1 ignore_acpi=1 force_pipeb=1
 * Optimize the kernel?

Install the necessary packages
Follow http://source.android.com/download to set up a build enviroment.

On 32 bit Linux, you need at least the following packages: $ sudo apt-get install git-core gnupg sun-java5-jdk flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev

On 64 bit Linux, install: $ sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl sun-java5-jdk zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev

Switch to JDK-5: (JDK-6 is not supported!) $ sudo update-java-alternatives -s java-1.5.0-sun

*Refer to the following link to obtain JDK-5 for unbuntu, following method 2 http://blog.enea.com/Blog/bid/32050/Ubuntu-9-10-Java-5-and-the-Android-Open-Source-Project

Get the source
See http://www.android-x86.org/getsourcecode.

Short version: $ mkdir android-x86 $ cd android-x86 $ repo init -u git://git.android-x86.org/platform/manifest.git -b donut-x86 $ repo sync

Now is the perfect time for lunch, because this will take some hours.


 * Best to use the mirror site as this faster for download repo init -u git://android-x86.git.sf.net/gitroot/android-x86/manifest.git -b donut-x86.

These instructions use the repo script. If you are using Debian you may not have this, you can follow the instructions below to get it. http://source.android.com/source/git-repo.html

Switch the kernel to 2.6.32
On the top dir of your android-x86 directory, enter

$ cd kernel $ git checkout -b joggler-2.6.32 x86/android-2.6.32 $ cd ..

This will create a new git branch called "joggler-2.6.32" with the 2.6.32 kernel

Patch the kernel
Add the r8168 driver and apply the i2c, backlight, sound patches to the kernel:

$ mkdir joggler-patches $ cd joggler-patches $ wget http://adqmisc.googlecode.com/svn/trunk/joggler/joggler-i2c-fix-2.6.32-v1.patch $ wget http://adqmisc.googlecode.com/svn/trunk/joggler/joggler-backlight-2.6.32-v1.patch $ wget http://www.flattermann.net/files/joggler/joggler-sound-fix-2.6.32-v2.patch $ wget http://www.flattermann.net/files/joggler/r8168.patch $ cd ..

$ cd kernel $ patch -p1 < ../joggler-patches/joggler-i2c-fix-2.6.32-v1.patch $ patch -p1 < ../joggler-patches/joggler-backlight-2.6.32-v1.patch $ patch -p1 < ../joggler-patches/joggler-sound-fix-2.6.32-v2.patch $ patch -p1 < ../joggler-patches/r8168.patch $ cd ..

Patch the android base
You need to apply the 32bpp patch, otherwise the graphics will be screwed up.

The vold patch is needed to avoid segfaults in vold @ libc.so.

The touchscreen patch activates the touchscreen within the Android GUI.

The init scripts are needed for eth0.

The system.prop is needed for sound/wifi.

$ cd joggler-patches $ wget http://patch-hosting-for-android-x86-support.googlecode.com/files/32bpp.patch $ wget http://www.flattermann.net/files/joggler/vold-mmc-controller-bootstrap-segfaults-fix.patch $ wget http://www.flattermann.net/files/joggler/android-touchscreen-eventhub-btnmouse.patch $ wget http://www.flattermann.net/files/joggler/android-powerdialog-by-touch.patch $ wget http://www.flattermann.net/files/joggler/system.prop $ wget http://www.flattermann.net/files/joggler/2-mount $ wget http://www.flattermann.net/files/joggler/4-joggler-local $ wget http://www.flattermann.net/files/joggler/android-busybox-module-path.patch $ cd ..

$ cd frameworks/base $ patch -p1 < ../../joggler-patches/32bpp.patch $ patch -p1 < ../../joggler-patches/android-touchscreen-eventhub-btnmouse.patch $ patch -p1 < ../../joggler-patches/android-powerdialog-by-touch.patch $ cd ../..

$ cd system/core $ patch -p1 < ../../joggler-patches/vold-mmc-controller-bootstrap-segfaults-fix.patch $ cd ../..

$ cd external/busybox $ patch -p1 < ../../joggler-patches/android-busybox-module-path.patch $ cd ../..

$ cp joggler-patches/system.prop vendor/asus/eeepc/ $ cp joggler-patches/2-mount bootable/newinstaller/initrd/scripts/ $ cp joggler-patches/4-joggler-local bootable/newinstaller/initrd/scripts/

Setup build config
Put the file http://www.flattermann.net/files/joggler/buildspec.mk into the top dir.

Put the file http://www.flattermann.net/files/joggler/joggler_defconfig into kernel/arch/x86/configs.

Compile
$ make iso_img

If you are building on a multi-core system, you may want to add "-jN" (N=number of cores/processors), e.g.

$ make -j2 iso_img

for a dual-core system.

Now is the perfect time for dinner, because this will take some hours. :-)

Create a USB stick
See Android Prebuild Image if you've downloaded a prebuilt image.

Create three partitions on the USB stick.


 * p1: FAT32 partition with ~1GB (this will be your EFI+Android base), call it "ANDROID"
 * p2: ext2 partition with ~1GB (this will be your /data), call it "DATA"
 * p3: FAT32 partition using the remaining space (this will be your /sdcard), call it "SD"

The easiest way to achieve this is to use a program like "gparted".

Put the files from http://www.flattermann.net/files/joggler/efi-android.tar.bz2 on the first partition (see also Efi).

Put the files


 * initrd.img
 * install.img
 * kernel
 * ramdisk.img
 * system.img

from out/target/product/eeepc/ in the directory "android" on your first partition.

That's it!

Put the stick into your Joggler and plug in the power.