Skip to content
TheWildJames edited this page Sep 2, 2026 · 1 revision

Patch boot.img Manually (magiskboot)

Use the official magiskboot build — works on Android and Linux.

See Installation for prerequisites, supported versions, and risks.

Platforms: Android · Linux

Preparation

  1. Get your device's stock boot.img.
  2. Download the AnyKernel3 ZIP for your kernel version from Releases.
  3. Unpack the ZIP and get the Image file (the KernelSU kernel).

Android — via adb + libmagiskboot.so

Folder structure on device (/data/local/tmp/):

/data/local/tmp/
├── magiskboot
├── boot.img
└── Image
  1. Download latest Magisk from GitHub Releases.
  2. Rename Magisk-*(version).apk to Magisk-*.zip and unzip.
  3. Push libmagiskboot.so to device:
adb push Magisk-*/lib/arm64-v8a/libmagiskboot.so /data/local/tmp/magiskboot
  1. Push boot.img and Image:
adb push boot.img /data/local/tmp/
adb push Image /data/local/tmp/
  1. Make executable:
adb shell
cd /data/local/tmp/
chmod +x magiskboot
  1. Unpack:
./magiskboot unpack boot.img
  1. Replace kernel:
mv -f Image kernel
  1. Repack:
./magiskboot repack boot.img
  1. Test: fastboot boot new-boot.img
  2. Flash: fastboot flash boot new-boot.img
Linux — official magiskboot

Folder structure on PC:

.
├── magiskboot
├── boot.img
└── Image
  1. Prepare boot.img and Image on PC.
  2. Make executable: chmod +x magiskboot
  3. Unpack: ./magiskboot unpack boot.img
  4. Replace: mv -f Image kernel
  5. Repack: ./magiskboot repack boot.img
  6. Test: fastboot boot new-boot.img
  7. Flash: fastboot flash boot new-boot.img

Clone this wiki locally