版权归作者所有,如有转发,请注明文章出处:https://cyrus-studio.github.io/blog/
源码下载
LineageOS官网:https://lineageos.org/
LineageOS源码 github 地址:https://github.com/LineageOS/android
LineageOS源码国内镜像地址:https://mirrors.tuna.tsinghua.edu.cn/help/lineageOS/
源码大概需要150GB的硬盘空间,编译完成差不多300G
1. 配置git
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
2. 安装 repo
mkdir ~/bin
PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
3. 安装 Git LFS
sudo apt install git-lfs
git lfs install
4. 设置REPO_URL
找到 repo 所在路径
which repo
编辑 repo
nano /home/cyrus/bin/repo
可以看到repo会优先取环境变量中的REPO_URL,否则默认使用googlesource
Ctrl +X 退出nano
通过下面的命令设置 REPO_URL 环境变量,设置为清华大学镜像源,解决国内访问不了 googlesource 问题
export REPO_URL=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/
5. 下载源码
创建目录
mkdir lineageos
进入到 lineageos 目录
cd lineageos
如果可正常访问 github,使用下面的命令初始化 repo
repo init -u https://github.com/LineageOS/android.git -b lineage-21.0 --git-lfs
否则,使用清华大学镜像初始化 repo,并修改 default.xml
repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/lineageOS/LineageOS/android.git -b lineage-21.0 --git-lfs
打开 .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/