Android源码下载
环境:ubuntu
clone代码前的环境准备:
安装git:sudo apt-get install git
进行配置
git config --global user.email “usergmail@gmail.com”
git config --global user.name “username”
安装curl:sudo apt-get install curl
安装python:sudo apt-get install python
创建一个bin,加入到PATH中:
mkdir ~/bin
PATH=~/bin:$PATH
下载repo并设置:
curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo > ~/bin/repo
chmod a+x ~/bin/repo
添加环境变量:
export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo'
环境配置完成,开始clone代码:
初始化仓库(这里clone 9.0代码)
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-9.0.0_r8
同步代码: repo sync
代码编译
安装 jdk8:
sudo apt-get update
sudo apt-get install openjdk-8-jdk
安装依赖包(安装fail时,可以按顺序挨个安装)
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 x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip
源码编译:
source build/envsetup.sh
make clobber
lunch
make -j8
单独编译模块:
source build/envsetup.sh
make clobber
lunch
到指定的模块路径下,执行mm或者mmm即可