编译 LineageOS 源码,并重定义 kernel log

1.下载清华源的 repo

curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -o repo
chmod +x repo
../repo init --depth 1 -u  https://mirrors.tuna.tsinghua.edu.cn/git/lineageOS/LineageOS/android.git  -b lineage-18.1
../repo sync -c --no-tags -j8
  1. 选择设备信息,并从github上下载设备相关文件
驱动:
https://github.com/LineageOS/android_device_xiaomi_sagit
https://github.com/LineageOS/android_device_xiaomi_msm8998-common.git

内核:
https://github.com/LineageOS/android_kernel_xiaomi_msm8998.git
git clone   https://github.com/LineageOS/android_kernel_xiaomi_msm8998.git --depth=1   -b  lineage-18.1 

拷文件:
scp -r  ./xiaomi   lmhu@172.20.232.152:/Users/lmhu/Desktop
scp   ./xiaomi root@172.29.80.217:/home/rom-lineageos/lineage_18_1/vendor

scp  .   root@172.29.80.217:/home/rom-lineageos/lineage_18_1/kernel
du -hl --max-depth=1 .
tar -zcvf xiaomi.tar.gz  ./xiaomi  内核文件压缩
tar -zxvf   xiaomi.tar.gz

3.编译内核

repo start lineage-18.1-android-11.0.0_r32_dev --all    --  重新新建分支,并切换到新分支
scp  .   root@172.29.80.217:/home/rom-lineageos/

git patch 相关:
git format-patch  -1  c910bcf9a084d0f0
打补丁:git am --signoff < newpatch.patch
冲突: git apply  --reject 0001-add-libc-open-log.patch

source build/envsetup.sh
breakfast sagit
croot                 (如果当前不在源码的根目录,会cd到你的源码根目录)
brunch sagit         (开始整编系统)

4.刷机

下载 twrp : https://twrp.me/xiaomi/xiaomimi6.html
adb reboot bootloader
fastboot flash recovery twrp.img
fastboot reboot
adb push lineage_sagit-ota-eng.root.zip  /sdcard/
重启按住音量+
 error: requires MIUI firmware version 9.5.16 or newer
下载固件,重新一起刷机
https://xiaomifirmwareupdater.com/#download
adb root / adb root

参考:
https://www.cnblogs.com/luoyesiqiu/p/10701419.html

5.重新刷入 system.img

 cd system/core/logd
 mm命令
用于在模块根目录编译这个模块。只能在第一次编译后使用
scp  root@172.29.80.217:/home/rom-lineageos/lineage_18_1/out/target/product/sagit/system/bin/logd

adb reboot
adb root
adb remount
setenfore 0    --- 缺少这一步,会导致无法创建文件

在这里插入图片描述
参考文章:
https://blog.youkuaiyun.com/u010671781/article/details/107819150 — Ubuntu 小米6 LineageOS源码编译
https://blog.youkuaiyun.com/xiaomaNo01/article/details/112986759
https://wiki.lineageos.org/devices/sagit/build — 官网参考
https://www.cnblogs.com/luoyesiqiu/p/10701419.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值