en Packaging and Flashing - JackA1ltman/NonGKI_Kernel_Build_2nd GitHub Wiki

Packaging and Flashing

Local Build ยท Step 4

After a successful build, the kernel image is located at out/arch/arm64/boot/. Two packaging methods are available.

Method 1: Anykernel3

  • Repository: https://github.com/osm0sis/AnyKernel3
  • Branch: master

Steps:

  1. Move out/arch/arm64/boot/Image.gz-dtb into the Anykernel3 directory

  2. Edit anykernel.sh and set the following three values:

do.devicecheck=0
BLOCK=auto;
is_slot_device=auto;
  1. Zip the entire Anykernel3 directory into a flashable package

  2. Boot into Recovery and flash the zip

Method 2: MKBOOTIMG

  • Repository: https://android.googlesource.com/platform/system/tools/mkbootimg
  • Branch: main-kernel-build-2024

Steps:

  1. Extract a clean boot.img from your device and place it at /home/username/boot.img

  2. Unpack the image and capture the repacking parameters:

BOOT_CMD=$(echo `mkbootimg/unpack_bootimg.py --boot_img=boot.img --format mkbootimg`)
mkbootimg/unpack_bootimg.py --boot_img boot.img
  1. Rename your compiled Image.gz-dtb to kernel and replace the existing kernel file inside the out/ directory

  2. Repack the boot image:

eval "mkboottools/mkbootimg.py $BOOT_CMD -o boot_moded.img"
  1. Boot into fastboot and flash:
fastboot flash boot boot_moded.img