安卓5.1源码下载:到firefly官网下载 http://www.t-firefly.com/doc/download/page/id/4.html
2.1准备工作
1.编译环境是ubuntu12.04系统或以上
2.ubuntu磁盘空间大于30GB,内存8GB,处理器8GB
2.2ubuntu下安装JDK7
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-7-jdk
如果以上方式安装JDK不成功的话,手动安装JDK7:
1.从官网上下载JDK包http://www.oracle.com/technetwork/articles/javase/index-jsp-138363.html
2.解压缩,放到指定目录(以jdk-7u80-linux-x64.gz为例):
创建目录:
sudo mkdir /usr/lib/jvm
解压缩到该目录:
sudo tar -zxvf jdk-7u80-linux-x64.gz -C /usr/lib/jvm
安装完成以后,配置环境变量,配置OpenJDK.打开/etc/profile文件:
sudo gedit /etc/profile
在末尾追加下面代码:
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
修改了/etc/profile文件需要重启才能生效,但使用下面命令可以在不重启的情况下在当前bash环境生效:
source /etc/profile
检查OpenJDK配置是否正确:
java -version
配置正确则如下图:(此图包括记下来的图片来自其它的博客,忘记来源了,在这里就直接用了)
设置系统默认jdk 版本:
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_95/bin/java 300
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0_95/bin/javac 300
sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.7.0_95/bin/jar 300
sudo update-alternatives --install /usr/bin/javah javah /usr/lib/jvm/jdk1.7.0_95/bin/javah 300
sudo update-alternatives --install /usr/bin/javap javap /usr/lib/jvm/jdk1.7.0_95/bin/javap 300
然后执行:
sudo update-alternatives --config java
若是初次安装jdk,会有下面的提示:
There is only one alternative in link group java (providing /usr/bin/java):
/usr/lib/jvm/jdk1.7.0_95/bin/java
否者,选择合适的jdk。
2.3Ubuntu 12.04 软件包安装
sudo apt-get install git gnupg flex bison gperf build-essential \
zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
g++-multilib mingw32 tofrodos gcc-multilib ia32-libs\
python-markdown libxml2-utils xsltproc zlib1g-dev:i386
2.4Ubuntu 13.10/14.04 软件包安装:
sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev \
libesd0-dev libwxgtk2.8-dev squashfs-tools build-essential zip curl \
libncurses5-dev zlib1g-dev pngcrush schedtool libxml2 libxml2-utils \
xsltproc lzop libc6-dev schedtool g++-multilib lib32z1-dev lib32ncurses5-dev \
lib32readline-gplv2-dev gcc-multilib libswitch-perl
2.5 Ubuntu 16.04 软件包安装:
sudo apt-get install -y git flex bison gperf build-essential libncurses5-dev:i386 \
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev g++-multilib tofrodos \
python-markdown libxml2-utils xsltproc zlib1g-dev:i386 dpkg-dev libsdl1.2-dev\
libesd0-dev git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev \
gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev \
libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip m4\
2.6 安装 ARM 交叉编译工具链和编译内核相关软件包:
sudo apt-get install gcc-arm-linux-gnueabihf \
lzop libncurses5-dev \
libssl1.0.0 libssl-dev
1.源码下载完成后,放到ubuntu上;
2.然后验证一下MD5码:
$ md5sum /path/to/firefly-rk3288_android5.1_git_20180126.tar.gz
8fe99f519d487ff40c8bc7b5ded62887 firefly-rk3288_android5.1_git_20180126.tar.gz
第二行为验证结果,若验证无误,就可以解压:
mkdir -p ~/proj/firefly-rk3288
cd ~/proj/firefly-rk3288
tar xf /home/rk3288/firefly-rk3288_android5.1_git_20180126.tar.gz
git reset --hard
cd ~/proj/firefly-rk3288/kernel
make firefly-rk3288_defconfig
make -j8 firefly-rk3288.img
编译不通过添加:
sudo apt-get install lzop sudo apt-get install libc6:i386
cd ~/proj/firefly-rk3288
make -j8
./mkimage.sh
重新编译若还是提示如下错误:
从报错信息来看,是在链接 host 程序时出错。链接 host 程序时用的工具链是放在 codebase中的,即
prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/bin/…/lib/gcc/x86_64-linux/4.6/…/…/…/…/x86_64-linux/bin/ld.
修改:
cp/usr/bin/ld.gold prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/x86_64-linux/bin/ld
然后执行:
make update-api
完成以后重新编译应该就没有错误了。