What is Boot Image Flasher?
Boot Image Flasher is a shell script designed to simplify the process of flashing boot and init_boot images on Android devices, supporting both A/B and legacy (non-A/B) devices. Typically, flashing these images involves using custom recovery or fastboot, which can be complex and time-consuming. Furthermore many devices lack custom recovery support, and accessing fastboot often requires a PC. Boot Image Flasher addresses this issues by providing a straightforward, efficient, and user-friendly solution for Android enthusiasts and developers that operates directly on the device. The core functionality and image flashing logic of this script is based on Magisk’s utility functions. Other well-known rooting applications like KernelSU and APatch also use the same approach.
figlet
, file
and ncurses-utils
need to be installed if not already available.cd
. For example:
cd /storage/emulated/0/Download
curl -s https://raw.githubusercontent.com/gitclone-url/Boot-img-flasher/master/boot-img-flasher.sh -o boot-img-flasher.sh && { command -v tput >/dev/null && command -v figlet >/dev/null && command -v file >/dev/null || pkg install -y figlet file ncurses-utils; } && { command -v sudo >/dev/null || pkg install -y tsu; }
Note: It may take some time for the script to be downloaded, along with the required tools. Please be patient.
Basic usage:
boot-img-flasher.sh [-h|--help]
boot-img-flasher.sh <IMAGE_PATH> --image-type <TYPE>
Options:
-h
, --help
Display help message with usage information.-t
, --image-type
Manually specify the type of image to flash.Arguments:
<IMAGE_PATH>
Path to the boot or init_boot image file.<TYPE>
Must be either boot
or init_boot
.Flash an image by providing the image path and it’s type:
sudo bash boot-img-flasher.sh /path/to/boot.img --image-type boot
Flash an image from current directory by only specifying type:
sudo bash boot-img-flasher.sh -t init_boot
Or flash by only specifying path (type will be auto-determined):
sudo bash boot-img-flasher.sh /path/to/init_boot.img
Flash an image from current directory without providing any argument:
sudo bash boot-img-flasher.sh
Once flashing process is completed you may restart your device.
boot_flasher.zip
from here.boot.img
or init_boot.img
file inside the created folder.Note: It is recommended to properly name the image file as with either
boot
orinit_boot
to avoid errors, as the script may not always auto-detect the image type if not specified.
Below are some screenshots demonstrating the Boot Image Flasher in action:
Some GSIs (Generic System Images) based on PHH come with prebuilt root access, meaning the su
binary is already included in the system. If you are using one of those GSIs and your phone is not actually rooted with Magisk or other root providers, you can just patch the boot/init_boot image of your phone and then flash the patched image using this script, with root permissions granted through the PHH Superuser App. This way, you can easily root using Magisk or other rooting apps just by using your device without needing additional tools, a PC, or any hassles.
Note: For patching the boot or init_boot image, you can use either Magisk or APatch app.
For information about GSIs, check the FAQ and choose your specific GSI image from here.
This script is intended for advanced users only. Improper use of this script can lead to device bricking, data loss, or other serious issues. The author is not responsible for any damage or data loss resulting from the misuse of this script. Proceed at your own risk, with caution, and follow the instructions carefully.
Special thanks to topjohnwu for Magisk and its general utility functions.
Boot Image Flasher is distributed under the terms of the MIT License.
Contributions are welcome. Please fork the repository, make your modifications, and submit a pull request. For more detailed guidelines, see our Contribution Guidelines.
For support, inquiries, or suggestions, contact the developer via Telegram.