[Guide]Flashing recoveries through terminal emulator (very easy)

LeslieAnn

Android Developer
Feb 8, 2011
2,895
1,720
0
This is a very fast and easy method to flash a recovery from inside your phone. Probably one of the fastest easiest methods out there.

Note that you need to be rooted first.


Preparation:
You need to put the recovery onto the root of your Sdcard.
Optional but highly recommended, rename the recovery "a.img", minus the quotes of course. This is easier to do on your computer and means a less typing on the phone. If you don't rename it, you will have to type out the entire name in step 2. The same applies if you have it in a sub-directory.

1. Open your emulator

2. type in, pressing enter after each line:
su
flash_image recovery /sdcard/a.img

3
. If you want to boot straight into recovery, type:
reboot recovery
 
Last edited:
It needs added to the reference guide that mmarz put together. These commands can also be run in a adb shell of-course.
 
It needs added to the reference guide that mmarz put together. These commands can also be run in a adb shell of-course.

I believe it is I thought I seen it there last nignt

Edit it is on mmarz guide.
Sent from my VM670 using Tapatalk
 
is this a optimus specific command or is it universal?

The only thing it requires is that the binary program flash_image has been added to your phone. You probably added it when you rooted the phone (or it's part of your ROM).

However, if you get an error message that this command is not found, you can do this:

Code:
find / -name flash_image

And it will print the full pathname of flash_image. i.e. if it prints "/bin/flash_image" then you can just substitute that in the original command.

But if you don't have flash_image installed anywhere, you can download it from one of the threads here and put in on your phone. i.e. if you've copied it onto /sdcard and want to put it in /system/bin, do this:

Code:
mount -o rw,remount /dev/block/mtdblock5 /system  # remount /system rw
cp /sdcard/flash_image /system/bin/flash_image    # copy flash_image to /system/bin
chmod 755 /system/bin/flash_image                 # chmod flash_image executable
mount -o ro,remount /dev/block/mtdblock5 /system  # remount /system ro
 
  • Like
Reactions: Froggy the Great
Re: [Guide]Flashing recoveries through terminal emulator (very ea

Is it possible to put flash_image in system/bin with a file explorer app once you have root or is there something I'm missing? That seems like a pretty simple way of doing it.
 
Re: [Guide]Flashing recoveries through terminal emulator (very ea

That's funny, I was just thinking I need to copy the terminal emulator process to flash recovery, so I can just paste it when I need to explain it. I'm no genius like some of you, but that's one thing I can explain to people, and I like to do what I can to help
 
Re: [Guide]Flashing recoveries through terminal emulator (very ea

Is it possible to put flash_image in system/bin with a file explorer app once you have root or is there something I'm missing? That seems like a pretty simple way of doing it.

You can move it that way, but you still need to use Terminal or adb to give the file the proper permissions:

adb:
adb shell chmod 755 /system/bin/flash_image

Terminal:
su
chmod 755 /system/bin/flash_image
 
Re: [Guide]Flashing recoveries through terminal emulator (very ea

You can move it that way, but you still need to use Terminal or adb to give the file the proper permissions:

adb:
adb shell chmod 755 /system/bin/flash_image

Terminal:
su
chmod 755 /system/bin/flash_image


Awesome, thanks!
 
Re: [Guide]Flashing recoveries through terminal emulator (very ea

i tried the steps as listed and got this message???
usage: flash_image partition file.img
i tried that syntax and got error -1
what did i do wrong
 
Re: [Guide]Flashing recoveries through terminal emulator (very ea

Rename the rile to remove the space in the name.
 
  • Like
Reactions: dlaxtn2
Re: [Guide]Flashing recoveries through terminal emulator (very ea

now it says failed with error -1 and cant find partition after i renamed the file
 
Re: [Guide]Flashing recoveries through terminal emulator (very ea

what partition is it refeering too
 
hmm, I do cat /proc/mtd
you should see "recovery"
I change file permissions in esexplorer too. I can long press in terminal to paste in windows.
if you need to reenter a command use control (vol-up[for me]) + w which is like pressing up to go through previous commands.
 
Re: [Guide]Flashing recoveries through terminal emulator (very ea

error -1 you are not typing partition type correctly prolly. do not use quotes:
flash_image recovery /sdcard/yourfile.img
 
Re: [Guide]Flashing recoveries through terminal emulator (very ea

backup via cat /dev/mtd/mtd2 > /sdcard/file.img
 

Forum statistics

Threads
955,360
Messages
6,964,542
Members
3,163,260
Latest member
eaglealtflow