Thursday, April 22, 2010

Install Android on Iphone Guide

How to install iDroid: Android on your first-generation iPhone

Download links to the required files are displayed in the left hand column on this page.

These instructions describe how to build an Android system for iPhone 2G from
sources. These instructions are currently just notes and are being gradually
worked into a more readable form. Please submit questions and suggestions for
clarification to #iphonelinux on

The essential pieces for booting Android are:

      1. Linux kernel
      2. Wi-Fi and touchscreen firmware
      3. Boot initrd
      4. Android ramdisk.img
      5. Android system.img
      6. Android userdata.img
      7. Android cache.img
      8. openiboot

Instructions for pre-built images

If you have a prebuilt android.img.gz, ramdisk.img, system.img, userdata.img
and cache.img, you still need to follow the directions in the "Firmware"
section and add all the firmware files to

/lib/firmware in android.img.gz (it's a compressed ext2 image)

/etc/firmware in system.img (it's an uncompressed ext2 image)

After this, you can skip down to "Installation".

Linux kernel

1. Check out commit e27f17b5318851395a66cbaf1524ea89ff8f0cb9 of the
android-2.6.32 branch of git://

2. Apply the patches from android/kernel

3. Fix the Makefile for your system (you may need to use Google's repo to
check out your own copy of the Android toolchain).

4. Use something based on android/kernel/.config as your .config

5. Build


These can't be redistributed due to copyright laws. The multitouch firmware
will need to be extracted from your ioreg tree. Install iokittools from Cydia
and perform ioreg -l -w 0 and pipe the result to some file. Read this file and
look for entries under AppleMultitouchSPI for Firmware and A-Speed Firmware.
These contain a simple hexadecimal encoding for the bytes of the firmware
files. Convert and keep "Firmware" as zephyr_main.bin and "A-Speed Firmware"
as zephyr_aspeed.bin.

The firmware for the wi-fi can be found on Marvell's site at Under "Choose a platform", select "Linux
2.6 - Fedora" and click the Search button under the drop down box. The
SD-8686-* zip archive will contain the files. Rename helper_sd.bin to
sd8686_helper.bin and keep that and sd8686.bin.

So, you have zephyr_main.bin, zephyr_aspeed.bin, sd8686_helper.bin, and

It's also possible to cut a more recent version of the Marvell firmware from
the iPhone kernel. Can someone create a firmware cutter utility for this

Boot initrd

The Android initrd was created under a Debian installation of iPhone Linux
(which is not currently available) using the script.
However, if you read it, you can figure out generally how it's done.

YOU WILL NEED TO COPY ALL THE FIRMWARE *.bins TO /lib/firmware on this

You end up with android.img.gz

Android images

First, checkout 1.6 (Donut) using Google's repo tool. Copy vendor/apple to
vendor/apple in their tree. Rename data/sounds/ to
data/sounds/ (if you want the built-in sounds).

Copy all the firmware *.bins to vendor/apple/firmware as well.

Then, apply android/android.patch provided. Then, do the following to create a
"generic" image:

      . build/
      [Select device, debug, generic, engineering]
      export TARGET_USERIMAGES_USE_EXT2=true
      make -j4 PRODUCT-generic-eng

Now wait forever for Android to build. You'll get ramdisk.img and system.img
in out/debug/target/product/generic/. Ignore the other .img files, we won't be
using them.

Android ramdisk.img

Create a blank 1 MB file and make a ext2 filesystem on it. Mount it as a
loopback device. Rename the ramdisk.img from Android to ramdisk.img.gz. Use
gunzip on ramdisk.img.gz. Use cpio -i -F ramdisk.img as root with the current
directory in the new ext2 filesystem to extract the ramdisk files onto the

Apply android/init.rc.patch to init.rc

Make a directory called /cache

Unmount and you have your ramdisk.img

Android system.img

You can just use the system.img Android compiled.

Android userdata.img

You can start with a perfectly empty userdata.img (as long as its properly
formatted). However, without the Dalvik caches, the boot will hang the first
couple of times until those can be generated. This is some strange timeout

After the initial boot, you have to do

      INSERT INTO secure (name, value) VALUES ('device_provisioned', 1);

Using sqlite3 in the database


If the device is not "provisioned", it will automatically reject all incoming
calls. Very stupid.

Can someone please show me how this can be made less aggravating?

Android cache.img

This can just be an empty 50 MB ext2 filesystem.


See the instructions in the openiboot folder in the iphonelinux repo.


0. Jailbreak your iPhone.

1. Under the jailbroken environment, put ramdisk.img, system.img, ramdisk.img,
userdata.img, cache.img, android.img.gz, and zImage in /private/var.

2. Follow the instructions for installing openiboot.
      - Essentially:
            1. sudo ./loadibec openiboot.img3
            2. Use Hold button to select Console
            3. Push Home button
            4. sudo ./oibc
            5. Type install
      - loadibec and oibc are compiled for x86 Linux.
            - Need libusb, pthreads, readline.


In the openiboot bootloader, it should be enough to select Console with Hold
and hold the Home button for more than two seconds to trigger the boot of

1 comment:

  1. the marvel website must have updated or something because this "search" thing is not there and i cant get the zip archive