使用docker编译LinegeOS
source link: https://www.cnblogs.com/Tu9oh0st/p/14124095.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
使用docker编译LinegeOS - Tu9oh0st - 博客园
docker ubuntu18.04
docker pull ubunut:18.04
docker run -it --privileged=true -v ulineageos:/root ubuntu:18.04 /bin/bash
docker容器中需要用到mount
命令,所以需要将--privileged=true
。
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 python3-pip python-protobuf
pip3 install six google protobuf
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
然后就是提取blobs了,我这里使用基于OTA的方式来提取,其他的也可以参考官网。
sha256sum 20201212/lineage-17.1-20201212-nightly-sailfish-signed.zip
unzip 20201212/lineage-17.1-20201212-nightly-sailfish-signed.zip payload.bin
git clone https://github.com/LineageOS/scripts
python scripts/update-payload-extractor/extract.py payload.bin --output_dir ./
mkdir system/
mount system.img system/
mount vendor.img system/vendor/
mount product.img system/product/
回到源代码的根目录中执行extract-files.sh
./extract-files.sh ~/android/system_dump/
sudo umount -R ~/android/system_dump/system/
rm -rf ~/android/system_dump/
croot
brunch sailfish
__EOF__
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK