Boot-img-flasher

Boot Image Flasher

Boot Image Flasher

Detailed Explanation

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.

Key Features

Prerequisites

Methods of Use

Method 1: Via Termux

  1. Open Termux on your Android device.
  2. Navigate to the directory where you want to download the script using cd. For example:
    cd /storage/emulated/0/Download
    
  3. Download the script and necessary tools using the following command:
    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.

Running the Script:

Basic usage:

   boot-img-flasher.sh [-h|--help]

  boot-img-flasher.sh <IMAGE_PATH> --image-type <TYPE>

Options:

Arguments:


Examples of Use:

  1. 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
    
  2. 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
    
  3. 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.

Method 2: Magisk

  1. Download boot_flasher.zip from here.
  2. Extract the archive using an app like ZArchiver.
  3. After extracting, copy and paste your boot.img or init_boot.img file inside the created folder.
  4. Select all files inside the folder and archive them as a zip.
  5. Install the zip as a Magisk module.
  6. Restart your device.

Note: It is recommended to properly name the image file as with either boot or init_boot to avoid errors, as the script may not always auto-detect the image type if not specified.

Preview

Below are some screenshots demonstrating the Boot Image Flasher in action:

Preview 1 Preview 2

Additional Information

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.

Disclaimer

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.

Credits

Special thanks to topjohnwu for Magisk and its general utility functions.

License

Boot Image Flasher is distributed under the terms of the MIT License.

Contributing

Contributions are welcome. Please fork the repository, make your modifications, and submit a pull request. For more detailed guidelines, see our Contribution Guidelines.

Contact

For support, inquiries, or suggestions, contact the developer via Telegram.