LineageOS编译记录

1. 安装编译环境

Arch下

​paru -S lineageos-devel​

2. 建立工作目录

mkdir LineageOS

cd LineageOS

3. 初始化仓库

使用清华源

repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/lineageOS/LineageOS/android.git -b lineage-21.0 --git-lfs

官方源

repo init -u https://github.com/LineageOS/android.git -b lineage-21.0 --git-lfs

4. 配置 git

​1. git lfs install​(有些系统需要安装git-lfs这个包)

输入git config user.email​查看是否已配置,如果未配置则执行以下命令

git config --global user.email "[email protected]"

git config --global user.name "Your Name"

5. ccache 缓存

安装ccache​后

export USE_CCACHE=1

export CCACHE_EXEC=/usr/bin/ccache

(export 可添加到~/.bashrc)

再输入ccache -M 50G​

6. Proprietary Blobs

repo sync后于工作目录编辑.repo/local_manifests/roomservice.xml​,添加类似

这样的内容。

可以在TheMuppets仓库先搜索,再在muppets.xml中搜索,找到对应设备,复制粘贴。

清华源在添加时需要增加

再在project​标签内增添remote="real_github"​

7. 再同步

​repo sync​

8. 拉取设备特定代码

source build/envsetup.sh

breakfast {你的设备代号}

9. 编译

croot

brunch {你的设备代号}

Notice

编译机至少为64G内存,否则就要加大Swap,但Swap会损伤硬盘寿命且速度也不如内存😕

参照

Build for Polaris LineageOS官方文档

如何为安卓设备编译 LineageOS 操作系统

安卓环境搭建与编译 for Arch Linux