一、系统环境:
ubuntu16.04LTE + 16G RAM
二、编译环境
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
三、代码下载
3.1.下载 repo 工具:
mkdir ~/bin
PATH=~/bin:$PATH
curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo > ~/bin/repo
chmod a+x ~/bin/repo
3.2.下载代码:
3.2.1 初始化repo
mkdir -p ~/android/lineage
cd ~/android/lineage
repo init -u https://github.com/LineageOS/android.git-b lineage-16.0
3.2.2 由于里面的默认是从google的服务器下载,国内墙的原因,更改为tuna源,修改如下:
vim .repo/manifests/default.xml
打开之后把下面内容
<remote name="github"
fetch=".."
review="review.lineageos.org" />
<remote name="private"
fetch="ssh://git@github.com" />
<remote name="aosp"
fetch="https://android.googlesource.com"
review="android-review.googlesource.com"
revision="refs/tags/android-9.0.0_r35" />
<default revision="refs/heads/lineage-16.0"
remote="github"
sync-c="true"
sync-j="4" />
修改为
<remote name="github"
fetch="https://github.com/" />
<remote name="lineage"
fetch="https://mirrors.tuna.tsinghua.edu.cn/git/lineageOS/"
review="review.lineageos.org" />
<remote name="private"
fetch="ssh://git@github.com" />
<remote name="aosp"
fetch="https://aosp.tuna.tsinghua.edu.cn"
review="android-review.googlesource.com"
revision="refs/tags/android-9.0.0_r35" />
<default revision="refs/heads/lineage-16.0"
remote="lineage"
sync-c="true"
sync-j="4" />
3.3.同步代码
repo sync
3.4.下载设备相关的代码(驱动等硬件设备相关的)
source build/envsetup.sh
breakfast enchilada
3.5.从设备导出vendor下该手机特有的内容
把Root过的手机,通过usb连接电脑,adb连接正常,执行下面的脚本
cd ~/android/lineage/device/oneplus/enchilada
./extract-files.sh
四.编译
croot
brunch enchilada
croot是回到代码根目录。