OS: Android - x86: Difference between revisions

From OnnoCenterWiki
Jump to navigationJump to search
Onnowpurbo (talk | contribs)
New page: Sumber: http://www.android-x86.org/getsourcecode Introduction This page has (hopefully) the latest information about how to build Android for x86 platforms like Eee PC. The built images...
 
Onnowpurbo (talk | contribs)
 
(16 intermediate revisions by the same user not shown)
Line 2: Line 2:




Introduction
Informasi ini semoga dapat memberikan informasi terkini tentang bagaimana cara membuat Android untuk x86 seperti EeePC.
Image yang dihasilkan berjalan dengan baik di hardware sebenarnya maupun di mesin virtual (qemu atau virtual box)


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).
Sangat mudah sekali untuk mengcompile Android untuk platform x86 dari repository git android-x86.
Kita tidak perlu melakukan patch. Hanya perlu mengikuti instruksi di bawah ini.


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.
==Cabang di Android-x86 tree==
The branches in Android-x86 tree


Since AOSP evolves very quickly, we have created different branches corresponding to different releases of AOSP:
Karena AOSP berkembang sangat cepat, ada beberapa cabang yang dibuat tergantung release AOSP.


    kitkat-x86
* kitkat-x86 - Based Android 4.4 release (KitKat).
    Based on Android 4.4 release (KitKat).
* jb-x86 - Based Android 4.3 release (Jelly Bean).
    jb-x86
* ics-x86 - Based Android 4.0 release (Ice Cream Sandwich).
    Based on Android 4.3 release (Jelly Bean).
* honeycomb-x86 - Based Android 3.2 release (Honeycomb).
    ics-x86
* gingerbread-x86 - Based Android 2.3 release (Gingerbread).
    Based on Android 4.0 release (Ice Cream Sandwich).
* froyo-x86 - Based Android 2.2 release (Froyo).
    honeycomb-x86
* eclair-x86 - Based Android 2.1 release (Eclair).
    Based on Android 3.2 release (Honeycomb).
* donut-x86 - Based Android 1.6 release (Donut).
    gingerbread-x86
* android-x86-v0.9 (obsolete) - Based on Android 1.5 release (Cupcake).
    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
==Memperoleh source code Android-x86==


First, follow this page to configure your build environment. Then
Inisialisasi sistem operasi agar siap untuk mengcompile android sesuai dengan


$ mkdir android-x86
http://source.android.com/source/initializing.html
$ cd android-x86
$ repo init -u http://git.android-x86.org/manifest -b $branch
$ repo sync


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.
Antara lain kita perlu


We also have a git mirror server on SourceForge.net. To use it, you only need to change the repo init command to
sudo apt-get update
$ repo init -u git://android-x86.git.sf.net/gitroot/android-x86/x86/platform/manifest.git -b $branch
sudo apt-get install openjdk-7-jdk


Note: the SourceForge manifest points all projects to the SourceForge.net mirror. (no matter modified by android-x86 or not).
sudo apt-get install git gnupg flex bison gperf build-essential \
  zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
  libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
  libgl1-mesa-dev g++-multilib mingw32 tofrodos \
  python-markdown libxml2-utils xsltproc zlib1g-dev:i386
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so


You can also find some more info about sync from SourceForge in http://www.android-dev.ro/2011/09/27/building-android-x86-from-sourceforge-and-repo-tool-is-now-on-code-google-com/
Setelah lingkungan di siapkan, kita dapat melakukan


If you hope to keep syncing your tree with Android-x86 repository, just do repo sync. No need to do repo init again. However, sometimes you may see conflicts during repo sync. See the below section for how to solve this situation.
mkdir android-x86
cd android-x86
repo init -u http://git.android-x86.org/manifest -b $branch
repo sync


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 'repo sync' 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.
Dimana $branch adalah nama cabang seperti di jelaskan di bagian sebelumnya, misalnya,
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.
mkdir android-x86
cd android-x86
repo init -u http://git.android-x86.org/manifest -b kitkat-x86
repo sync


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.
Proses ini akan menunjuk project yang dibuat atau di modifikasi oleh android-x86 ke git server dari android-x86.
Choose a target
Sementara project lainnya tetap ke AOSP.
You need to choose a target for the x86 device you want to use/test. We provides several targets for different branches:


    donut-x86
Android-x86 juga memiliki git mirror server di SourceForge.net.
        eeepc: for ASUS EeePC family
Untuk menggunakannya kita perlu mengubah perintah repo init menjadi
        q1u: for Samsung Q1U
        s5: for Viliv S5
    eclair-x86
        generic_x86: for generic x86 PC/notebook
        eeepc: for ASUS EeePC family only
        q1u: for Samsung Q1U
        s5: for Viliv S5
    froyo-x86 / gingerbread-x86
        generic_x86: for generic x86 PC/notebook
        eeepc: for ASUS EeePC family only
        asus_laptop: for some ASUS laptops
        tegav2: for Tegatech Tegav2 (may work with other Atom N45x based tablets)
        sparta: for Dell Inspiron Mini Duo platform
        vm: for virtual machine (virtual box, qemu, vmware)
        motion_m1400: for Motion M1400 (Intel Centrino M based with Intel PRO/Wireless)
    honeycomb-x86 / ics-x86
        generic_x86: for generic x86 PC/notebook
        amd_brazos: for AMD Brazos platform
        eeepc: for ASUS EeePC family only
        asus_laptop: for some ASUS laptops
        tegav2: for Tegatech Tegav2 (may work with other Atom N45x based tablets)
    jb-x86 / kitkat-x86
        android_x86: for x86 platform


Actually, for historical reason, you have to use eeepc for a generic x86 PC, notebook or netbook before (includes) donut-x86 branch. Since eclair-x86 branch, eeepc is changed to serve ASUS EeePC family only. Do not use it if you are not using an EeePC.
$ repo init -u git://android-x86.git.sf.net/gitroot/android-x86/x86/platform/manifest.git -b $branch


In short, if you don't know how to choose, use eeepc for donut-x86 branch, and use generic_x86 for eclair-x86 to ics-x86 branches. But note generic_x86 is just a base for other targets. It doesn't have some advanced features like hardware acceleration.
Contoh:


Since jb-x86 we tried to use android_x86 as 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.
$ repo init -u git://android-x86.git.sf.net/gitroot/android-x86/x86/platform/manifest.git -b kitkat-x86


If you want to add new target for your x86 device, refer to the article.
atau
Building directly


To build a live cdrom iso image for target android_x86, type:
$ repo init -u git://android-x86.git.sf.net/gitroot/android-x86/x86/platform/manifest.git -b jb-x86
$ make iso_img TARGET_PRODUCT=android_x86


To generate a live cdrom iso for tegav2, type
Catatan: SourceForge akan mengacu semua proyek ke mirror SourceForge.net (tidak peduli apakah itu diubah oleh android-x86 atau bukan).
$ make iso_img TARGET_PRODUCT=tegav2


Then you will get an iso file out/target/product/x86/android_x86.iso, etc.
Kita juga dapat memperoleh beberapa informasi tambahan tentang sync dengan SourceForge di


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:
http://www.android-dev.ro/2011/09/27/building-android-x86-from-sourceforge-and-repo-tool-is-now-on-code-google-com/
$ make -jX iso_img TARGET_PRODUCT=android_x86


Replace X by the number of processors you have. For example, if you have a quad core CPU, replace X with 4:
Jika kita berharap untuk bisa tetap sync dengan repository Android-x86, lakukan repo sync. Tidak perlu mengulang repo init.
$ make -j4 iso_img TARGET_PRODUCT=android_x86
Akan tetapi, kadang kala kita akan melihat konflik saat repo sync. Lihat catatan berikut untuk mengatasi konflik.
Using buildspec.mk


You can create a buildspec.mk in your android-x86 directory to remember a particular target product you build often:
Catatan: repository Android-x86 sangat besar (> 10GB). Jika kita memperoleh masalah saat melakukan sync, kemungkinan karena masalah jaringan
TARGET_PRODUCT:=android_x86
atau server terlalu sibuk. Lakukan berulang-ulang 'repo sync' sampai sukses tanpa error.
TARGET_BUILD_VARIANT:=userdebug
TARGET_BUILD_TYPE:=release
TARGET_KERNEL_CONFIG:=android-x86_defconfig


With your buildspec.mk file in your android-x86 directory, you can just make by
==Membuat Image==
$ make -jX iso_img
Using lunch command


You can source the file build/envsetup.sh into your bash environment to get some shell functions to help the building:
Setelah repo sync selesai, kita dapat membuat usb image atau cdrom iso image.
$ . build/envsetup.sh
Perlu di catat bahwa AOSP original hanya mendukung java 1.5 sebelum Froyo,
oleh tim Android-x86 sudah di patch untuk mendukung java 1.6.
Oleh karenanya kita dapat menggunakan java 1.5 atau 1.6 untuk mengcompile source code.


Now you can select a target by lunch command:
Catatan: Sebelum froyo-x86 (termasuk), kita dapat membuat 32-bit atau 64-bit host. Sejak gingerbread-x86, lingkungan untuk build 64-bit lebih di sukai.
$ lunch $TARGET_PRODUCT-$TARGET_BUILD_VARIANT


where $TARGET_PRODUCT is any target described in the previous section, and possible values of $TARGET_BUILD_VARIANT are eng, user, userdebug. For example,
==Memilih Target==
$ lunch android_x86-eng


Then you can build by m command:
Kita perlu memilih target untuk x86 device yang akan kita gunakan / test.
$ m -jX iso_img
Berikut adalah beberapa target untuk branch yang berbeda,


m command is equivalent to make, but you can use it in any subdirectory of the android-x86 tree.
donut-x86
    eeepc: for ASUS EeePC family
    q1u: for Samsung Q1U
    s5: for Viliv S5
eclair-x86
    generic_x86: for generic x86 PC/notebook
    eeepc: for ASUS EeePC family only
    q1u: for Samsung Q1U
    s5: for Viliv S5
froyo-x86 / gingerbread-x86
    generic_x86: for generic x86 PC/notebook
    eeepc: for ASUS EeePC family only
    asus_laptop: for some ASUS laptops
    tegav2: for Tegatech Tegav2 (may work with other Atom N45x based tablets)
    sparta: for Dell Inspiron Mini Duo platform
    vm: for virtual machine (virtual box, qemu, vmware)
    motion_m1400: for Motion M1400 (Intel Centrino M based with Intel PRO/Wireless)
honeycomb-x86 / ics-x86
    generic_x86: for generic x86 PC/notebook
    amd_brazos: for AMD Brazos platform
    eeepc: for ASUS EeePC family only
    asus_laptop: for some ASUS laptops
    tegav2: for Tegatech Tegav2 (may work with other Atom N45x based tablets)
jb-x86 / kitkat-x86
    android_x86: for x86 platform


Since froyo-x86, we also add menu selection to lunch command. Just type lunch, and you will get a list of available targets. Choose a target by inputting its number. Alternatively, just type lunch $number.
Sebetulnya, karena alasan historikal, kita harus menggunakan eeepc untuk PC x86, notebook atau notebook sebelum (termasuk) branch donut-x86.
Build smaller image
Sejak branch eclair-x86, eeepc di ubah hanya untuk keluarga ASUS EeePC saja. Jangan gunakan itu, jika kita tidak menggunakan EeePC.


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 USE_SQUASHFS=0 to make. You can put it to buildspec.mk:
Singkatnya, jika kita tidak tahu apa yang harus kita pilih, gunakan eeepc untuk branch donut-x86,
USE_SQUASHFS := 0
dan gunakan generic_x86 untuk branch eclair-x86 sampai dengan ics-x86.
Tapi perlu di catat bahwa generic_x86 adalah dasar dari berbagai target yang ada.
Target generic-x86 tidak memiliki fitur yang advance seperti hardware acceleration.


Before froyo-x86 (included), If you hope to get a more smaller image, you may remove the debugging symbols by adding
Sejak jb-x86 Android-x86 berusaha untuk menggunakan android_x86 sebagai target universal bagi semua x86 device.
TARGET_STRIP := 1
Akan tetapi, android_x86 tidak mungkin di optimasi untuk device tertentu.
Jika kita seorang developer, kita dapat membuat sebuah target berdasarkan android_x86 untuk device yang kita inginkan.


Since gingerbread-x86, the debugging symbols are stripped by default. Do not use this option anymore.
Jika kita ingin menambahkan target yang baru untuk device x86, ada baiknya membaca tulisan berikut,
Testing


The generated image is located at
http://www.android-x86.org/documents/how-to-add-new-x86-platforms
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.
==Membuat Android-x86==


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).
Untuk membuat live cdrom iso image untuk target android_x86, tulis:


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
$ make iso_img TARGET_PRODUCT=android_x86
$ dd if=out/target/product/x86/android_x86.iso of=/dev/sdX
 
Untuk membuat live cdrom iso untuk target tegav2, tulis:
 
$ make iso_img TARGET_PRODUCT=tegav2
 
Kita akan memperoleh file iso di folder out/target/product/x86/android_x86.iso, dll.
 
Jika komputer yang kita gunakan untuk build mempunyai lebih dari satu core,
kita dapat memanfaatkan multicore dengan menambahkan -jX di awal perintah make, seperti
 
$ make -jX iso_img TARGET_PRODUCT=android_x86
 
Ganti X dengan jumlah core yang kita miliki. Misalnya, kita mempunyai CPU quad core, ganti X dengan 4:
 
$ make -j4 iso_img TARGET_PRODUCT=android_x86
 
==Menggunakan buildspec.mk==
 
Kita dapat membuat buildspec.mk di directory android-x86 untuk memudahkan target tertentu yang sering kita buat. Misalnya, isinya
 
TARGET_PRODUCT:=android_x86
TARGET_BUILD_VARIANT:=userdebug
TARGET_BUILD_TYPE:=release
TARGET_KERNEL_CONFIG:=android-x86_defconfig
 
Dengan adanya file buildspec.mk di directory android-x86, kita hanya perlu melakukan make dengan
 
$ make -jX iso_img
 
==Penggunaan perintah lunch==
 
Kita dapat men-source / menjalankan file build/envsetup.sh ke dalam lingkungan bash untuk memperoleh fungsi shell untuk menolong proses pembuatan:
 
$ . build/envsetup.sh
 
Selanjutnya, kita dapat memilih target menggunakan perintah lunch:
 
$ lunch $TARGET_PRODUCT-$TARGET_BUILD_VARIANT
 
dimana $TARGET_PRODUCT adalah target yang di jelaskan sebelumnya, nilai yang mungkin untuk  $TARGET_BUILD_VARIANT adalah eng, user, userdebug. Contoh,
 
$ lunch android_x86-eng
 
Selanjutnya, kita dapat membuat dengan perintah m
 
$ m -jX iso_img
 
perintah m kira-kira sama dengan make, tapi kita dapat menggunakannya di subdirectory manapun di bawah tree android-x86.
 
Sejak froyo-x86, juga di tambahkan menu pemilihan pada perintah lunch.
Cukup mengetik lunch, kita akan memperoleh daftar dari target yang tersedia.
Pilih target dengan memasukan nomor-nya. Alternatif lain, cukup menulis
 
lunch $number.
 
==Membuat Image yang lebih kecil==
 
Jika kita menggunakan / ada squashfs-tools 4.0 (versi yang sebelumnya tidak bisa), filesystem Android core akan di kompres oleh squashfs. Oleh karenanya file iso yang di hasilkan akan sangat kecil (sekitar 30-40%). Jika kita ingin tidak mengaktifkannya, tambahkan USE_SQUASHFS=0 di make. Kita juga dapat menambahkan di buildspec.mk:
 
USE_SQUASHFS := 0
 
Sebelum froyo-x86 (termasuk), Jika kita ingin membuat image yang lebih kecil lagi, kita dapat membuang berbagai simbol debugging dengan menambahkan
 
TARGET_STRIP := 1
 
Sejak gingerbread-x86, simbol debugging akan dibuang secara default. Jangan gunakan fitur ini.
 
==Testing==
 
Image Android-x86 yang dibuat berada di
 
out/target/product/$TARGET_PRODUCT/$TARGET_PRODUCT.iso
 
Kita dapat dengan mudah mencoba file iso tersebut dengan menggunakan virtualbox atau qemu.
Saat booting, pilih VESA atau debug mode.
 
Tentu saja, kita selalu dapat burn iso tersebut ke CD dan test ke hardware yang sebetulnya.
Saat booting, dia akan mendeteksi hardware secara automatis dan me-load module yang dibutuhkan.
Jika kita memperoleh masalah dengan frame buffer driver default-nya,
kita dapat mencoba VESA mode (pilihan nomor dua di boot screen).
 
Sejak honeycomb-x86, Android-x86 mendukung format iso hybrid.
Artinya, iso dapat di tuliskan ke usb flashdisk secara langsung.
Kita dapat membuat bootable USB disk dengan perintah
 
dd if=out/target/product/x86/android_x86.iso of=/dev/sdX


where /dev/sdX is 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.
where /dev/sdX is 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.
Line 159: Line 234:
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 ) :
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. Download the ISO image of android-x86.
1. Download the ISO image of android-x86.
2. Download UNetbootin from http://unetbootin.sourceforge.net/
2. Download UNetbootin from http://unetbootin.sourceforge.net/
3. Make sure you USB key is formatted.  UNetbootin silently fails to work if not formated.  I formatted my USB key fat32.
3. Make sure you USB key is formatted.  UNetbootin silently fails to work if not formated.  I formatted my USB key fat32.
4. Run UNetbootin
4. Run UNetbootin
        Select your USB key as the Drive.
        Select your USB key as the Drive.
        Select the android-x86 ISO file as the disk image.
        Select the android-x86 ISO file as the disk image.
        Click ok and wait.
        Click ok and wait.


It should take a minute to do.  If it only took UNetbootin a few seconds to copy to USB, like my first attempt, then it didn't work.  So remember on future upgrades to reformat your USB key before each android install.
It should take a minute to do.  If it only took UNetbootin a few seconds to copy to USB, like my first attempt, then it didn't work.  So remember on future upgrades to reformat your USB key before each android install.
Line 171: Line 246:


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


This section describes some useful information for advanced users. You may need good linux expertise to complete it.
This section describes some useful information for advanced users. You may need good linux expertise to complete it.
Install to USB disk
 
===Install to USB disk===


For advanced linux users, you may create a bootable USB disk by hand. Here are the steps:
For advanced linux users, you may create a bootable USB disk by hand. Here are the steps:
Line 204: Line 281:


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.
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 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 menu.lst.
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 menu.lst.
Line 211: Line 289:


     Boot from any rescue cd like systemrescuecd, and follow the instructions in the previous section.
     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.  
     Install your favorite linux distribution, then copy android files and modify the grub menu.


Save data to USB/hard disk
==Save data to USB/hard disk==


We support two ways to save data to your disk.
We support two ways to save data to your disk.


    Create a subdirectory named data in your /android directory. The user data will be directly saved to that directory. This method only works for ext3 partition.  
* Create a subdirectory named data in your /android directory. 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 DATA=<device_name> to the boot option. For example, suppose your data partition is /dev/sda2, then add DATA=sda2 to the boot option.  


    Create a separate partition and save data to it. You have to add DATA=<device_name> to the boot option. For example, suppose your data partition is /dev/sda2, then add DATA=sda2 to the boot option.
==How to solve conflicts==
 
How to solve conflicts


There are several reason to have conflicts during repo sync, say
There are several reason to have conflicts during repo sync, say


    You modify your tree locally.
* 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.  
* 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.
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.
Line 232: Line 309:
Here is an example of a conflict in the manifest:
Here is an example of a conflict in the manifest:


$ repo sync
$ repo sync
remote: Counting objects: 71, done.
remote: Counting objects: 71, done.
remote: Compressing objects: 100% (41/41), done.
remote: Compressing objects: 100% (41/41), done.
remote: Total 65 (delta 25), reused 28 (delta 9)
remote: Total 65 (delta 25), reused 28 (delta 9)
Unpacking objects: 100% (65/65), done.
Unpacking objects: 100% (65/65), done.
From git://git.tarot.com.tw/android-x86/platform/manifest
From git://git.tarot.com.tw/android-x86/platform/manifest
  d53e6c1..2de7a11  android-1.5r2 -> origin/android-1.5r2
    d53e6c1..2de7a11  android-1.5r2 -> origin/android-1.5r2
* [new branch]      android-1.5r3 -> origin/android-1.5r3
  * [new branch]      android-1.5r3 -> origin/android-1.5r3
* [new branch]      android-sdk-1.5_r3 -> origin/android-sdk-1.5_r3
  * [new branch]      android-sdk-1.5_r3 -> origin/android-sdk-1.5_r3
  d53e6c1..c544020  cupcake    -> origin/cupcake
    d53e6c1..c544020  cupcake    -> origin/cupcake
* [new branch]      cupcake-release -> origin/cupcake-release
  * [new branch]      cupcake-release -> origin/cupcake-release
  f4d79b1..6f7e0dd  donut      -> origin/donut
    f4d79b1..6f7e0dd  donut      -> origin/donut
+ 7308d31...4a4f936 lan        -> origin/lan  (forced update)
  + 7308d31...4a4f936 lan        -> origin/lan  (forced update)
+ b480a6d...d82496e local      -> origin/local  (forced update)
  + b480a6d...d82496e local      -> origin/local  (forced update)
+ 11c9d96...84345fb master    -> origin/master  (forced update)
  + 11c9d96...84345fb master    -> origin/master  (forced update)
+ 5bcbf93...66e92cc mirror    -> origin/mirror  (forced update)
  + 5bcbf93...66e92cc mirror    -> origin/mirror  (forced update)
+ 9f3092f...665f9e8 ssh        -> origin/ssh  (forced update)
  + 9f3092f...665f9e8 ssh        -> origin/ssh  (forced update)
+ c6037be...d70927f ssh-mirror -> origin/ssh-mirror  (forced update)
  + c6037be...d70927f ssh-mirror -> origin/ssh-mirror  (forced update)
+ 00a823f...3ddaf66 test      -> origin/test  (forced update)
  + 00a823f...3ddaf66 test      -> origin/test  (forced update)
* [new tag]        android-1.5r3 -> android-1.5r3
  * [new tag]        android-1.5r3 -> android-1.5r3
* [new tag]        android-sdk-1.5_r3 -> android-sdk-1.5_r3
  * [new tag]        android-sdk-1.5_r3 -> android-sdk-1.5_r3
Fetching projects: 100% (128/128), done.   
Fetching projects: 100% (128/128), done.   
project .repo/manifests/
project .repo/manifests/
First, rewinding head to replay your work on top of it...
First, rewinding head to replay your work on top of it...
Applying: merge donut, change or add the projects to x86 port
Applying: merge donut, change or add the projects to x86 port
error: patch failed: default.xml:3
error: patch failed: default.xml:3
error: default.xml: patch does not apply
error: default.xml: patch does not apply
Using index info to reconstruct a base tree...
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Falling back to patching base and 3-way merge...
Auto-merging default.xml
Auto-merging default.xml
CONFLICT (content): Merge conflict in default.xml
CONFLICT (content): Merge conflict in default.xml
Failed to merge in the changes.
Failed to merge in the changes.
Patch failed at 0001 merge donut, change or add the projects to x86 port
Patch failed at 0001 merge donut, change or add the projects to x86 port  


When you have resolved this problem run "git rebase --continue".
When you have resolved this problem run "git rebase --continue".
Line 272: Line 349:
repo sync stopped on conflicts. Since we don't have local modifications, just ignore it by git rebase --skip:
repo sync stopped on conflicts. Since we don't have local modifications, just ignore it by git rebase --skip:


$ cd .repo/manifests
$ cd .repo/manifests
$ git rebase --skip
$ git rebase --skip
HEAD is now at 4a4f936 add branch for local lan
HEAD is now at 4a4f936 add branch for local lan
Applying: add platform/frameworks/policies/base to x86
Applying: add platform/frameworks/policies/base to x86
error: patch failed: default.xml:18
error: patch failed: default.xml:18
error: default.xml: patch does not apply
error: default.xml: patch does not apply
Using index info to reconstruct a base tree...
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Falling back to patching base and 3-way merge...
Auto-merging default.xml
Auto-merging default.xml
No changes -- Patch already applied.
No changes -- Patch already applied.
Applying: add branch for local lan
Applying: add branch for local lan
error: patch failed: default.xml:1
error: patch failed: default.xml:1
error: default.xml: patch does not apply
error: default.xml: patch does not apply
Using index info to reconstruct a base tree...
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Falling back to patching base and 3-way merge...
Auto-merging default.xml
Auto-merging default.xml
No changes -- Patch already applied.
No changes -- Patch already applied.  


If it complains about another conflict, do git rebase --skip again, 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:
If it complains about another conflict, do git rebase --skip again, 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:
$ git checkout -t kitkat-x86 m/kitkat-x86
 
$ git checkout -t kitkat-x86 m/kitkat-x86


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.
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
 
==Customize kernel==


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

Latest revision as of 10:20, 7 April 2014

Sumber: http://www.android-x86.org/getsourcecode


Informasi ini semoga dapat memberikan informasi terkini tentang bagaimana cara membuat Android untuk x86 seperti EeePC. Image yang dihasilkan berjalan dengan baik di hardware sebenarnya maupun di mesin virtual (qemu atau virtual box)

Sangat mudah sekali untuk mengcompile Android untuk platform x86 dari repository git android-x86. Kita tidak perlu melakukan patch. Hanya perlu mengikuti instruksi di bawah ini.

Cabang di Android-x86 tree

Karena AOSP berkembang sangat cepat, ada beberapa cabang yang dibuat tergantung release AOSP.

  • kitkat-x86 - Based Android 4.4 release (KitKat).
  • jb-x86 - Based Android 4.3 release (Jelly Bean).
  • ics-x86 - Based Android 4.0 release (Ice Cream Sandwich).
  • honeycomb-x86 - Based Android 3.2 release (Honeycomb).
  • gingerbread-x86 - Based Android 2.3 release (Gingerbread).
  • froyo-x86 - Based Android 2.2 release (Froyo).
  • eclair-x86 - Based Android 2.1 release (Eclair).
  • donut-x86 - Based Android 1.6 release (Donut).
  • android-x86-v0.9 (obsolete) - Based on Android 1.5 release (Cupcake).

Memperoleh source code Android-x86

Inisialisasi sistem operasi agar siap untuk mengcompile android sesuai dengan

http://source.android.com/source/initializing.html

Antara lain kita perlu

sudo apt-get update
sudo apt-get install openjdk-7-jdk
sudo apt-get install git gnupg flex bison gperf build-essential \
  zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
  libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
  libgl1-mesa-dev g++-multilib mingw32 tofrodos \
  python-markdown libxml2-utils xsltproc zlib1g-dev:i386
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

Setelah lingkungan di siapkan, kita dapat melakukan

mkdir android-x86
cd android-x86
repo init -u http://git.android-x86.org/manifest -b $branch
repo sync

Dimana $branch adalah nama cabang seperti di jelaskan di bagian sebelumnya, misalnya,

mkdir android-x86
cd android-x86
repo init -u http://git.android-x86.org/manifest -b kitkat-x86
repo sync

Proses ini akan menunjuk project yang dibuat atau di modifikasi oleh android-x86 ke git server dari android-x86. Sementara project lainnya tetap ke AOSP.

Android-x86 juga memiliki git mirror server di SourceForge.net. Untuk menggunakannya kita perlu mengubah perintah repo init menjadi

$ repo init -u git://android-x86.git.sf.net/gitroot/android-x86/x86/platform/manifest.git -b $branch

Contoh:

$ repo init -u git://android-x86.git.sf.net/gitroot/android-x86/x86/platform/manifest.git -b kitkat-x86

atau

$ repo init -u git://android-x86.git.sf.net/gitroot/android-x86/x86/platform/manifest.git -b jb-x86

Catatan: SourceForge akan mengacu semua proyek ke mirror SourceForge.net (tidak peduli apakah itu diubah oleh android-x86 atau bukan).

Kita juga dapat memperoleh beberapa informasi tambahan tentang sync dengan SourceForge di

http://www.android-dev.ro/2011/09/27/building-android-x86-from-sourceforge-and-repo-tool-is-now-on-code-google-com/

Jika kita berharap untuk bisa tetap sync dengan repository Android-x86, lakukan repo sync. Tidak perlu mengulang repo init. Akan tetapi, kadang kala kita akan melihat konflik saat repo sync. Lihat catatan berikut untuk mengatasi konflik.

Catatan: repository Android-x86 sangat besar (> 10GB). Jika kita memperoleh masalah saat melakukan sync, kemungkinan karena masalah jaringan atau server terlalu sibuk. Lakukan berulang-ulang 'repo sync' sampai sukses tanpa error.

Membuat Image

Setelah repo sync selesai, kita dapat membuat usb image atau cdrom iso image. Perlu di catat bahwa AOSP original hanya mendukung java 1.5 sebelum Froyo, oleh tim Android-x86 sudah di patch untuk mendukung java 1.6. Oleh karenanya kita dapat menggunakan java 1.5 atau 1.6 untuk mengcompile source code.

Catatan: Sebelum froyo-x86 (termasuk), kita dapat membuat 32-bit atau 64-bit host. Sejak gingerbread-x86, lingkungan untuk build 64-bit lebih di sukai.

Memilih Target

Kita perlu memilih target untuk x86 device yang akan kita gunakan / test. Berikut adalah beberapa target untuk branch yang berbeda,

donut-x86
   eeepc: for ASUS EeePC family
   q1u: for Samsung Q1U
   s5: for Viliv S5
eclair-x86
   generic_x86: for generic x86 PC/notebook
   eeepc: for ASUS EeePC family only
   q1u: for Samsung Q1U
   s5: for Viliv S5
froyo-x86 / gingerbread-x86
   generic_x86: for generic x86 PC/notebook
   eeepc: for ASUS EeePC family only
   asus_laptop: for some ASUS laptops
   tegav2: for Tegatech Tegav2 (may work with other Atom N45x based tablets)
   sparta: for Dell Inspiron Mini Duo platform
   vm: for virtual machine (virtual box, qemu, vmware)
   motion_m1400: for Motion M1400 (Intel Centrino M based with Intel PRO/Wireless)
honeycomb-x86 / ics-x86
   generic_x86: for generic x86 PC/notebook
   amd_brazos: for AMD Brazos platform
   eeepc: for ASUS EeePC family only
   asus_laptop: for some ASUS laptops
   tegav2: for Tegatech Tegav2 (may work with other Atom N45x based tablets)
jb-x86 / kitkat-x86
   android_x86: for x86 platform

Sebetulnya, karena alasan historikal, kita harus menggunakan eeepc untuk PC x86, notebook atau notebook sebelum (termasuk) branch donut-x86. Sejak branch eclair-x86, eeepc di ubah hanya untuk keluarga ASUS EeePC saja. Jangan gunakan itu, jika kita tidak menggunakan EeePC.

Singkatnya, jika kita tidak tahu apa yang harus kita pilih, gunakan eeepc untuk branch donut-x86, dan gunakan generic_x86 untuk branch eclair-x86 sampai dengan ics-x86. Tapi perlu di catat bahwa generic_x86 adalah dasar dari berbagai target yang ada. Target generic-x86 tidak memiliki fitur yang advance seperti hardware acceleration.

Sejak jb-x86 Android-x86 berusaha untuk menggunakan android_x86 sebagai target universal bagi semua x86 device. Akan tetapi, android_x86 tidak mungkin di optimasi untuk device tertentu. Jika kita seorang developer, kita dapat membuat sebuah target berdasarkan android_x86 untuk device yang kita inginkan.

Jika kita ingin menambahkan target yang baru untuk device x86, ada baiknya membaca tulisan berikut,

http://www.android-x86.org/documents/how-to-add-new-x86-platforms

Membuat Android-x86

Untuk membuat live cdrom iso image untuk target android_x86, tulis:

$ make iso_img TARGET_PRODUCT=android_x86

Untuk membuat live cdrom iso untuk target tegav2, tulis:

$ make iso_img TARGET_PRODUCT=tegav2

Kita akan memperoleh file iso di folder out/target/product/x86/android_x86.iso, dll.

Jika komputer yang kita gunakan untuk build mempunyai lebih dari satu core, kita dapat memanfaatkan multicore dengan menambahkan -jX di awal perintah make, seperti

$ make -jX iso_img TARGET_PRODUCT=android_x86

Ganti X dengan jumlah core yang kita miliki. Misalnya, kita mempunyai CPU quad core, ganti X dengan 4:

$ make -j4 iso_img TARGET_PRODUCT=android_x86

Menggunakan buildspec.mk

Kita dapat membuat buildspec.mk di directory android-x86 untuk memudahkan target tertentu yang sering kita buat. Misalnya, isinya

TARGET_PRODUCT:=android_x86
TARGET_BUILD_VARIANT:=userdebug
TARGET_BUILD_TYPE:=release
TARGET_KERNEL_CONFIG:=android-x86_defconfig

Dengan adanya file buildspec.mk di directory android-x86, kita hanya perlu melakukan make dengan

$ make -jX iso_img

Penggunaan perintah lunch

Kita dapat men-source / menjalankan file build/envsetup.sh ke dalam lingkungan bash untuk memperoleh fungsi shell untuk menolong proses pembuatan:

$ . build/envsetup.sh

Selanjutnya, kita dapat memilih target menggunakan perintah lunch:

$ lunch $TARGET_PRODUCT-$TARGET_BUILD_VARIANT

dimana $TARGET_PRODUCT adalah target yang di jelaskan sebelumnya, nilai yang mungkin untuk $TARGET_BUILD_VARIANT adalah eng, user, userdebug. Contoh,

$ lunch android_x86-eng

Selanjutnya, kita dapat membuat dengan perintah m

$ m -jX iso_img

perintah m kira-kira sama dengan make, tapi kita dapat menggunakannya di subdirectory manapun di bawah tree android-x86.

Sejak froyo-x86, juga di tambahkan menu pemilihan pada perintah lunch. Cukup mengetik lunch, kita akan memperoleh daftar dari target yang tersedia. Pilih target dengan memasukan nomor-nya. Alternatif lain, cukup menulis

lunch $number.

Membuat Image yang lebih kecil

Jika kita menggunakan / ada squashfs-tools 4.0 (versi yang sebelumnya tidak bisa), filesystem Android core akan di kompres oleh squashfs. Oleh karenanya file iso yang di hasilkan akan sangat kecil (sekitar 30-40%). Jika kita ingin tidak mengaktifkannya, tambahkan USE_SQUASHFS=0 di make. Kita juga dapat menambahkan di buildspec.mk:

USE_SQUASHFS := 0

Sebelum froyo-x86 (termasuk), Jika kita ingin membuat image yang lebih kecil lagi, kita dapat membuang berbagai simbol debugging dengan menambahkan

TARGET_STRIP := 1

Sejak gingerbread-x86, simbol debugging akan dibuang secara default. Jangan gunakan fitur ini.

Testing

Image Android-x86 yang dibuat berada di

out/target/product/$TARGET_PRODUCT/$TARGET_PRODUCT.iso

Kita dapat dengan mudah mencoba file iso tersebut dengan menggunakan virtualbox atau qemu. Saat booting, pilih VESA atau debug mode.

Tentu saja, kita selalu dapat burn iso tersebut ke CD dan test ke hardware yang sebetulnya. Saat booting, dia akan mendeteksi hardware secara automatis dan me-load module yang dibutuhkan. Jika kita memperoleh masalah dengan frame buffer driver default-nya, kita dapat mencoba VESA mode (pilihan nomor dua di boot screen).

Sejak honeycomb-x86, Android-x86 mendukung format iso hybrid. Artinya, iso dapat di tuliskan ke usb flashdisk secara langsung. Kita dapat membuat bootable USB disk dengan perintah

dd if=out/target/product/x86/android_x86.iso of=/dev/sdX

where /dev/sdX is 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. Download the ISO image of android-x86.
2. Download UNetbootin from http://unetbootin.sourceforge.net/
3. Make sure you USB key is formatted.  UNetbootin silently fails to work if not formated.  I formatted my USB key fat32.
4. Run UNetbootin
        Select your USB key as the Drive.
        Select the android-x86 ISO file as the disk image.
        Click ok and wait.

It should take a minute to do. If it only took UNetbootin a few seconds to copy to USB, like my first attempt, then it didn't work. So remember on future upgrades to reformat your USB key before each android install. So now you should be able to boot from the USB key. Well, at least it worked for me. The UNetbootin is an interesting tool too.

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

Advance

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:

   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 
   Add this section to menu.lst
   title Run Android
   	kernel /android/kernel root=/dev/ram0 androidboot.hardware=android_x86  acpi_sleep=s3_bios,s3_mode SRC=/android
   	initrd /android/initrd.img
   title Run Android (VESA mode)
   	kernel /android/kernel root=/dev/ram0 androidboot.hardware=android_x86  acpi_sleep=s3_bios,s3_mode vga=788 SRC=/android
   	initrd /android/initrd.img
   title Run Android (Debug mode)
   	kernel /android/kernel root=/dev/ram0 androidboot.hardware=android_x86  acpi_sleep=s3_bios,s3_mode vga=788 SRC=/android DEBUG=1
   	initrd /android/initrd.img
   Create /android directory in the USB disk, and copy the four files kernel initrd.img ramdisk.img system.sfs (or system.img if you set USE_SQUASHFS=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 menu.lst.

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 data in your /android directory. 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 DATA=<device_name> to the boot option. For example, suppose your data partition is /dev/sda2, then add DATA=sda2 to the boot option.

How to solve conflicts

There are several reason to have conflicts during repo sync, 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:

$ repo sync
remote: Counting objects: 71, done.
remote: Compressing objects: 100% (41/41), done.
remote: Total 65 (delta 25), reused 28 (delta 9)
Unpacking objects: 100% (65/65), done.
From git://git.tarot.com.tw/android-x86/platform/manifest
   d53e6c1..2de7a11  android-1.5r2 -> origin/android-1.5r2
 * [new branch]      android-1.5r3 -> origin/android-1.5r3
 * [new branch]      android-sdk-1.5_r3 -> origin/android-sdk-1.5_r3
   d53e6c1..c544020  cupcake    -> origin/cupcake
 * [new branch]      cupcake-release -> origin/cupcake-release
   f4d79b1..6f7e0dd  donut      -> origin/donut
 + 7308d31...4a4f936 lan        -> origin/lan  (forced update)
 + b480a6d...d82496e local      -> origin/local  (forced update)
 + 11c9d96...84345fb master     -> origin/master  (forced update)
 + 5bcbf93...66e92cc mirror     -> origin/mirror  (forced update)
 + 9f3092f...665f9e8 ssh        -> origin/ssh  (forced update)
 + c6037be...d70927f ssh-mirror -> origin/ssh-mirror  (forced update)
 + 00a823f...3ddaf66 test       -> origin/test  (forced update)
 * [new tag]         android-1.5r3 -> android-1.5r3
 * [new tag]         android-sdk-1.5_r3 -> android-sdk-1.5_r3
Fetching projects: 100% (128/128), done.  
project .repo/manifests/
First, rewinding head to replay your work on top of it...
Applying: merge donut, change or add the projects to x86 port
error: patch failed: default.xml:3
error: default.xml: patch does not apply
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging default.xml
CONFLICT (content): Merge conflict in default.xml
Failed to merge in the changes.
Patch failed at 0001 merge donut, change or add the projects to x86 port 

When you have resolved this problem run "git rebase --continue". If you would prefer to skip this patch, instead run "git rebase --skip". To restore the original branch and stop rebasing run "git rebase --abort".

repo sync stopped on conflicts. Since we don't have local modifications, just ignore it by git rebase --skip:

$ cd .repo/manifests
$ git rebase --skip
HEAD is now at 4a4f936 add branch for local lan
Applying: add platform/frameworks/policies/base to x86
error: patch failed: default.xml:18
error: default.xml: patch does not apply
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging default.xml
No changes -- Patch already applied.
Applying: add branch for local lan
error: patch failed: default.xml:1
error: default.xml: patch does not apply
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging default.xml
No changes -- Patch already applied. 

If it complains about another conflict, do git rebase --skip again, 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:

$ git checkout -t kitkat-x86 m/kitkat-x86

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.



Referensi