使用docker編譯LinegeOS

環境

docker ubuntu18.04

docker pull ubunut:18.04

docker run -it -v ulineageos:/root ubuntu:18.04 /bin/bash

ulineageos是本地的一個目錄名,掛在到docker容器中的/root目錄

docker容器內的命令:

apt-get update

apt-get upgrade -y

apt install -y wget vim p7zip p7zip-rar p7zip-full 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 file nano screen sudo tig

cd ~/

wget https://dl.google.com/android/repository/platform-tools-latest-linux.zip

7z x platform-tools-latest-linux.zip

vim ~/.profile

~/.profile中添加

if [ -d "$HOME/platform-tools" ] ; then
PATH="$HOME/platform-tools:$PATH"
fi

source ~/.profile

mkdir -p ~/bin

mkdir -p ~/android/lineage

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"

同步源碼樹(以後只需執行這條命令來同步):

防止文件太大同步過程中導致EOF

git config --global http.postBuffer 524288000
repo sync

這將根據網速來判斷需要花費多長時間。

自己實踐了下,雖然網速夠快,但是清華源的一些東西都不是很全,所以如果能夠進外網還是使用官方的教程來進行。

編譯

source build/envsetup.sh

breakfast sailfish

參考

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章