Following script are the simple script based on android source project and my personal trial to build the android system on both ubuntu9.10 and ubuntu10.04 LTS.
#!/bin/sh
# download all needed packages to build android
sudo apt-get install libsdl-dev libesd0-dev libwxgtk2.6-dev
sudo apt-get install valgrind
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev
sudo apt-get dist-upgrade all
# Update sources.list for java download
# 1. download site : find the fast or closest mirror site to download ubuntn
# for Taiwan : http://tw.archive.ubuntu.com, http://ftp.nchc.org.tw, or http://ftp.twaren.net
# 2. Version
# to download java 1.6, replace ubuntn code name with karmic
# to download java 1.5, replace by jaunty
cd /etc/apt/
# backup original sources.list
sudo cp sources.list sources.list.0
sudo cp ~/sources.list.java5_dnload sources.list
sudo apt-get update
sudo apt-get install sun-java5-jdk
sudo update-java-alternatives -s java-1.5.0-sun
# restore original sources.list
sudo cp sources.list.0 sources.list
sudo apt-get update
# To dnload java6
# sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts sun-java6-jdk
mkdir ~/bin
mkdir ~/DroidSource
# Setup JAVA environment variables
more < < "EOF" | cat > > ~/.bashrc
JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun
JRE_HOME=${JAVA_HOME}/jre
export ANDROID_JAVA_HOME=$JAVA_HOME
export CLASSPATH=.:${JAVA_HOME}/lib:$JRE_HOME/lib:$CLASSPATH
export JAVA_PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin
export JAVA_HOME
export JRE_HOME
export CLASSPATH
HOME_BIN=~/bin/
export PATH=${PATH}:${JAVA_PATH}:${JRE_PATH}:${HOME_BIN}
EOF
source ~/.bashrc
# Dnload repo to ~/bin
curl https://android.git.kernel.org/repo >~/bin/repo
chmod a+x ~/bin/repo
# Dnload android source codes by repo sync
cd ~/DroidSource
repo sync
# Build Android by multiple threads
make -j4
# Restore original java
#
more < < "EOF"
Don't forget to Set the system to original version of java by
sudo update-java-alternatives -s java-6-sun
Also, update the right JAVA_HOME path defined in ~/.bashrc
EOF
You can copy and paste the script and save it as droidbuild. Then, change its mode and run it by
chmod 755 droidbuild
./droidbuild
sources.list.java5_dnload
# deb cdrom:[Ubuntu 9.10 _Karmic Koala_ - Release amd64 (20091027)]/ karmic main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://ftp.nchc.org.tw/ubuntu/ karmic main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://ftp.nchc.org.tw/ubuntu/ karmic-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
##---------------------------------------------------------
#deb http://ftp.nchc.org.tw/ubuntu/ karmic universe
#deb http://ftp.nchc.org.tw/ubuntu/ karmic-updates universe
##---------------------------------------------------------
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
##---------------------------------------------------------
#deb http://ftp.nchc.org.tw/ubuntu/ karmic multiverse
#deb http://ftp.nchc.org.tw/ubuntu/ karmic-updates multiverse
##---------------------------------------------------------
## Uncomment the following two lines to add software from the 'backports'
## repository.
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb http://tw.archive.ubuntu.com/ubuntu/ karmic-backports main restricted universe multiverse
# deb-src http://tw.archive.ubuntu.com/ubuntu/ karmic-backports main restricted universe multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu karmic partner
# deb-src http://archive.canonical.com/ubuntu karmic partner
#-----------------------------------------------------------------------------------
# deb http://ftp.nchc.org.tw/ubuntu/ karmic-security main restricted
# deb http://ftp.nchc.org.tw/ubuntu/ karmic-security universe
# deb http://ftp.nchc.org.tw/ubuntu/ karmic-security multiverse
#-----------------------------------------------------------------------------------
# deb http://ftp.nchc.org.tw/ubuntu/dists/jaunty main restricted multiverse universe #http://ftp.nchc.org.tw/ubuntu/dists/jaunty main (9.04)
deb http://ftp.nchc.org.tw/ubuntu/ jaunty main restricted universe multiverse
deb-src http://ftp.nchc.org.tw/ubuntu/ jaunty main restricted universe multiverse
deb http://ftp.nchc.org.tw/ubuntu/ jaunty-updates main restricted universe multiverse
deb-src http://ftp.nchc.org.tw/ubuntu/ jaunty-updates main restricted universe multiverse
deb http://ftp.nchc.org.tw/ubuntu/ jaunty-backports main restricted universe multiverse
deb-src http://ftp.nchc.org.tw/ubuntu/ jaunty-backports main restricted universe multiverse
deb http://ftp.nchc.org.tw/ubuntu/ jaunty-security main restricted universe multiverse
deb-src http://ftp.nchc.org.tw/ubuntu/ jaunty-security main restricted universe multiverse
0 意見:
張貼意見