www.chinaphonearena.com

Full Version: Linux and Windows adb recovery flasher
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This is a binary flasher I made to flash recoveries via adb, you need to have adb setup and working.

You need to set permissions to execute on flash_recovery, place flash_recovery in same folder as the recovery you want to flash, the recovery needs to be named recovery.img

you can flash your recovery.img just by clicking flash_recovery or you can open terminal and type ./flash_recovery

I have limited the size of the recovery that can be flashed, so TWRP can't be flashed via my flasher, I could remove the limit but due to recovery partition size on some phones, that would be dangerous to some phones, all phones can flash CWM recovery.

[Only registered and activated users can see links Click here to register]

If you run flash_recovery in terminal you will see below.

Code:
vampirefo@vampirefo-GA-MA78GM-US2H ~/Desktop/unpack_boot/rcf $ ./flash_recovery
adb recovery flasher by Vampirefo
5142 KB/s (6074368 bytes in 1.153s)
0+1 records in
0+1 records out
6074368 bytes transferred in 0.036 secs (168732444 bytes/sec)
vampirefo@vampirefo-GA-MA78GM-US2H ~/Desktop/unpack_boot/rcf $

This version should work for windows users, as they use .bat files rather than bash files.

Code:
@echo off
echo * adb recovery flasher by Vampirefo
echo.
echo * place this script and your recovery.img in the folder.
echo.
echo * Rename the recovery filename to recovery.img
echo.

if EXIST recovery.img (GOTO FOUND) else (GOTO END)

:FOUND
echo * recovery.img found.
echo.
adb\adb.exe shell "su -c 'mkdir /data/tmp/""
adb\adb.exe push recovery.img "/data/tmp/recovery.img"..
adb\adb.exe shell "su -c 'dd if=/data/local/recovery.img of=/dev/recovery bs=6291456 count=1'"
adb\adb.exe shell "su -c 'rm -r /data/tmp/'"
echo.
echo Done flashing. Restart in recovery mode to see if successful.

GOTO EXIT


:END
echo.
echo  !!ERROR: recovery.img not found!!
echo Make sure you renamed your desired recovery to recovery.img!
GOTO EXIT

:EXIT
echo.
echo Exiting script..
pause

also adb files needed for window users are included in zip

[Only registered and activated users can see links Click here to register]
Hi

Forgive me but I have an error or two

Code:
ls -al
total 5936
drwxr-xr-x 2 gordon gordon    4096 May 26 10:50 .
drwxr-xr-x 5 gordon gordon    4096 May 22 21:23 ..
-rwxrwxrwx 1 gordon gordon   11544 May 25 20:36 flash_recovery
-rw-r--r-- 1 gordon gordon    7622 Jan 30 10:53 MT6582_Android_scatter.txt
-rw-r--r-- 1 gordon gordon 6035456 Jan 30 15:17 recovery.img
gordon@box:/a/1ANDROID/1ROMS-STUFF/2-IO-CWM$ ls -alh recovery.img
-rw-r--r-- 1 gordon gordon 5.8M Jan 30 15:17 recovery.img
gordon@box:/a/1ANDROID/1ROMS-STUFF/2-IO-CWM$ adb kill-server
gordon@box:/a/1ANDROID/1ROMS-STUFF/2-IO-CWM$ adb start-server
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
adb devices -l
List of devices attached
0123456789ABCDEF       device usb:5-7 product:A9CL model:iOCEAN_X7 device:A9CL

gordon@box:/a/1ANDROID/1ROMS-STUFF/2-IO-CWM$ ./flash_recovery
./flash_recovery: _rS�'P��Bd�x�

2) Is there a md5sum for your zip in case I have a download error?

3) What is the byte size limitation placed on running this cool executable pls?

4) on size limitations the issue for TWRP, not that one exists for my device is IMHO this
I add the skip position in decimal to the size in decimal
if it gives me the next position in the flash device, or over runs it, I am likely 2 brick

By using your hex2dec link I have this hidden txt file
Where I write sequential......that is the risk ....IMHO

bottom line is the size of target recovery image must be less than dumchar....yes?

Show Content

thanks in advance for any time you can share on my error
b27ecc422ede95dbf727d241da5b033a /home/vampirefo/Desktop/unpack_boot/rcf/flash_recovery

limit 6291456

Could be my version of c, to make it easier, I will put it into a bash script.


Code:
#!/bin/bash
file="./recovery.img"
if [ -f "$file" ]
then
echo "adb recovery flasher by Vampirefo"
adb shell su -c "mkdir /data/tmp/"
adb push ./recovery.img "/data/tmp/recovery.img"
adb shell su -c "dd if=/data/tmp/recovery.img of=/dev/recovery bs=6291456c count=1"
adb shell su -c "rm -r /data/tmp/"
else
    echo "$file not found."
fi
Hi
Code:
$  md5sum flash_recovery
b27ecc422ede95dbf727d241da5b033a  flash_recovery

We have a match so my download was correct after all but
Quote:adb shell su -c "dd if=/data/tmp/recovery.img of=/dev/recovery bs=6291456c count=1"
You appear to have a c suffix at the end of the byte size?

2) Thankyou very much for personalizing your bs count to be my maximum

3) I had find how to get into iOcean rec mode=.connect data cable to PC....with phone off and hold power up button
I did not need to touch power button......there has to a way without PC surely.

4) modified script below works a treat.....as I wanted to see phone go directly into rec mode by adb command
Quote:#!/bin/bash
file="./recovery.img"
if [ -f "$file" ]
then
echo "adb recovery flasher by Vampirefo"
adb kill-server
adb start-server
adb shell su -c "mkdir /data/tmp/"
adb push ./recovery.img "/data/tmp/recovery.img"
adb shell su -c "dd if=/data/tmp/recovery.img of=/dev/recovery bs=6291456 count=1"
adb shell su -c "rm -r /data/tmp/"
adb reboot recovery
else
echo "$file not found."
fi

Woo Hoo

5) Me thinks Windows users could use your similar commands on their PC, as long as they have associated USB driver to Android device?

6) offtopic I know

Have you given any thought to using the same simple dd command for nvram?
(2014-05-26, 17:18)aus9 Wrote: [Only registered and activated users can see links Click here to register]