下载源码参照博客:http://blog.csdn.net/maosidiaoxian/article/details/41889347
下载地址:http://pan.baidu.com/s/1hqEHRAc
本人下载的是:android-5.0.0_r7_code-无OMA-DM.7z
下载完成之后解压,在终端进入解压后的文件夹,使用make命令编译。
在编译过程中遇到的问题:
下载:
编译的jdk版本要求是open-jdk-7,我之前装的是官网下载的jdk1.7,配置在/etc/enviroment中,然后就需要重新安装和配置,使用update-alternatives来进行版本切换。
我分别下载了三个jdk版本,open-jdk7、jdk1.7、jdk1.6。
配置:
前提是我的jdk全部放在/usr/lib/jvm目录下,分别对应文件夹为:java-7-openjdk-amd64 , jdk1.6.0_45 , jdk1.7.0_71。
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/java-7-openjdk-amd64/bin/javac" 1
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0_71/jre/bin/java" 2
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0_71/bin/javac" 2
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.6.0_45/jre/bin/java" 3
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.6.0_45/bin/javac" 3
配置完成java和javac,编译的时候会出现 /bin/bash:jar 的错误
所以接着配置jar等其他命令,防止还有其他错误出现:
sudo update-alternatives --install "/usr/bin/jar" "jar" "/usr/lib/jvm/java-7-openjdk-amd64/bin/jar" 1
sudo update-alternatives --install "/usr/bin/javah" "javah" "/usr/lib/jvm/java-7-openjdk-amd64/bin/javah" 1
sudo update-alternatives --install "/usr/bin/javadoc" "javadoc" "/usr/lib/jvm/java-7-openjdk-amd64/bin/javadoc" 1
sudo update-alternatives --install "/usr/bin/jar" "jar" "/usr/lib/jvm/jdk1.7.0_71/bin/jar" 2
sudo update-alternatives --install "/usr/bin/javah" "javah" "/usr/lib/jvm/jdk1.7.0_71/bin/javah" 2
sudo update-alternatives --install "/usr/bin/javadoc" "javadoc" "/usr/lib/jvm/jdk1.7.0_71/bin/javadoc" 2
sudo update-alternatives --install "/usr/bin/jar" "jar" "/usr/lib/jvm/jdk1.6.0_45/bin/jar" 3
sudo update-alternatives --install "/usr/bin/javah" "javah" "/usr/lib/jvm/jdk1.6.0_45/bin/javah" 3
sudo update-alternatives --install "/usr/bin/javadoc" "javadoc" "/usr/lib/jvm/jdk1.6.0_45/bin/javadoc" 3
接下来遇到的错误是 /bin/bash:gperf
解决办法是:
sudo apt-get install gperf
编译:
进入文件夹:
make