2024-09-14  2024-09-17    539 字  2 分钟

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这个包)

  1. 输入git config user.email​查看是否已配置,如果未配置则执行以下命令
git config --global user.email "you@example.com"
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. Vendor Tree

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

<project name="TheMuppets/proprietary_vendor_MYVENDOR" path="vendor/MYVENDOR" depth="1" />

这样的内容。

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

清华源在添加时需要增加<remote name="real_github" fetch="https://github.com/" />​ 再在project​标签内增添remote="real_github"

7. 再同步

repo sync

8. 拉取设备特定代码

source build/envsetup.sh
breakfast {你的设备代号}

9. 编译

croot
brunch {你的设备代号}

其他

编译机最好是32G内存,否则就要加大Swap或者限制并行任务数

参照