unpack and repack android boot.img in linux

 

download latest magisk apk 

https://github.com/topjohnwu/Magisk

https://github.com/topjohnwu/Magisk/releases

https://github.com/topjohnwu/Magisk/releases/download/v29.0/Magisk-v29.0.apk

 

extract magiskboot 

libmagiskboot.so from apk using any tool for your arch mine is x86_64

unzip -j Magisk-v29.0.apk lib/x86_64/libmagiskboot.so

 

this is static binary than a .so file rename it and put in $PATH location


mv libmagiskboot.so magiskboot

chmod +x magiskboot


unpacking 

unpack boot.img 

magiskboot unpack boot.img

 

eg:

magiskboot unpack boot-ui2.img
Parsing boot image: [boot-ui2.img]
HEADER_VER      [2]
KERNEL_SZ       [13997124]
RAMDISK_SZ      [917271]
SECOND_SZ       [0]
RECOV_DTBO_SZ   [0]
DTB_SZ          [140627]
OS_VERSION      [11.0.0]
OS_PATCH_LEVEL  [2022-07]
PAGESIZE        [2048]
NAME            []
CMDLINE         [bootopt=64S3,32N2,64N2 buildvariant=user]
CHECKSUM        [23a7cfd44b419927992e5576cab76099992c4561000000000000000000000000]
KERNEL_FMT      [gzip]
RAMDISK_FMT     [gzip]
unknown/unsupported ASN.1 DER tag: 0x00
VBMETA
 

Files

dtb   kernel   ramdisk.cpio
 

kernel are gzipped for MTK device so decompress it and replace and repack it 


repacking

magiskboot repack boot.img boot-new.img

it takes new files from pwd



Comments

Popular posts from this blog

fedora install from container tarball

make system rw android

xdm linux merge incomplete download parts