You are on page 1of 8

12/31/13

Get Source - Android-x86 - Porting Android to x86

Android-x86 - Porting Android to x86


Search News Download Donate Get Source Installation Screenshots Documentation App HowTo CustomizeKernel VirtualBoxHowTo QemuHowTo Sdcard HowTo UvesafbHowTo HowToConfigure HowToMakeCam HowToUsePrebu NFS How To Touch only device howto NDK HowTo Debug Howto Add new target How to wake up the machine How to make virtualbox ICH AC97 audio to work with android eclair-x86 How to boot the Android-x86 LiveCD when you have problems with your graphiccard Supported List Releases ReleaseNote 4.0-r1 ReleaseNote 4.0RC2 ReleaseNote 4.0RC1 ReleaseNote 3.2 RC2 ReleaseNote 2.2-r2 ReleaseNote 2.2 ReleaseNote 1.6-r2 ReleaseNote 1.6 Build 20130725 Build 20130228 Build 20120101 Build 20110828 Build 20110101 Build 20100812 Build 20100115 Build 20091113
by Chih-Wei Huang (cwhuang) 2009/07/10-2011/12/25

Get Source

Introduction
This page has (hopefully) the latest information about how to build Android for x86 platforms like Eee PC. The built images runs well on a real hardware as well as virtual machines (qemu or virtual box). Now it is very easy to compile Android for x86 platform from our git repositories. You need not to apply any patch. Just follow the below instructions.

Contents 1 Introduction 2 The branches in Android-x86 tree 3 Getting Android-x86 source code 4 Building the image 4.1 Choose a target 4.2 Building directly 4.3 Using buildspec.mk 4.4 Using lunch command 4.5 Build smaller image 5 Testing 6 Advanced 6.1 Install to USB disk 6.2 Install to hard disk 6.3 Save data to USB/hard disk 6.4 How to solve conflicts 6.5 Customize kernel

The branches in Android-x86 tree


Since AOSP evolves very quickly, we have created different branches corresponding to different releases of AOSP: kitkat-x86 Based on Android 4.4 release (KitKat). jb-x86 Based on Android 4.3 release (Jelly Bean). ics-x86 Based on Android 4.0 release (Ice Cream Sandwich). honeycomb-x86 Based on Android 3.2 release (Honeycomb). gingerbread-x86 Based on Android 2.3 release (Gingerbread). froyo-x86 Based on Android 2.2 release (Froyo). eclair-x86 Based on Android 2.1 release (Eclair). donut-x86 Based on Android 1.6 release (Donut). android-x86-v0.9 (obsolete) Based on Android 1.5 release (Cupcake).

Getting Android-x86 source code


First, follow this page to configure your build environment. Then
$m k d i ra n d r o i d x 8 6 $c da n d r o i d x 8 6 $r e p oi n i tuh t t p : / / g i t . a n d r o i d x 8 6 . o r g / m a n i f e s tb$ b r a n c h $r e p os y n c

www.android-x86.org/getsourcecode

1/8

12/31/13
Build 20091024 Build 20090916 Build 20090820 ReleaseNote v0.9 Contact Us Resources Sitemap Recent site activity

Get Source - Android-x86 - Porting Android to x86

Where $branch is any branch name described in the previous section. This will point the projects created or modified by android-x86 to our git server. All the other projects still point to AOSP. We also have a git mirror server on SourceForge.net. To use it, you only need to change the repo init command to $ repo init -u git://android-x86.git.sf.net/gitroot/android-x86/x86/platform/manifest.git -b $branch Note: the SourceForge manifest points all projects to the SourceForge.net mirror. (no matter modified by android-x86 or not). You can also find some more info about sync from SourceForge in http://www.android-dev.ro/2011/09/27/building-android-x86-from-sourceforgeand-repo-tool-is-now-on-code-google-com/ If you hope to keep syncing your tree with Android-x86 repository, just do r e p os y n c . No need to do r e p oi n i tagain. However, sometimes you may see conflicts during r e p os y n c . See the below section for how to solve this situation. Note: The Android-x86 repository is very big (about > 10GB). If you encounter problems of sync it, it's likely a network problem or our server is too busy. Repeatedly run 'r e p os y n c ' until it succeeds without any error. Do not bother us with any of the syncing problem. For users from US or Europe, we suggest to use the SourceForge mirror.

Links
Nightly build server Google code project SourceForge project Browse the source Discussion group Issues tracker Blog cwhuang Blog BuilDroid Blog sceners Blog beyounn Blog android-x86 Twitter android_x86 RSS for main page

Developers
Google apps Google sites Google mails Google docs Google calendar Google analytics

Building the image


Once the repo sync is complete, you can build either a usb image or a cdrom iso image. Note the original AOSP only support java 1.5 before Froyo, but we have patched the build system to support java 1.6. So you can use either java 1.5 or 1.6 to compile the code. Note: Before froyo-x86 (included), you can build on either a 32-bit or 64-bit host. Since gingerbread-x86, a 64-bit build environment is recommended.

Choose a target
You need to choose a target for the x86 device you want to use/test. We provides several targets for different branches: donut-x86
e e e p c : for ASUS EeePC q 1 u : for Samsung Q1U s 5 : for Viliv S5

family

eclair-x86
g e n e r i c _ x 8 6 : for generic e e e p c : for ASUS EeePC q 1 u : for Samsung Q1U s 5 : for Viliv S5

x86 PC/notebook family only

froyo-x86 / gingerbread-x86 g e n e r i c _ x 8 6 : for generic x86 PC/notebook e e e p c : for ASUS EeePC family only a s u s _ l a p t o p : for some ASUS laptops t e g a v 2 : for Tegatech Tegav2 (may work with other Atom N45x based tablets) s p a r t a : for Dell Inspiron Mini Duo platform v m : for virtual machine (virtual box, qemu, vmware) m o t i o n _ m 1 4 0 0 : for Motion M1400 (Intel Centrino M based with Intel PRO/Wireless) honeycomb-x86 / ics-x86 g e n e r i c _ x 8 6 : for generic x86 PC/notebook
www.android-x86.org/getsourcecode 2/8

12/31/13
a m d _ b r a z o s : for AMD Brazos platform e e e p c : for ASUS EeePC family only a s u s _ l a p t o p : for some ASUS laptops t e g a v 2 : for Tegatech Tegav2 (may work

Get Source - Android-x86 - Porting Android to x86

with other Atom N45x based tablets)

jb-x86 / kitkat-x86
a n d r o i d _ x 8 6 : for x86

platform

Actually, for historical reason, you have to use e e e p cfor a generic x86 PC, notebook or netbook before (includes) donut-x86 branch. Since eclairx86 branch, e e e p cis changed to serve ASUS EeePC family only. Do not use it if you are not using an EeePC. In short, if you don't know how to choose, use e e e p cfor donut-x86 branch, and use g e n e r i c _ x 8 6for eclair-x86 to ics-x86 branches. But note g e n e r i c _ x 8 6is just a base for other targets. It doesn't have some advanced features like hardware acceleration. Since jb-x86 we tried to use a n d r o i d _ x 8 6as a universal target for all x86 devices. However, it may not optimized for a particular target device. If you are a developer, you can create a target based on android_x86 for your device. If you want to add new target for your x86 device, refer to the article.

Building directly
To build a live cdrom iso image for target a n d r o i d _ x 8 6 , type:
$m a k ei s o _ i m gT A R G E T _ P R O D U C T = a n d r o i d _ x 8 6

To generate a live cdrom iso for t e g a v 2 , type


$m a k ei s o _ i m gT A R G E T _ P R O D U C T = t e g a v 2

Then you will get an iso file o u t / t a r g e t / p r o d u c t / x 8 6 / a n d r o i d _ x 8 6 . i s o , etc. If the computer you build on has more then one processor or core, you can take advantage of multiprocessing (or make jobs) by adding -jX to the beginning of your make command:
$m a k ej Xi s o _ i m gT A R G E T _ P R O D U C T = a n d r o i d _ x 8 6

Replace X by the number of processors you have. For example, if you have a quad core CPU, replace X with 4:
$m a k ej 4i s o _ i m gT A R G E T _ P R O D U C T = a n d r o i d _ x 8 6

Using buildspec.mk
You can create a b u i l d s p e c . m kin your android-x86 directory to remember a particular target product you build often:
T A R G E T _ P R O D U C T : = a n d r o i d _ x 8 6 T A R G E T _ B U I L D _ V A R I A N T : = u s e r d e b u g T A R G E T _ B U I L D _ T Y P E : = r e l e a s e T A R G E T _ K E R N E L _ C O N F I G : = a n d r o i d x 8 6 _ d e f c o n f i g

With your b u i l d s p e c . m kfile in your android-x86 directory, you can just make by
$m a k ej Xi s o _ i m g

www.android-x86.org/getsourcecode

3/8

12/31/13

Get Source - Android-x86 - Porting Android to x86

Using lunch command


You can source the file b u i l d / e n v s e t u p . s hinto your bash environment to get some shell functions to help the building:
$.b u i l d / e n v s e t u p . s h

Now you can select a target by l u n c hcommand:


$l u n c h$ T A R G E T _ P R O D U C T $ T A R G E T _ B U I L D _ V A R I A N T

where $TARGET_PRODUCT is any target described in the previous section, and possible values of $TARGET_BUILD_VARIANT are e n g , u s e r ,u s e r d e b u g . For example,
$l u n c ha n d r o i d _ x 8 6 e n g

Then you can build by mcommand:


$mj Xi s o _ i m g mcommand

is equivalent to make, but you can use it in any subdirectory of the android-x86 tree.

Since froyo-x86, we also add menu selection to l u n c hcommand. Just type l u n c h , and you will get a list of available targets. Choose a target by inputting its number. Alternatively, just type l u n c h$number.

Build smaller image


If you have squashfs-tools 4.0 (older version will not work) installed in your host, the generated Android core filesystem will be compressed by squashfs. So the iso file is very small (only about 30-40%). If you hope to disable it, add U S E _ S Q U A S H F S = 0to make. You can put it to buildspec.mk:
U S E _ S Q U A S H F S: =0

Before froyo-x86 (included), If you hope to get a more smaller image, you may remove the debugging symbols by adding
T A R G E T _ S T R I P: =1

Since gingerbread-x86, the debugging symbols are stripped by default. Do not use this option anymore.

Testing
The generated image is located at out/target/product/$TARGET_PRODUCT/$TARGET_PRODUCT.iso You can easily test the iso file by a virtual box or qemu. On the booting screen, select the VESA or debug mode to boot. Of course you can burn the iso to a CD disk and test it on a real hardware. On booting it will automatically detect your hardware and load necessary modules. If you have problem with the default frame buffer driver, you may try the VESA mode (select second item on boot screen).

www.android-x86.org/getsourcecode

4/8

12/31/13

Get Source - Android-x86 - Porting Android to x86

Since honeycomb-x86, we supports the hybrid iso format. That is, the iso could be dumped to a usb disk directly. You may create a bootable USB disk by
$d di f = o u t / t a r g e t / p r o d u c t / x 8 6 / a n d r o i d _ x 8 6 . i s oo f = / d e v / s d X

where / d e v / s d Xis the device name of your USB disk. This feature is only available for iso files released after 2011/12/25. Note usb_img is deprecated. Do not use it anymore. Some broken BIOS (e.g., Acer AO) is unable to boot a USB disk created in this way. If so, you may try to create bootable USB drive from the iso file by unetbootin. For both linux and windows user, here are the steps (suggested by Gregory Gee ) :

1 .D o w n l o a dt h eI S Oi m a g eo fa n d r o i d x 8 6 . 2 .D o w n l o a dU N e t b o o t i nf r o mh t t p : / / u n e t b o o t i n . s o u r c e f o r g e . n e t / 3 .M a k es u r ey o uU S Bk e yi sf o r m a t t e d . U N e t b o o t i ns i l e n t l yf a i l st ow o r ki fn o tf o r m a t e d . If o r m a t t e dm yU S Bk e y f a t 3 2 . 4 .R u nU N e t b o o t i n S e l e c ty o u rU S Bk e ya st h eD r i v e . S e l e c tt h ea n d r o i d x 8 6I S Of i l ea st h ed i s ki m a g e . C l i c ko ka n dw a i t . I ts h o u l dt a k eam i n u t et od o . I fi to n l yt o o kU N e t b o o t i naf e ws e c o n d st oc o p yt oU S B ,l i k em yf i r s ta t t e m p t ,t h e n i td i d n ' tw o r k . S or e m e m b e ro nf u t u r eu p g r a d e st or e f o r m a ty o u rU S Bk e yb e f o r ee a c ha n d r o i di n s t a l l . S on o wy o us h o u l db ea b l et ob o o tf r o mt h eU S Bk e y . W e l l ,a tl e a s ti tw o r k e df o rm e . T h eU N e t b o o t i ni sa n i n t e r e s t i n gt o o lt o o .

Another choice is the Linux Live USB Creator ( LiLi ) project, which officially support Android-x86.

Advanced
This section describes some useful information for advanced users. You may need good linux expertise to complete it.

Install to USB disk


For advanced linux users, you may create a bootable USB disk by hand. Here are the steps: 1. Install grub to your USB disk find a linux machine with the latest grub installed partition your USB drive with fdisk or gpartd and mark the partition as bootable format that partition to ext3 (recommended) or vfat. mount your usb drive to /mnt cd /mnt grub-install --root-directory=. --no-floppy /dev/<your usb device node name> cd /boot/grub create your menu.lst based on the next section 2. Add this section to menu.lst
t i t l eR u nA n d r o i d k e r n e l/ a n d r o i d / k e r n e lr o o t = / d e v / r a m 0a n d r o i d b o o t . h a r d w a r e = a n d r o i d _ x 8 6 a c p i _ s l e e p = s 3 _ b i o s , s 3 _ m o d eS R C = / a n d r o i d i n i t r d/ a n d r o i d / i n i t r d . i m g t i t l eR u nA n d r o i d( V E S Am o d e ) k e r n e l/ a n d r o i d / k e r n e lr o o t = / d e v / r a m 0a n d r o i d b o o t . h a r d w a r e = a n d r o i d _ x 8 6 a c p i _ s l e e p = s 3 _ b i o s , s 3 _ m o d ev g a = 7 8 8S R C = / a n d r o i d i n i t r d/ a n d r o i d / i n i t r d . i m g t i t l eR u nA n d r o i d( D e b u gm o d e )

www.android-x86.org/getsourcecode

5/8

12/31/13

Get Source - Android-x86 - Porting Android to x86


k e r n e l/ a n d r o i d / k e r n e lr o o t = / d e v / r a m 0a n d r o i d b o o t . h a r d w a r e = a n d r o i d _ x 8 6 a c p i _ s l e e p = s 3 _ b i o s , s 3 _ m o d ev g a = 7 8 8S R C = / a n d r o i dD E B U G = 1 i n i t r d/ a n d r o i d / i n i t r d . i m g

3. Create / a n d r o i ddirectory in the USB disk, and copy the four files k e r n e li n i t r d . i m gr a m d i s k . i m gs y s t e m . s f s(or s y s t e m . i m gif you set U S E _ S Q U A S H F S = 0 ) to it. Then you can boot from the USB disk and enjoy Android. Note all data are saved to the ramdisk, so all will lose after power off. If you hope to save data to disk, see the next section.

Install to hard disk


Install to a hard disk is just the same as install to a USB disk. Even you do not need to create a new partition. Just copy android files into an existing partition, install grub to the hard disk (if not done yet), and modify the m e n u . l s t . People still ask, what if my hard disk is empty? How to install grub and copy files into it? There are several ways to do it. I provide two here: Boot from any rescue cd like systemrescuecd, and follow the instructions in the previous section. Install your favorite linux distribution, then copy android files and modify the grub menu.

Save data to USB/hard disk


We support two ways to save data to your disk. Create a subdirectory named d a t ain your / a n d r o i ddirectory. The user data will be directly saved to that directory. This method only works for ext3 partition. Create a separate partition and save data to it. You have to add D A T A = < d e v i c e _ n a m e >to the boot option. For example, suppose your data partition is / d e v / s d a 2 , then add D A T A = s d a 2to the boot option.

How to solve conflicts


There are several reason to have conflicts during r e p os y n c , say You modify your tree locally. The upstream changed. Since we usually keep syncing with original Android repository, sometimes we have to rebase with it. That changes the history and may cause conflicts. In this section we assume you have conflicts due to the upstream changed. That is, you don't have local modifications. If you do, you have to solve conflicts yourself. If you follow the procedures in this section, you may lose your local modifications. Here is an example of a conflict in the manifest:
$r e p os y n c r e m o t e :C o u n t i n go b j e c t s :7 1 ,d o n e . r e m o t e :C o m p r e s s i n go b j e c t s :1 0 0 %( 4 1 / 4 1 ) ,d o n e . r e m o t e :T o t a l6 5( d e l t a2 5 ) ,r e u s e d2 8( d e l t a9 ) U n p a c k i n go b j e c t s :1 0 0 %( 6 5 / 6 5 ) ,d o n e . F r o mg i t : / / g i t . t a r o t . c o m . t w / a n d r o i d x 8 6 / p l a t f o r m / m a n i f e s t d 5 3 e 6 c 1 . . 2 d e 7 a 1 1 a n d r o i d 1 . 5 r 2>o r i g i n / a n d r o i d 1 . 5 r 2 *[ n e wb r a n c h ] a n d r o i d 1 . 5 r 3>o r i g i n / a n d r o i d 1 . 5 r 3 *[ n e wb r a n c h ] a n d r o i d s d k 1 . 5 _ r 3>o r i g i n / a n d r o i d s d k 1 . 5 _ r 3 d 5 3 e 6 c 1 . . c 5 4 4 0 2 0 c u p c a k e >o r i g i n / c u p c a k e *[ n e wb r a n c h ] c u p c a k e r e l e a s e>o r i g i n / c u p c a k e r e l e a s e f 4 d 7 9 b 1 . . 6 f 7 e 0 d d d o n u t >o r i g i n / d o n u t +7 3 0 8 d 3 1 . . . 4 a 4 f 9 3 6l a n >o r i g i n / l a n ( f o r c e du p d a t e ) +b 4 8 0 a 6 d . . . d 8 2 4 9 6 el o c a l >o r i g i n / l o c a l ( f o r c e du p d a t e )

www.android-x86.org/getsourcecode

6/8

12/31/13

Get Source - Android-x86 - Porting Android to x86


+1 1 c 9 d 9 6 . . . 8 4 3 4 5 f bm a s t e r >o r i g i n / m a s t e r ( f o r c e du p d a t e ) +5 b c b f 9 3 . . . 6 6 e 9 2 c cm i r r o r >o r i g i n / m i r r o r ( f o r c e du p d a t e ) +9 f 3 0 9 2 f . . . 6 6 5 f 9 e 8s s h >o r i g i n / s s h ( f o r c e du p d a t e ) +c 6 0 3 7 b e . . . d 7 0 9 2 7 fs s h m i r r o r>o r i g i n / s s h m i r r o r ( f o r c e du p d a t e ) +0 0 a 8 2 3 f . . . 3 d d a f 6 6t e s t >o r i g i n / t e s t ( f o r c e du p d a t e ) *[ n e wt a g ] a n d r o i d 1 . 5 r 3>a n d r o i d 1 . 5 r 3 *[ n e wt a g ] a n d r o i d s d k 1 . 5 _ r 3>a n d r o i d s d k 1 . 5 _ r 3 F e t c h i n gp r o j e c t s :1 0 0 %( 1 2 8 / 1 2 8 ) ,d o n e . p r o j e c t. r e p o / m a n i f e s t s / F i r s t ,r e w i n d i n gh e a dt or e p l a yy o u rw o r ko nt o po fi t . . . A p p l y i n g :m e r g ed o n u t ,c h a n g eo ra d dt h ep r o j e c t st ox 8 6p o r t e r r o r :p a t c hf a i l e d :d e f a u l t . x m l : 3 e r r o r :d e f a u l t . x m l :p a t c hd o e sn o ta p p l y U s i n gi n d e xi n f ot or e c o n s t r u c tab a s et r e e . . . F a l l i n gb a c kt op a t c h i n gb a s ea n d3 w a ym e r g e . . . A u t o m e r g i n gd e f a u l t . x m l C O N F L I C T( c o n t e n t ) :M e r g ec o n f l i c ti nd e f a u l t . x m l F a i l e dt om e r g ei nt h ec h a n g e s . P a t c hf a i l e da t0 0 0 1m e r g ed o n u t ,c h a n g eo ra d dt h ep r o j e c t st ox 8 6p o r t W h e ny o uh a v er e s o l v e dt h i sp r o b l e mr u n" g i tr e b a s ec o n t i n u e " . I fy o uw o u l dp r e f e rt os k i pt h i sp a t c h ,i n s t e a dr u n" g i tr e b a s es k i p " . T or e s t o r et h eo r i g i n a lb r a n c ha n ds t o pr e b a s i n gr u n" g i tr e b a s ea b o r t " .

r e p os y n cstopped

on conflicts. Since we don't have local modifications, just ignore it by g i tr e b a s es k i p :

$c d. r e p o / m a n i f e s t s $g i tr e b a s es k i p H E A Di sn o wa t4 a 4 f 9 3 6a d db r a n c hf o rl o c a ll a n A p p l y i n g :a d dp l a t f o r m / f r a m e w o r k s / p o l i c i e s / b a s et ox 8 6 e r r o r :p a t c hf a i l e d :d e f a u l t . x m l : 1 8 e r r o r :d e f a u l t . x m l :p a t c hd o e sn o ta p p l y U s i n gi n d e xi n f ot or e c o n s t r u c tab a s et r e e . . . F a l l i n gb a c kt op a t c h i n gb a s ea n d3 w a ym e r g e . . . A u t o m e r g i n gd e f a u l t . x m l N oc h a n g e s-P a t c ha l r e a d ya p p l i e d . A p p l y i n g :a d db r a n c hf o rl o c a ll a n e r r o r :p a t c hf a i l e d :d e f a u l t . x m l : 1 e r r o r :d e f a u l t . x m l :p a t c hd o e sn o ta p p l y U s i n gi n d e xi n f ot or e c o n s t r u c tab a s et r e e . . . F a l l i n gb a c kt op a t c h i n gb a s ea n d3 w a ym e r g e . . . A u t o m e r g i n gd e f a u l t . x m l N oc h a n g e s-P a t c ha l r e a d ya p p l i e d .

If it complains about another conflict, do g i tr e b a s es k i pagain, until the rebase procedure completes. Usually it is enough, but if you hope to be absolute clean, you can ignore this branch and checkout a new one:
$g i tc h e c k o u ttk i t k a t x 8 6m / k i t k a t x 8 6

This may not be the best approach to solve conflicts, but should be easy enough for beginners. If you have better suggestions, just tell us.

Customize kernel
If you'd like to customize the kernel for your hardware, read this article for details.

Comments
www.android-x86.org/getsourcecode 7/8

12/31/13
You do not have permission to add comments.

Get Source - Android-x86 - Porting Android to x86

Sign in | Report Abuse | Print Page | Remove Access | Powered By Google Sites

www.android-x86.org/getsourcecode

8/8

You might also like