This guide explains how to "install" your newly compiled kernel modules (.ko
files) into a stock boot image, like vendor_boot.img or vendor_dlkm.img.
The method is simple: you replace the original module directory with your new one.
- An unpacked stock image (the contents of your
vendor_boot.img). - The prepared
lib/modulesfolder created by ourlkm_installerscript.
You will also need a tool to unpack and repack the image. I use Android_boot_image_editor.
-
Unpack: Unpack the stock
vendor_boot.img. This will give you a directory with the original files. -
Nuke: Go into the unpacked directory and completely delete the original
lib/modulesfolder. -
Replace: Copy the new
lib/modulesfolder (the one created by our script) into the unpacked directory where the old one used to be. -
Repack: Use your tool to repack the modified directory back into a flashable
.imgfile.
That's it. The new image now contains all of your custom-built kernel modules.
gitpod /workspace/gitpod/hi (main) $ ./do.sh
Enter the full path to the STOCK modules.dep file: /workspace/gitpod/android_kernel_a166p/custom_defconfigs/modules.dep
Enter the full path to the STOCK modules.load file (for the final step): /workspace/gitpod/android_kernel_a166p/custom_defconfigs/vendor_boot.modules.load
Enter the full path to the CUSTOM compiled module directory (.../staging/lib/modules/kernel_version folder): /workspace/gitpod/android_kernel_a166p/out/target/product/a16xm/obj/KERNEL_OBJ/staging/lib/modules/5.15.167-android13-8-ravindu644-dev
Enter the full path to the System.map file: /workspace/gitpod/android_kernel_a166p/out/target/product/a16xm/obj/KERNEL_OBJ/dist/System.map
Enter the full path to the llvm-strip tool: /workspace/gitpod/android_kernel_a166p/kernel/prebuilts/clang/host/linux-x86/clang-r450784e/bin/llvm-strip
Enter the full path for the FINAL output directory: /workspace/gitpod/hi/vendor_boot