宁波.Net技术讨论区

ubuntu下基于源码的android平台搭建

 

/*
* author J.
* date: Tue Aug 31, 2010
*/
step_1: get the git tool(like cvs)
sudo apt-get install git-core gnupg
step_2: other tools dependent install
sudo apt-get install flex bison gperf libsd1-dev libesd0-dev libwxgtk2.6-dev
build-essential zip curl libncurses5-dev zlib1g-dev
step_3: python
sudo apt-get install python
step_4: valgrind (Dynamic Binary Analysis,DBA)
sudo apt-get install valgrind
step_5: java install
sudo apt-get install sun-java6-jdk
sudo apt-get install sun-java5-jdk
cd /etc/alternatives
sudo rm javadoc.1.gz javadoc
sudo ln -s /usr/lib/jvm/java-1.5.0-sun/man/man1/javadoc.1.gz javadoc.1.gz
sudo ln -s /usr/lib/jvm/java-1.5.0-sun/bin/javadoc javadoc
set environment (don't need write in ~/.bashrc,we use it not all the time):
export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
why do this ?
Ans: jdk version >= 1.5 can be supported by android, and when "make sdk" ,
"javadoc :error" will occur for version 1.6.
solution: as command above, java jdk point to sun-java6-jdk,javadoc and javadoc.1.gz
point to sun-java5-jdk.
advantage: if (android development)
use jdk1.6
if (make sdk)
use jdk1.5's javadoc and javadoc.1.gz
step_6: install script download
mkdir ~/bin
vim .bashrc (add command :export PATH=$PATH:$HOME/bin)
source .bashrc
curl http://android.git.kernel.org/repo > $HOME/bin/repo
cd $HOME/bin
chmod +x repo
step_7: export android project
cd
mkdir -p src/android
cd src/android
repo init -u git://android.git.kernel.org/platform/manifest.git
when this done,my src/android dir has made a connection with Google's android src
step_8: android platform src download now.
repo sync ( if just want a kernel,use: sync kernel)
---> compile
step_9: compile now
cd $HOME/src/android
make
when make done,the products are in src/out/target/product/generic (system.img userdata.img ramdisk.img)
step_10: compile SDK now
make sdk
when make done,the products are in out/host/linux-x86/sdk, this sdk ball can be used by eclipse. make "*.zip" a backup.
---> run now
step_11: set Android SDK and AVD manager
cd ~/src/android/out/host/linux-x86/sdk/android-sdk_eng.geforce_linux-x86/tools
./android
then new a AVD in the Android SDK and AVD Manager.
step_12: set img file's environment
vim ~/.bashrc(add: export IMG_DIR=$HOME/src/android/out/target/product/generic)
step_13: run with the img file
emulator -image $IMG_DIR/system.img -data $IMG_DIR/userdata.img -ramdisk $IMG_DIR/ramdisk.img

posted @ 2010-09-02 14:49  山 人  阅读(447)  评论(0编辑  收藏  举报