1.Android的一些有用的官方网站:
http://android.git.kernel.org android源码网站
http://source.android.com
http://code.google.com/android
http://developer.android.com
2.安装git源码管理工具
# cd ~
# mkdir bin
# echo $PATH
# curl http://android.git.kernel.org/repo > ~/bin/repo
# chmod a+x ~/bin/repo
git下载源码方法:
下载一个tree(至当前路径):
# git clone git://git路径 (git路径参看网站发布tree路径)
下载整个platform至当前路径:
# repo init -u git://git路径/platform/manifest.git
# repo sync
3.获得Android平台源码(具体可参看http://android.git.kernel.org):
# mkdir myandroid
# cd myandroid
# repo init -u http://android.git.kernel.org/platform/manifest.git
# repo sync
按默认设置完成即可
4.获得S3C6410平台Android底层Linux内核源码
# git clone git://github.com/leemgs/samsung-s3c6410-android.1.0.git
5.获得并安装Android编译工具(Toolchain)
# wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.12.tar.gz
# ./configure --prefix=/usr/local
# make
# make install
# vi /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/local/lib
# ldconfig
# cd /opt
# wget http://www.kandroid.org/devtools/kandroid-1.1.2.1-20080530.glibc.tgz
# tar xvzf kandroid-arm-toolchain-20080530.tgz
# cd ./kandroid-arm-toolchain-20080522/bin
# ls
arm-android-linux-gnueabi-addr2line arm-android-linux-gnueabi-gprof
arm-android-linux-gnueabi-ar arm-android-linux-gnueabi-jcf-dump
arm-android-linux-gnueabi-as arm-android-linux-gnueabi-jv-scan
arm-android-linux-gnueabi-c++ arm-android-linux-gnueabi-ld
arm-android-linux-gnueabi-c++filt arm-android-linux-gnueabi-nm
arm-android-linux-gnueabi-cc arm-android-linux-gnueabi-objcopy
arm-android-linux-gnueabi-cpp arm-android-linux-gnueabi-objdump
arm-android-linux-gnueabi-g++ arm-android-linux-gnueabi-populate
arm-android-linux-gnueabi-gcc arm-android-linux-gnueabi-ranlib
arm-android-linux-gnueabi-gcc-4.2.3 arm-android-linux-gnueabi-readelf
arm-android-linux-gnueabi-gccbug arm-android-linux-gnueabi-run
arm-android-linux-gnueabi-gcj arm-android-linux-gnueabi-size
arm-android-linux-gnueabi-gcjh arm-android-linux-gnueabi-sstrip
arm-android-linux-gnueabi-gcov arm-android-linux-gnueabi-strings
arm-android-linux-gnueabi-gdb arm-android-linux-gnueabi-strip
arm-android-linux-gnueabi-gjnih
#
# ./arm-android-linux-gnueabi-gcc -v
Using built-in specs.
Target: arm-android-linux-gnueabi
Configured with: /opt/androidtoolchain110/bin/targets/src/gcc-4.2.3/configure --build=i686-pc-linux-gnu --target=arm-android-linux-gnueabi --host=i686-pc-linux-gnu --prefix=/root/x-tools/arm-android-linux-gnueabi --with-sysroot=/root/x-tools/arm-android-linux-gnueabi/arm-android-linux-gnueabi/sys-root --enable-languages=c,c++,java --with-arch=armv6j --with-cpu=arm1136jf-s --with-tune=arm1136jf-s --with-float=soft --enable-__cxa_atexit --disable-multilib --with-gmp=/root/x-tools/arm-android-linux-gnueabi --with-mpfr=/root/x-tools/arm-android-linux-gnueabi --with-local-prefix=/root/x-tools/arm-android-linux-gnueabi/arm-android-linux-gnueabi/sys-root --disable-nls --enable-threads=posix --enable-symvers=gnu --enable-c99 --enable-long-long --with-bugurl=http://www.kandroid.org --with-pkgversion=kandroid-invain-arm_v6_nfp_le-ver.1.1.2.1
Thread model: posix
gcc version 4.2.3
# vi autotoolpath.sh
#!/bin/bash
export PATH=/opt/kandroid-1.1.2.1-20080530.glibc/bin:$PATH
6.Android编译
1) 至sun网站下载JDK1.5(jdk-1_5_0_21-linux-i586-rpm.bin)
# ./jdk-1_5_0_21-linux-i586-rpm.bin
解压成:jdk-1_5_0_21-linux-i586-rpm.rpm
2) 安装JDK 1.5
# rpm -ivh jdk-1_5_0_21-linux-i586-rpm.rpm
3) 下载gperf-3.0.4.tar.gz, 然后安装
./configure
make
make install
4) 在/etc/profile末尾添加
JAVA_HOME=/usr/java/jdk1.5.0_21
export ANDROID_JAVA_HOME=$JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
CLASSPATH=.:$JAVA_HOEM/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export CLASSPATH
5) 编译Android
在Android目录执行make.
# make
6) 编译Android SDK
# ./build/envsetup.sh
# ./make sdk
如果出现JAVA链接问题,执行:
# JAVA_HOME=/usr/java/jdk1.5.0_21
# export ANDROID_JAVA_HOME=$JAVA_HOME
7.S3C6410 Linux内核编译
# cd samsung-s3c6410-linux
# cp ./arch/arm/configs/smdk6410mtd.android_defconfig .config
# make menuconfig
# make