So I've recently rooted my phone and tried a ROM or two. I find it really handy that you can use TWRP recovery to install another ROM from the SD card, you don't need to have it connected to a PC.

However, on my device (HTC One S) I need to flash a different boot.img file for every ROM as well, so I still need to hook my phone up to my PC to switch ROMs. If I don't do this, it just gets stuck on the loading screen. Then I must use the command

fastboot flash boot boot.img

from the folder where boot.img is located.

Is it possible to flash this boot image with TWRP or any other way without using fastboot over USB?

3 Answers 3


What needs to be done is to bundle the boot.img and construct a new zip file suitable for flashing via ClockworkMod or TWRP.


  • a Linux environment that has the usual development packages, such as Java installed. (It can also apply to other platforms, just be careful that the instructions here indicating the path used below, uses a forward slash /, so flip that around to be a back slash \ for Windows environment especially!)
  • adb command line tool installed.
  • `testsign.jar' tool, for signing the zip file so that the recovery can authenticate and verify it is a valid archive otherwise recovery will report corrupt archive or similar.
  • update-binary command line application, that is internal for usage with the flashable script. (This can be found with any flashable zip, the important thing is to extract that binary and deposited in the structure of the directory as shown)
  • zip command line tool.

Assuming your directory is called workdir, for discussion, lets call this the working directory, copy the boot.img into that directory, and create the following directory structure - META-INF/com/google/android, this is important! And within the META-INF/com/google/android, copy the binary application called update-binary into that directory. So the directory structure should be like this:

+ workdir/
     +--+ boot.img
     +--+ META-INF/
              +--+ com/
                    +--+ google/
                           +--+ android/
                                   +--> update-binary
                                   +--> updater-script

As for the updater-script, copy the contents of the following below:

ui_print("Please wait, boot.img being flashed...");
show_progress(0.1, 0);
assert(package_extract_file("boot.img", "/tmp/boot.img"),
       write_raw_image("/tmp/boot.img", "boot"),
show_progress(0.1, 10);
ui_print("It is now safe to reboot! :)");

Remember: Do not get confused here, the updater-script as shown, should be left alone and as-is, so do not try flip the forward-slash to a back slash if doing this under Windows environment.

Go back to the parent of the directory structure, i.e. outside of workdir and do the following, we're going to create a zip file from this:

zip -r my_custom_flashable_boot_unsigned.zip workdir/ which is a recursive function, this will zip up everything into the file called my_custom_flashable_boot_unsigned.zip.

Finally, to sign the zip file, issue this:

java -classpath testsign.jar testsign my_custom_flashable_boot_unsigned.zip my_custom_flashable_boot_signed.zip

Then its a matter of pushing that across the SDCard as in adb push my_custom_flashable_boot_signed.zip /sdcard/ and manually go into recovery and specify that zip archive (i.e. my_custom_flashable_boot_signed.zip) in which it will perform the flashing for you.

  • Nice, I like to create stuff myself so excellent instructions. It's not a point that I'll need my computer for this, because I can just get flashable boot zips for all my ROMs on a folder of my SD card, which will lead to the situation I wanted.
    – MarioDS
    Dec 28, 2012 at 10:27

If you have the flash_image binary, then you can do it on device via terminal emulator (flash boot, then the rest using recovery).

Syntax: flash_image boot /sdcard/boot.img

Self Promotion Time

I have an app that provides a GUI for the binary. Find it here.

If you don't have that binary, it can be installed (Google it - you have to download it then copy it to the /system/bin folder.

This doesn't work on all devices, however it's the only way that springs to mind.

  • If I understand well, the terminal emulator is just a regular app that you run while your phone is booted in normal mode? Will it not give problems flashing boot while the OS is running?
    – MarioDS
    Dec 27, 2012 at 23:27
  • 1
    @MarioDeSchaepmeester The phone only uses boot while it boots ;)
    – Liam W
    Dec 27, 2012 at 23:45
  • Have had to downvote it, as flash_image has a requirement to be copied and invoked from the handset using adb shell, documentation (may I add, you failed to provide the linky!) is asking to remount the SDCard with exec bit set (*bad idea) and requires root i.e. su, further to that, the "self-promotion" in relation to your app, in euros, where I come from, is 6,09 euros which is pricey... fastboot is the norm, CM has their own quirky ways, - what's different with fastboot and flash_image?
    – t0mm13b
    Dec 28, 2012 at 2:00
  • Also the binary can be used without a computer.
    – Liam W
    Dec 28, 2012 at 9:29

Is it possible to flash this boot image with TWRP [...]?

rename the file boot.emmc.win and place it in TWRP/BACKUPS/ (create new folder). restore the backup from usual TWRP menu

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .