- 找到Pixel 3XL对应的内核版本
https://source.android.com/docs/setup/build/building-kernels?hl=zh-cn#supported-kernel-branches
Pixel 3 XL (crosshatch) android-msm-crosshatch-4.9-android12 - 下载内核源代码
mkdir android-kernel && cd android-kernel
repo init -u https://android.googlesource.com/kernel/manifest -b android-msm-crosshatch-4.9-android12
repo sync -cdj4
- 删除源码下载的img
cd out/target/product/crosshatch
$rm *.img kernel
rm: remove regular file 'boot-debug.img'?
rm: remove regular file 'boot.img'?
rm: remove regular file 'bootloader.img'?
rm: remove regular file 'boot-test-harness.img'?
rm: remove regular file 'dtb.img'?
rm: remove regular file 'dtbo.img'?
rm: remove regular file 'persist.img'?
rm: remove regular file 'product.img'?
rm: remove regular file 'radio.img'?
rm: remove regular file 'ramdisk-debug.img'?
rm: remove regular file 'ramdisk.img'?
rm: remove regular file 'ramdisk-recovery.img'?
rm: remove regular file 'ramdisk-test-harness.img'?
rm: remove regular file 'super_empty.img'?
rm: remove regular file 'system_ext.img'?
rm: remove regular file 'system.img'?
rm: remove regular file 'system_other.img'?
rm: remove regular file 'userdata.img'?
rm: remove regular file 'vbmeta.img'?
rm: remove regular file 'vendor.img'?
rm: remove regular file 'kernel'?
TODO: 这里是不是删除boot.img和kernel就可以了?
- 替换Image.lz4
mv Image.lz4 ../../../../android_backup
等待kernel编译完成,编译完成之后:
cp /home/fukaiqiang/work/android-kernel/out/android-msm-pixel-4.9/dist/Image.lz4 /home/fukaiqiang/work/code/device/google/crosshatch-kernel
- 再次编译android工程
source build/envsetup.sh
lunch aosp_crosshatch-userdebug
make -j16
- 刷机
还不知道如何编译下载和编译和刷写android源码的,可以看这篇文章 https://www.jianshu.com/p/8c402a0210d9