系統:
Ubuntu18.04
vmware
環境搭建
安裝SDK
https://dl.google.com/android/repository/platform-tools-latest-linux.zip
執行命令:
unzip platform-tools-latest-linux.zip -d ~
編譯~/.profile文件中添加:
if [ -d "$HOME/platform-tools" ] ; then
PATH="$HOME/platform-tools:$PATH"
fi
再執行source ~/.profile
安裝必要的依賴包
sudo apt install bc bison build-essential ccache curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick lib32ncurses5-dev lib32readline-dev lib32z1-dev liblz4-tool libncurses5 libncurses5-dev libsdl1.2-dev libssl-dev libxml2 libxml2-utils lzop pngcrush rsync schedtool squashfs-tools xsltproc zip zlib1g-dev openjdk-8-jdk python
創建目錄
mkdir -p ~/bin
mkdir -p ~/android/lineage
安裝repo
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
將repo設置爲環境變量,編輯~/.profile
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
執行source ~/.profile
同步LIneage OS
cd ~/android/lineage
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/lineageOS/LineageOS/android.git -b lineage-17.1 --repo-url=https://gerrit-googlesource.lug.ustc.edu.cn/git-repo
修改.repo/manifests/default.xml
,將
<remote name="github"
fetch=".."
review="review.lineageos.org" />
改成
<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="aosp"
fetch="https://android.googlesource.com"
改成
<remote name="aosp"
fetch="https://mirrors.tuna.tsinghua.edu.cn/git/AOSP"
將
<default revision="..."
remote="github"
改成
<default revision="..."
remote="lineage"
同步源碼樹(以後只需執行這條命令來同步):
repo sync
這將根據網速來判斷需要花費多長時間。