Reading Notes for Qian Xin

Culture, Economics, Political... after reading something on internet, i will try to write down some notes. this is the place for me to record these notes.

Thursday, July 02, 2009

Linmaya » Android X86 Port

Linmaya » Android X86 Port



Android X86 Port
April 26th, 2009 | Tags: android, mid, mobile, porting
No Gravatar

Here is the consolidated post explaining what I did to get Android image compiled for X86 architecture. This documentation is just a consolidation of information from various sources across the web. You are encouraged to checkout the references at the end of this post to involve directly with Android-x86 porting activities.

Quicknotes:

* It is assumed that the host used is of 32-bit architecture
* It is assumed that host PC uses Debian as the Linux distro (Ubuntu should also work fine)
* It is also assumed that you have superuser previleges (sudo)
* ‘$>’ in the document indicates the terminal/shell prompt, unless explicitly stated otherwise
* Your home directory is assumed to have a directory by name ‘bin’ and is included in PATH. If not, you may do so by following the procedure;

$> mkdir -p ${HOME}/bin
$> echo export PATH=”${HOME}/bin:$PATH” >> ~/.bashrc
$> source ~/.bashrc

Steps:

1. Installing required packages in the host
Open a terminal and install the required packages using the command;

$> 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 libreadline5-dev

2. Setting up git to use proxy (Applicable only if you are using a proxy server)
Follow the link, to know how to setup git to use the proxy server

3. Installing Android ‘repo’ script
To install, initialize, and configure the Android repo, download the repo script and make sure it is executable:

$> curl http://android.git.kernel.org/repo > ~/bin/repo
$> chmod a+x ~/bin/repo

4. Getting the Android source
* Create a directory to sync android sources and initialize the repo

$> mkdir ~/android-src
$> cd ~/android-src
$> repo init -u git://android.git.kernel.org/platform/manifest.git -b cupcake

Notes: When prompted, configure Repo with your real name and email address. If you plan to submit code, use an email address that is associated with a Google account. A successful initialization will end with a message such as “repo initialized in /android-src”. Your client directory should now contain a .repo directory where files such as the manifest will be kept. Here we are using the ‘cupcake’ branch of android source. If you want to use the ‘master’ branch instead, you can skip the ‘-b cupcake’ option in the above repo command.
* To get the source files, run (in the android-src directory)

$> repo sync

Notes: The above command takes a longer time since, it needs to get more than 2GB of data!

5. Getting the EeePC-701 reference repo contents
* Open a local manifest file, using a text-editor such as gedit;

$> gedit .repo/local_manifest.xml

* Enter the following content in the opened local manifest file, save and then close it.






* Get the repo contents for eee_701 by running ‘repo sync’ command again;

$> repo sync

6. Downloading and applying X86 specific patches
* Create a directory to store android-x86 specific patches

$> mkdir ~/android-x86-patches
$> cd ~/android-x86-patches

* Download Android-x86 specific patches into android-x86-patches directory, from android-x86-patches link.

Notes: I used alarm.patch, boot_able_img.patch, cursor.patch, e2fsprogs.patch and frameworks.patch only

* Create a shell-script called apply-git-patch in ~/bin directory with the following content;

#!/bin/bash
if [ $# -ne 2 ]; then
echo "Usage: $(basename $0) "
exit 1
fi
BUILD_SRC_DIR="$1"
PATCHES_DIR="$2"
for ptch in $PATCHES_DIR/*.patch; do
dest_dir="$(cat $ptch | grep "projectb" | grep -v grep)"
if [ -n "$dest_dir" ]; then
patch_dir="$(echo $dest_dir | awk {'print $2'})"
pushd "$BUILD_SRC_DIR/$patch_dir"
echo "########## PATCH START: $ptch ########## "
git apply --reject --whitespace=fix $ptch
echo "########## PATCH END: $ptch ########## "
popd
fi
done
exit 0

* Make the script executable;

$> chmod a+x ~/bin/apply-git-patch

* Now, apply patches using;

$> apply-git-patch

(Ex.; apply-git-patch ~/android-src ~/android-x86-patches)

7. Compiling the source for x86 architecture

$> cd ~/android-src
$> sudo TARGET_ARCH=x86 TARGET_PRODUCT=eee_701 DISABLE_DEXPREOPT=true make -j2 installer_img

8. Flashing the installer image on USB-Pendrive

$> cd ~/android-src
$> sudo dd if=out/target/product/eee_701/installer.img of=/dev/sdX

where, sdX can be sda, sdb, or sdc, … depending on your USB pendrive device file

9. Installing the image on to a Target x86 device (EeePC, HP-Mini, ….)
Caution: The installer is rude in the sense, it will simply erase the entire disk on target device and installs the Android stuff. Don’t try it on a production machine unless you know what you are doing. You have been warned!!!

Insert the USB Pendrive into the Target device and boot using this Pendrive. The installer should carry on the installation, unless there is any issue (which might well be there since, x86 porting is still a community effort and a work in progress).

Online References:

* http://wiki.androidx86.org/index.php?title=Main_Page
* http://code.google.com/p/patch-hosting-for-android-x86-support

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home