My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
BuildAndroidForX86Platforms  

#The instructions to build Android for X86.

Introduction

This page has (hopefully) the latest information about how to build Android for x86 platforms like EeePC. I try to provide instructions to build images to run on the real hardware as well as virtual machines. Due to the resource limitation (I'm doing this in my private time), currently I'm going to only use EeePC 1000HE and VirtualBox as reference running environments. I only have Ubuntu 8.10 for now, I will use it as my building platform.

As you can see that I'm not a English speaker, so please bare with my broken English. For questions, please send e-mail to android porting group for quick help.

Getting Android source code for x86

Android currently supports x86 platforms though EeePC 701 porting done by Dima Zavin <dima@android.com>. In order to build Android image for EeePC 701, you need to :
  1. follow the page http://source.android.com/download to configure your build environment. But do not check out the source code. (Do not run repo init)
  2. $ mkdir <sandbox or whatever name you like for your sandbox>
  3. $ cd sandbox
  4. $ Run repo init -u git://android.git.kernel.org/platform/manifest.git -b cupcake and answer the questions
  5. If the last step runs successfully, you should see something like repo initialized in sandbox"
  6. $ repo sync

It depends on your network, this step could take very long time (on my ADSL connection, it can take up to 3 hours).

  1. $ cd .repo
  2. create local_manifest.xml file with following contents
  3. <?xml version="1.0" encoding="UTF-8"?>
    <manifest>
    <project name="platform/vendor/asus/eee_701" path="vendor/asus/eee_701">
    </project>
    </manifest>
  4. $cd ..
  5. $repo sync
  6. patch all the patches in the downloads section of this site.
Here is a smart tip for apply patches from kewarken@gmail.com

   On Wed, 2009-04-22 at 07:04 -0700, kewarken wrote:
> If you want to apply them all at once, since the patches follow a
> pattern, you can do something like this from your cupcake source dir
> with the patches in the directory above it:
> 
> for patch in `pwd`/../*patch ; do
>     project=`awk '/^project /{print $2}' $patch`
>     (cd $project && patch -p1 < $patch)
> done
> 
> cheers,
> 
> Kris
> 

How to build an image for VirtualBox210

  1. You need to build the kernel image before you do following steps. Please see the "How to rebuild kernel" section for detail
  2. $cd sandbox
  3. $TARGET_ARCH=x86 TARGET_PRODUCT=eee_701 DISABLE_DEXPREOPT=true make -j4 droid
  4. $vendor/asus/eee_701/make_boot_img.sh configuration file
by default vendor/asus/eee_701/disk_img.conf will be used as default disk configuration file. You can create your own.
  1. cd out/target/product/eee_701
  2. $VBoxManage convertfromraw -static -format vdi installed.img installed.vdi
now you can boot installed.vdi from VirtualBox

Install and config VirtualBox210

  1. download VirtualBox package from http://download.virtualbox.org/virtualbox/2.1.0/
  2. install the package on your machine
  3. run the VirtualBox after you finished install
  4. Click on New -> Next
  5. - Name = it as "AsusAndrioid" - OStype=Linux - Version=2.6 - RAM=256MB - Hard Disks= Slot Checked Boot Harddisk with IDE Primary Master

Booting Android kernel in VirtualBox

  1. Start VirtualBox and push F12 key fast as soon as you see "Press F12 to select boot device" message in virtualbox window.
  2. Select correct boot device (should be IDE Primary Master)
  3. Boot to "std_boot"

How to rebuild kernel

  1. download kernel.config to vendor/asus/eee_701/
  2. $cd sandbox
  3. $cp vender/asus/eee_701/kernel.config kernel/.config
  4. $cd kernel
  5. $make menuconfig select the Virtualization option and de-select it then exit, choose "Yes" when you are asked whether to save a new configuration. (Select/de-select the Virtualization option is just used to trigger some menuconfig operations.)
  6. $make bzImage
  7. you can find your kernel image from arch/x86/boot directory
  8. $cp bzImage vendor/asus/eee_701/ and rename it to kernel
  9. rebuild your Android image.

How to build and install image for EeePC701

Building an installer image for a real EeePC is not more complicate than building an image for VB. The biggest issue is the framebuffer. The original porting done by Dima uses a modesetting inteldrmfb driver. Dima gave a link to download the source code for the driver. But the link does not work anymore. So people can not build their own kernel anymore. The modesetting inteldrmfb is released with 2.6.29 kernel, but at the time this note is written, the Android does not support 2.6.29 yet. Before Android moves to 2.6.29, we have two choices (Both tested by Luca and me):

  1. use VESA with very low resolution (640x480)
  2. use intelfb with little bit higher resolution (800x600)

I choose to use intelfb. In order to use either VESA or intelfb, we need to put vga=788 (800x600) or vga=785 (640x480) in the kernel command line.

(Luca) I am running on EeePc 701 with following cmdline parameters appended to default ones:

video=intelfb:640x480-16,accel vga=785

(Yi) I'am running on EeePC 1000HD with following cmdline parameters appended to default ones:

video=intelfb:800x600-32,vga=788

Until now, Intel 915 need userspace stuff to improve performances and resolution.

To do it, you need to do following changes:

project bootable/diskinstaller/
diff --git a/config.mk b/config.mk
index 2cb034d..3ed1759 100644
--- a/config.mk
+++ b/config.mk
@@ -119,6 +119,7 @@ internal_installerimage_args := \
 internal_installerimage_files := \
        $(filter-out --%,$(internal_installerimage_args))
 
+BOARD_KERNEL_CMDLINE := $(patsubst vga=788, ,$(BOARD_KERNEL_CMDLINE))
 BOARD_KERNEL_CMDLINE := $(strip $(BOARD_KERNEL_CMDLINE))
 ifdef BOARD_KERNEL_CMDLINE
   internal_installerimage_args += --cmdline "$(BOARD_KERNEL_CMDLINE)"

In vendor/asus/eee_701 directory do following changes

diff --git a/BoardConfig.mk b/BoardConfig.mk
index 54b0d4f..598a528 100644
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -25,7 +25,7 @@ TARGET_USE_DISKINSTALLER := true
 
 TARGET_DISK_LAYOUT_CONFIG := vendor/asus/eee_701/disk_layout.conf
 
-BOARD_KERNEL_CMDLINE := console=tty0 console=ttyS1,115200n8 console=tty0 androidboot.hardware=eee_701
+BOARD_KERNEL_CMDLINE := console=tty0 console=ttyS1,115200n8 console=tty0 androidboot.hardware=eee_701 vga=788
 
diff --git a/init.rc b/init.rc
index 00aa93c..3eeb758 100644
--- a/init.rc
+++ b/init.rc
@@ -91,8 +91,10 @@ loglevel 3
     insmod /lib/modules/cfbfillrect.ko
     insmod /lib/modules/cfbcopyarea.ko
     insmod /lib/modules/drm.ko
-    insmod /lib/modules/i915.ko modeset=1
+    insmod /lib/modules/i915.ko 
     insmod /lib/modules/fbcon.ko
+    insmod /lib/modules/i2c-algo-bit.ko
+    insmod /lib/modules/intelfb.ko

in AndroidBoard.mk find kernel_modules := \ and add i2c-algo-bit.ko and intelfb.ko

Now you can start to build installer.img:

  1. get the source code as mentioned in the "Getting Android source code for x86" section
  2. compile kernel by disable VESA framebuffer and enable follow features as module
  3. atl2.ko cfbcopyarea.ko cfbimgblt.ko font.ko i915.ko bitblit.ko cfbfillrect.ko drm.ko fbcon.ko i2c-algo-bit.ko intelfb.ko softcursor.ko
  4. copy these modules to vendor/asus/eee_701/modules directory
  5. build installer_img with following command
  6. TARGET_ARCH=x86 TARGET_PRODUCT=eee_701 DISABLE_DEXPREOPT=true make -j4 installer_img
  7. Plug usb driver to your pc
  8. cd out/target/product/eee_701
  9. dd if=./installer.img of=<your usb device node>
  10. use the usb driver to boot your eeePC and install Android on the target
Comment by pige...@gmail.com, May 25, 2009

On a 64bit host when rebuilding the kernel it's probably safer to set ARCH=x86 CROSS_COMPILE=i686-unknown-linux-gnu- and put prebuilt/linux-x86/toolchain/i686-unknown-linux-gnu-4.2.1/bin in your PATH before you do any make or make menuconfig.

Comment by AnsonDT...@gmail.com, Jun 2, 2009

Trying this out now - does not seem to work cleanly - has anyone else followed this set of instructions with a fresh synced repo? Some of the patches complain that Android.mk and AndroidBoard?.mk are going to be removed or are missing.

Comment by ad...@dadeb.it, Jun 7, 2009

same problem here, it's not working. Which patches should we use?

Comment by project member beyounn@gmail.com, Jun 9, 2009

Tell me what you are doing, I can look into this. I'm traveling now, So may not be able to response very fast.

Comment by adnot.ma...@gmail.com, Jun 10, 2009

Sorry for my bad english,

There are problems in webcore and especially when creating content of the out/target/product/eee_701/obj/SHARED_LIBRARIES/libwebcore_intermediates/WebCore?/css folder...

How can I fix this please ??? Has anyone got the same problem ?

Comment by project member beyounn@gmail.com, Jun 11, 2009

adnot and cs_chfac, this wiki page is about compile the Android for X86. Please send your question to android-porting group directly for help

Comment by scottpow...@gmail.com, Jun 14, 2009

Can anyone suggest a Windows port of 'DD' that actually works!?

Comment by protom...@gmail.com, Jun 17, 2009

What about if we host images, so people will not need to keep compiling all the Android stuff every single time? I have a host with lots of bandwitch and space, or also we can use torrent - I can host it too in this case.

Comment by sammych...@gmail.com, Jun 17, 2009

Do we need to apply all the patch, including the deprecated patches?

Comment by project member beyounn@gmail.com, Jun 23, 2009

No, you don't need to patch all the patches. See the note on the home page for the required package. About hosting of the images, we are continuously changing, if you are hosting an image, it will be out of date very soon. I have created a source tree that you can build and run Android on eeepc. Just check it out

Comment by bsibil...@comcast.net, Jun 29, 2009

Questions concerning the ".ko" modules. The eee_pc repo sync provides most of the new modules: (atl2.ko cfbcopyarea.ko cfbimgblt.ko font.ko i915.ko bitblit.ko cfbfillrect.ko drm.ko fbcon.ko softcursor.ko) however some are not provided. (i2c-algo-bit.ko and intelfb.ko) 1. Do all the modules need to be recompiled for the 2.27 kernel or can we use the one's provided and only create the missing modules? 2. Is there a reason why some where not provided? i.e. kernel specific? 3. If we recompile/recreate the drm modules do the drm patches need to be re-applied? ...or is it best just to use the pre-compiled supplied ".ko" modules.

Comment by project member beyounn@gmail.com, Jun 29, 2009

You should not use the modules from repo. You need to build your own modules. The modules come with the repo is a back port of modsetting driver for 2.6.25 kerenl.

Comment by cpdoh...@gmail.com, Jul 3, 2009

Which source tree should we be using? The one from git or the one from the Subversion repository at http://code.google.com/p/patch-hosting-for-android-x86-support/source/checkout ?

I have tried building the installer_img from the subversion source tree. The build succeeds; I am now trying to install on an eeePC 901. The install proceeds to the point where it tries to install to the hard drive, but then appears to hang at

2:0:0:0: sdc? Attached SCSI removable disk 2:0:0:0: Attached scsi generic sg2 type 0

If I hit enter at this point I get a # busybox prompt. I think that it's not seeing the SSD drives somehow. The front page says that people have got the installer to work on a 901. Does anyone have any tips to make the installer work?

Comment by project member beyounn@gmail.com, Jul 7, 2009

do this $ stop installer $ installer -p /dev/block/sdX2 where sdX is your usb stick.


Sign in to add a comment
Powered by Google Project Hosting