[GUIDE] Flash any recovery easily on the phone using flash_image

Search This thread

Nipqer

Senior Member
Mar 14, 2011
904
391
Asus Zenfone 9
No idea if you can use flash_image, but if you have eng hboot, you can flash boot.img via fastboot, not sure if you can flash system as well.

-Nipqer
 

CaliEskimo

New member
Aug 9, 2012
1
0
Where did I go wrong??

while using the instructions to flash my LG Optimus V I ran into a problem(see screenshot). I am a ubernoob to using Terminal Shell and alot of Linux commands...this is not the same by a long shot to Windows CMD or Cisco commands! Please, somebody tell me where I went wrong, I would really like to flash and install [RECOVERY] Cannibal Open Touch v2.1 for my Optimus V VM670 2.2.2 :eek:
 

Attachments

  • 1356665433002.jpg
    1356665433002.jpg
    96.9 KB · Views: 267

demkantor

Inactive Recognized Contributor
Nov 10, 2011
6,860
3,765
mpls
Wrong thread by the way, you will get more help in your lg thread.
But to put you on the right track
Load recovery of choice image on the root of Sdcard, rename it to recovery.img
Now in terminal
su
flash_image recovery /sdcard/recovery.img
reboot recovery

If you can flash through fastboot this is ideal, not sure how your phone works as I've never touched one, I'm sure if out go to the proper thread you will find more help


Sent from my Nexus 7 using xda premium
 

emap85

Senior Member
Oct 17, 2007
98
11
Roma
Hi i have tried this procedure, because my USB connector is brake, and i need to restore my galaxy nexus to stock.

But when i type flash_image recovery recovery.img i have an error: "coudnt find the recovery partition"

I have tried to put the recovery.img in system/bin but i have the same error...

Any suggestion??
Thanks

sorry for bad english :silly:
 

demkantor

Inactive Recognized Contributor
Nov 10, 2011
6,860
3,765
mpls
As long as your using an HTC vision...
Put the recovery on the root of sdcard (not in any folder) name it recovery.img
Open terminal
su
flash_image recovery /sdcard/recovery.img
But it tends to be best to use fastboot

Sent from my Nexus 7 using xda premium
 

deflemonkid

Member
Aug 6, 2013
17
2
when i get the final stage and put in flash_image recovery recovery.img i get this error message

"[1] Illegal instruction flash_image recovery /sdcard/recovery.img"

Any ideas where i'm going wrong???
 

demkantor

Inactive Recognized Contributor
Nov 10, 2011
6,860
3,765
mpls
Sounds like you don't have the flash_image binary, also double check you typed everything in correctly and gave the command superuser permissions

Sent from my Nexus 4 using xda premium
 

deflemonkid

Member
Aug 6, 2013
17
2
Sounds like you don't have the flash_image binary, also double check you typed everything in correctly and gave the command superuser permissions

Sent from my Nexus 4 using xda premium

I've tried several different downloads of the FI binary, tried giving 755 permissions instead of 777. Tried it via a terminal app as well as via the adb command line from my computer and still no luck.
 

demkantor

Inactive Recognized Contributor
Nov 10, 2011
6,860
3,765
mpls
Are you rooted? Are you using a HTC vision? If so write down everything on bootloader screen

Sent from my Nexus 4 using xda premium
 

jpradley

Senior Member
Jul 6, 2010
331
29
92
New York
I do have SU on my iVerizon model HTC one.
Getting on the phone with adb shell, running su, and then running "flash_image recovery recovery.img" always craps out with "error scanning partition". What partition is it not finding, or able to deal with?
 

demkantor

Inactive Recognized Contributor
Nov 10, 2011
6,860
3,765
mpls
If your using adb shell you would need to either cd to location where recovery.img is in stalled or add it to path

Sent from my Nexus 4 using XDA Premium 4 mobile app
 

Morke

Member
Feb 28, 2015
25
0
Sorry for reviving an old thread but im desperate
My phone is stuck in safe mode and I can't get it out. Therefor I can't use any third apps
I can't get into download mode (when I press the vol + key while turning the phone on, it just shows me the 100% charging animation) and it doesn't go into bootloader
Im trying to flash the recovery to get inot recovery but when I type the last command, flash_recovery recovery /sdcard/recovery.img it gives me "error scanning partitions: no such file or directory"

What should I do?
I own a LG g2
Thanks in advance
 

bradley_e_smith

Senior Member
Oct 19, 2009
715
122
Florida
Samsung Galaxy Z Flip3
Sorry for reviving an old thread but im desperate
My phone is stuck in safe mode and I can't get it out. Therefor I can't use any third apps
I can't get into download mode (when I press the vol + key while turning the phone on, it just shows me the 100% charging animation) and it doesn't go into bootloader
Im trying to flash the recovery to get inot recovery but when I type the last command, flash_recovery recovery /sdcard/recovery.img it gives me "error scanning partitions: no such file or directory"

What should I do?
I own a LG g2
Thanks in advance

If you have an LG g2 - you are in the wrong forum, this is for HTC desire Z or a T-mobile HTC G2 (not the same phone).

good luck.
 

Ascii3

Senior Member
Sep 17, 2015
230
66
flash_image is not a new tool, it has been used on Android since the beginning, many custom ROMs include the utility as part of the ROM itself though not all stock ROMs (including the stock ROM on the G2) include it.
Is the flash_image tool part of Android Open Source Project?

Should one be careful regarding what version of the tool to use?
 
Is the flash_image tool part of Android Open Source Project?

Should one be careful regarding what version of the tool to use?


You have an HTC/T-Mobile G2 or HTC Desire Z? That's what this post was originally written for (almost 5 years ago). I don't claim it's applicable to any other device.

I don't know if flash_image is part of AOSP.

In general terms I don't know for sure how important the version of flash_image is but I would think you would want to stay in the same general Android family, for example don't try to use an Android 4.4 flash_image on an Android 5.0 ROM.
 

Ascii3

Senior Member
Sep 17, 2015
230
66
You have an HTC/T-Mobile G2 or HTC Desire Z? That's what this post was originally written for (almost 5 years ago). I don't claim it's applicable to any other device.
I do not have an HTC device. There have been others external to XDA that have posted your excellent method, but not particular to HTC devices.

I don't know if flash_image is part of AOSP.
In general terms I don't know for sure how important the version of flash_image is but I would think you would want to stay in the same general Android family, for example don't try to use an Android 4.4 flash_image on an Android 5.0 ROM.
That was my thought as well. The various sources that provide the flash_image tool do not mention the version of the tool on necessary compatibility with Android versions, nor where they come from.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 16
    Background

    To update (flash) a recovery image onto your phone allows you to update or replace your recovery environment on your phone. There are a number of ways to flash a new recovery image, some of the more commonly used methods are using a tool such as ROM Manager or using development tools such as Fastboot. There is also a third method using a standalone utility "flash_image" which allows the flashing of recovery using the terminal emulator on the phone.

    flash_image is not a new tool, it has been used on Android since the beginning, many custom ROMs include the utility as part of the ROM itself though not all stock ROMs (including the stock ROM on the G2) include it.

    Requirements

    1. A permanently rooted (with S-OFF) phone
    2. The flash_image binary
    3, A recovery image that is compatible with your phone and ROM
    3. A terminal emulator application on the phone or use of an ADB shell

    Overview:
    1. Get the flash_image binary and recovery image onto your phone
    2. Copy or move the flash image binary to your system and make executable
    3. Use flash_image to update your recovery environment

    Stage 1: Get flash_image and recovery image on your phone

    1. Download the flash_image binary (not needed if you are running a custom ROM that includes this binary)
    2. Download the recovery image you wish to use

    You can either directly download the files onto your phone or onto your PC and transfer to your phone. Probably the easiest way to do this is to connect your phone to your computer via USB and mount USB storage, then copy the files to your SD Card. Alternatively you can use ADB Push, bluetooth file transfer or several other methods.

    Stage 2: Copy or move the flash image binary to your system and make executable

    In terminal emulator:
    su
    mount -o remount, rw /system
    cd /sdcard (or wherever you downloaded/copied the file)
    cp flash_image /system/bin
    cd /system/bin
    chmod 777 flash_image

    Stage 3: use flash_image to update your recovery environment

    In terminal emulator:
    su (not needed if using the same terminal session used in the steps above)
    cd /sdcard (or wherever you downloaded/copied the recovery image)
    flash_image recovery recovery.img (use the appropriate file name for the image file you are flashing)

    Reboot into recovery and verify that the correct recovery environment is installed

    Notes

    Any of the commands that call for using a terminal emulator on the phone should work fine using an ADB shell if you prefer.

    This was tested on G2 but I can't think of why it would not work on Desire Z or any other phone for which this version of flash_image works. Obviously different phones have different compatible recovery images.

    I've attached a zip file containing the flash_image binary that I extracted from the CM 6.1 update zip. I suspect most custom ROMs already have flash_image.

    If you are wondering "Why should I use this method over using ROM Manager?" you could be using a recovery image that ROM manager doesn't support, for example ClockWorkMod Recovery 3.x which is required for some experimental ROMs.

    If you are wondering "Why should I use this method over using fastboot?" The two main reasons are you can't use fastboot if you are not with a computer with working ADB and using fastboot requires that you have previously flashed the engineering HBOOT.

    This is my first guide so I'm open to suggestions or feedback.
    1
    Not sure that's actually quicker, at least I don't think it would be for me, especially if you are changing recoveries with any frequency (like if tying out Gingerbread ROMs then going back to a 2.2 ROM) because you'd need to constantly rename your recovery images. With my method you would only need to leave the two files named as they are, or for expediency you could rename to recovery.img and recovery3.img then when you wanted to switch you could just execute:

    flash_image recovery recovery.img

    or

    flash_image recovery recovery3.img

    Depending on which recovery you wanted at that point & time.

    As I said in the guide, there are already a number of options available, using ROM Manager and fastboot are the most commonly seen in guides but your method and mine are other options for people for whom they work better. :)