Build Android Image

From Joggler
Jump to navigation Jump to search

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

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.

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.