2009年3月10日星期二

Android Get Source

Android Get Source
星期四, 三月 5, 10:12 上午

1. Setting up your machine

OpenSUSE Linux

The Android build is routinely tested on recent versions of OpenSUSE 11.0.
*Required Packages:
* Git 1.5.4 or newer
* JDK 5.0,update 12 or higher
In my platform:
Git 1.6.4
JDK 6u10
*You might also want Valgrind,a tool that will help you find memory leaks,stack corruption,array bounds overflows,etc.

2. Installing Repo

Make sure you have a ~/bin directory in your home directory, and check to be sure that this bin directory is in your path:
$ cd ~
$ mkdir bin
$ echo $PATH
Download the Repo script and make sure it is executable:
$ curl http://android.git.kernel.org/repo > ~/bin/repo
$ chmod a + x ~/bin/repo
*Set Git Proxy
$ curl http://www.meadowy.org/~gotoh/ssh/connect.c > connect.c
$ gcc -o connect connect.c
$ cd ~/bin
$ vi http-proxy
#!/bin/sh
# FileName: http-proxy
# This connects to an HTTP Proxy using connect.c
connect -H http://proxy.bupt.edu.cn:8080 $@
$ chmod a+x http-proxy
$ git config --global core.gitproxy "http-proxy for kernel.org"
##write rc file for connect
$ vi /etc/connectrc
HTTP_PROXY_USER=liangtaohy
HTTP_PROXY_PASSWORD=8712715
Initializing a Repo client
*Create an empty directory to hold your working files:
$ mkdir mydroid
$ cd mydroid
*Run repo init to bring down the latest version of Repo
$ repo init -u git://android.git.kernel.org/platform/manifest.git
*Getting the file
$ repo sync
###解决sync断开问题#######
###repo-sync shell#####
###这个是拷贝的###########
$ vi ~/bin/repo-sync
#!/bin/sh
echo "======start repo sync======"
repo sync
while [ $? = 1 ]; do
echo "======sync failed,re-sync again======"
sleep 10
repo sync
done

*Building the code
$ cd ~/android
$ make
If your build fails,complaining about a missing "run-java-tool", try setting the ANDROID_JAVA_HOME env var to $JAVA_HOME before making.
$ export ANDROID_JAVA_HOME=$JAVA_HOME

3. Config the environment of Java
My Java version is 1.6.0_10
The environment vars are:
JAVA_HOME=/usr/java/


2. Make Android Ramdisk
$ gnucpio -iz -F ramdisk.img
$ gnucpio -i -t -F ../ramdisk.img | gnucpio -o -H newc -O ../roofs.img

3. Error List
When I compiled the Android Source, I have encounterred some of errors.They are in the following list:
#Error 1
javac: 1.5 :can't find file
javac: 999999999: can't find file
...
----------------------
I surfed online and found that it's because there are two or more versions of java.
You should choose one. I remove the old version and assign JAVA_HOME,JDK_HOME to the new version.And I add the JAVA_HOME/bin to PATH,too.
#Error 2
target DEX:core
can't reserve enough space to VM
can't create JVM
----------------------
That's because the space assigned is too large for HOST.
I find the file include 'Xmx*M' in build directory and change it to 'Xmx1400M'.
You can find the proper value for your host by following:
$ java -Xmx1400M -version

没有评论: