For some devices, the boot.img format isn't as common as lz4, gz, and uncompressed. A typical example is the Pixel, where the boot.img is compressed in the lz4_legacy format, while the ramdisk may be in gz or also compressed in lz4_legacy. Currently, if you directly flash the boot.img provided by KernelSU, the device may not be able to boot. In this case, you can manually patch the boot.img.
[!CAUTION] Flashing a kernel can brick your device and will void your warranty. Make a full backup (boot partition at minimum) before proceeding.
[!TIP] It's always recommended to use
magiskbootto patch images. There are two ways:
- magiskboot (official) - runs on Android devices (and Linux)
- WildKernels/Magisk (W.I.P.) - cross-built binaries for Windows/macOS/Linux PCs (W.I.P.)
Platforms: Android · Linux · Windows / Other
Each release artifact is named by KMI (Kernel Module Interface) and Security Patch Level (SPL).
android12-5.10, android13-5.10, android13-5.15, android14-5.15, android14-6.1, android15-6.6, android16-6.12. Must match your device's current kernel version. Check with uname -r or in Settings → About phone → Kernel version.If you don't know which file to download, carefully read the description of KMI and Security patch level in the release notes before downloading.
boot.img.6.1.157-android14).Image file, which is the kernel file of KernelSU.[!NOTE] Match by the full kernel version (e.g.,
6.1.157-android14) - your device's Android version and theandroid14in the kernel version are not necessarily the same.
Folder structure on device (/data/local/tmp/):
/data/local/tmp/
├── magiskboot
├── boot.img
└── Image
Magisk-*(version).apk to Magisk-*.zip and unzip it.Push libmagiskboot.so to your device by ADB:
adb push Magisk-*/lib/arm64-v8a/libmagiskboot.so /data/local/tmp/magiskboot
Push stock boot.img and Image from AnyKernel3 to your device:
adb push boot.img /data/local/tmp/
adb push Image /data/local/tmp/
Enter ADB shell and make it executable:
adb shell
cd /data/local/tmp/
chmod +x magiskboot
Unpack boot.img:
./magiskboot unpack boot.img
You will get a kernel file - this is your stock kernel.
Replace kernel with the KernelSU Image:
mv -f Image kernel
Repack the boot image:
./magiskboot repack boot.img
You will get a new-boot.img file. Flash this file to your device by fastboot:
fastboot flash boot new-boot.img
Folder structure on PC:
.
├── magiskboot
├── boot.img
└── Image
Official magiskboot can run in Linux normally - use the official build. If you prefer, you can also use WildKernels/Magisk (W.I.P.).
boot.img and Image in your PC.Make it executable:
chmod +x magiskboot
Unpack boot.img:
./magiskboot unpack boot.img
You will get a kernel file - this is your stock kernel.
Replace kernel:
mv -f Image kernel
Repack:
./magiskboot repack boot.img
You will get a new-boot.img file. Flash it by fastboot:
fastboot flash boot new-boot.img
Folder structure on PC:
.
├── magiskboot.exe
├── boot.img
└── Image
magiskboot binary for your OS from WildKernels/Magisk (W.I.P.).boot.img and Image in your PC.Make it executable:
chmod +x magiskboot
Unpack boot.img:
./magiskboot unpack boot.img
You will get a kernel file - this is your stock kernel.
Replace kernel:
mv -f Image kernel
Repack:
./magiskboot repack boot.img
You will get a new-boot.img file. Flash it by fastboot:
fastboot flash boot new-boot.img
Related: Installation Overview · Install with Kernel Flasher · Releases