一、工作环境搭建
1. 安装 Ubuntu16.04 系统
2. 配置环境
2.1 安装 OpenJDK1.7
Ubuntu16.04 默认提供的源是 openjdk1.8,所以我们需要将软件源更换为阿里云的源
1)打开 sources.list 文件
sudo gedit /etc/apt/sources.list
2)添加以下代码
deb http://mirrors.aliyun.com/ubuntu/ quantal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ quantal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ quantal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ quantal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ quantal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ quantal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ quantal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ quantal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ quantal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ quantal-backports main restricted universe multiverse
若是上述方法仍然不行,建议
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-7-jdk
安装依赖(注意此为 ubuntu16 .04 使用的依赖,切勿使用 ubuntu14.04 所需的依赖)
sudo apt-get install -y git bison gperf build-essential libncurses5-dev
sudo apt-get install libx11-dev libreadline6-dev libgl1-mesa-dev g++-multilib libgl1-mesa-glx
sudo apt-get install tofrodos python-markdown xsltproc zip curl zlib1g-dev
sudo apt-get install dpkg-dev libsdl1.2-dev libesd0-dev mingw32
sudo apt-get install git-core gnupg flex bison gperf build-essential
sudo apt-get install gcc-multilib g++-multilib gcc-4.4 g++-4.4 g++-4.4-multilib gcc-4.4-multilib
sudo apt-get install libc6-dev lib32readline6-dev
sudo apt-get install lib32ncurses5-dev x11proto-core-dev libx11-dev
sudo apt-get install lib32z-dev ccache
sudo apt-get install libgl1-mesa-dev libxml2-utils unzip m4
c.直接安装 ADB
sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install android-tools-adb android-tools-fastboot
二、编译全志 6.0Android 源码
1、编译 lichee
先解压 lichee.tar.gz 文件(注意该文件必须和下文 android 文件同目录)
进入 lichee 目录
执行./build.sh config
选择 sun50iw1p1
选择 android
选择 linux-3.10
选择 P1
执行./build.sh
ERROR
awk: line 2: function strtonum never defined
SOLUTION:
sudo apt-get install gawk
2.编译 android(参考http://blog.csdn.net/fuchaosz/article/details/51487585)
修改 mydroid/art/build/Android.common_build.mk 文件,定位到 75 行,将下面的代码:
ifneq ($(WITHOUT_HOST_CLANG),true)
改为:
ifeq ($(WITHOUT_HOST_CLANG),false)
如果不修改这里,会遇到一个比较棘手的编译错误,修改的目的是把 CLANG 这个编译选项关掉,这个错误只会在 Ubuntu16.04 上遇到,Ubuntu14.04 则不存在这个问题
先解压 android.tar.gz 文件
进入 android 目录
source ./build/envsetup.sh
lunch
extract-bsp ---拷贝 lichee 目录下编译好的 uboot 跟 kernel
make -j32 2>&1 | tee make.log
pack