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

LeslieAnn

Android Developer
Feb 8, 2011
2,895
1,720
0
Visit site
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:

picasticks

Well-known member
Feb 28, 2011
136
58
0
Visit site
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

bigcat73

Well-known member
Jun 8, 2011
61
2
0
Visit site
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.
 

pbailey212

Well-known member
Mar 20, 2011
765
219
0
Visit site
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
 

JerryScript

Daydream Believer
Mar 8, 2011
2,055
1,559
0
Visit site
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
 

bigcat73

Well-known member
Jun 8, 2011
61
2
0
Visit site
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!
 

dlaxtn2

Member
Apr 21, 2011
24
0
0
Visit site
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
 

dlaxtn2

Member
Apr 21, 2011
24
0
0
Visit site
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
 

fenrix

Well-known member
Aug 30, 2011
210
21
0
Visit site
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.
 

fenrix

Well-known member
Aug 30, 2011
210
21
0
Visit site
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
 

fenrix

Well-known member
Aug 30, 2011
210
21
0
Visit site
Re: [Guide]Flashing recoveries through terminal emulator (very ea

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

Trending Posts

Forum statistics

Threads
942,405
Messages
6,913,932
Members
3,158,399
Latest member
pauloxcavalcante