There are various tools to unpack boot images of Android for windows, mac and linux. The most compatible is Android Image Kitchen tool which has been created by XDA recognized developer Osmosis. This is just one tool in his long list of tools. There are some situations when we need to unpack boot or recovery images to modify them or port them from another device having same chipset and almost same specifications.

Not everyone have a PC or Laptop to do this this kind of thing so some people look for ways to do it on their Android Phones. Once again Osmosis did a great job in making the Android Image Kitchen work on Android. Now you don't need PC to unpack or repack boot images. The only thing you need is a rooted device with a custom TWRP installed. If you have both, its very easy to unpack images , just like we do it on PC with Android Image Kitchen.

What you need ?

• A rooted android phone.
• Magisk 18.0 or later
• Terminal emulator / Root browser Classic installed.

Downloads

AIK- Mobile Installer Zip

Now there are two different ways which you can use to unpack boot imgs. First one involves the use of terminal emulator only and second only involves the use of Root Browser Classis app only. I am going tell you about both of them. Before we move to those steps , first we need to install AIK-Mobile Installer.


Installing Android Image Kitchen Tool

This doesn't require much work, all you have to do is open Magisk Manager and flash AIK-Mobile-Installer zip. You can also flash this zip through TWRP. After reboot we are ready to unpack boot/recovery imgs.
Lets learn about unpack/repack img methods.

Terminal Emulator Method

Before proceeding to unpacking boot/recovery imgs you need boot/recovery imgs first. When you have them, move the boot.img or recovery.img to /data/local/AIK-mobile directory using any root explorer app. You can unapack only one img at a time.

Proper Instructions
  • Move your boot.img or Recovery.img to /data/local/AIK-mobile directory.
  • Open Terminal emulator and then execute the following commands (italic words only) one by one -
    su (Grant root permission)
    aik
    sh unpackimg.sh (Script will automatically detect the boot.img in that directory)
  • After above command your boot.img will be extracted in the /data/local/AIK-mobile directory, you can see the extracted boot img in that directory with any root file explorer.
  • After you have done making changes or whtever you needed to do with extracted boot.img you may want to repack it again.
  • To repack the extracted boot.img again open the terminal emulator again and execute this command.
    sh repackimg.sh
  • Above command will repack the boot img again and you will see a new image-new.img in the same directory. This is the new boot.img, you can flash or do whatever you want with it now.
  • To cleanup the mess i.e the folders we get after unpack and repack of img , execute this command in terminal. This will also remove the image-new.img file.
    sh cleanup.sh
  • Done


Root Browser Method

This method is for those who don't want to write coomands again and again to unpack and repack imgs.
  • Open Root broswer classic app ,grant root permission and move your boot/recovery img to /data/local/AIK-mobile directory.
  • In AIK-mobile folder we have unpack , repack and clean shell script which are executable scripts.
  • If you want to unpack img , just tap on unpackimg.sh file ,you will see a script handler popup, checkmark the "execute script as root" and finally click on Execute button. You will see the unpacking process there.
  • To repack the img , tap on repackimg.sh file and then tap on execute button just like we did for unpacking the img. This will repack your img and you get new img named "image-new.img" as final result.
  • To clean up folders, tap on cleanup.sh and execute. This will clear all folders and files created after unpacking and repacking.
  • It's done :p

Thats it, if you have any doubts regarding this please comment here and I will try to help you.