@echo off
cls
echo             /TWRP recovery for RK3026/
echo.                      
echo /_______________________________________________________/
echo.
echo                     -!Read this!-
echo.
echo Be sure that you have checked this points :
echo - on you computer : install rockchip usb driver
echo - on your phone : enabled USB Debuging in
echo Settings-Developer options-USB debugging on your eBook
echo.
echo If you meet this requirements, you can go, _PRESS ENTER_
echo.
pause
cls
echo.
adb.exe devices
echo.
pause
echo.
echo                     -!Read this!-
echo.
@ECHO off
cls
:start
echo Choose the recovery you want to flash:
ECHO 1. Backup Recovery from eBook
ECHO 2. Flashing TWRP Recovery v.2.8.1.0
echo -----------------------------------
ECHO 3. Restore from Backup Recovery

echo.
set /p choice=Type the number:
if not '%choice%'=='' set choice=%choice:~0,1%
if '%choice%'=='1' goto backup
if '%choice%'=='2' goto twrp
if '%choice%'=='3' goto restore

ECHO.
ECHO "%choice%" is not valid please try again
ECHO.
goto start
:backup
ECHO.
ECHO Create Backup Recovery
ECHO.
adb remount
adb push su /system/xbin/su
adb shell chmod 776 /system/xbin/su
adb shell su -c "mkdir /sdcard/tmp/"
adb shell su -c "dd if=/dev/block/mtd/by-name/recovery of=/sdcard/tmp/recovery.img bs=33554432"
adb pull /sdcard/tmp/recovery.img backup.img
adb shell su -c "rm -rf /sdcard/tmp/recovery.img"
pause
cls
goto start
:twrp
ECHO.
ECHO Trying to flash TWRP Recovery v.2.8.1.0
ECHO.
adb remount
adb push su /system/xbin/su
adb shell chmod 776 /system/xbin/su
adb shell su -c "mkdir /sdcard/tmp/"
adb push twrp.img /sdcard/tmp/recovery.img
adb shell su -c "dd if=/sdcard/tmp/recovery.img of=/dev/block/mtd/by-name/recovery"
adb shell su -c "rm -rf /sdcard/tmp/recovery.img"
goto end
:boyue
ECHO.
ECHO Trying to flash Boyue recovery
ECHO.
adb remount
adb push su /system/xbin/su
adb shell chmod 776 /system/xbin/su
adb shell su -c "mkdir /sdcard/tmp/"
adb push boyue.img /sdcard/tmp/recovery.img
adb shell su -c "dd if=/sdcard/tmp/recovery.img of=/dev/block/mtd/by-name/recovery"
adb shell su -c "rm -rf /sdcard/tmp/recovery.img"
goto end
:onyx
ECHO.
ECHO Trying to flash Onyx Recovery
ECHO.
adb remount
adb push su /system/xbin/su
adb shell chmod 776 /system/xbin/su
adb shell su -c "mkdir /sdcard/tmp/"
adb push onyx.img /sdcard/tmp/recovery.img
adb shell su -c "dd if=/sdcard/tmp/recovery.img of=/dev/block/mtd/by-name/recovery"
adb shell su -c "rm -rf /sdcard/tmp/recovery.img"
goto end
:restore
ECHO.
ECHO Trying to flash Backup Recovery
ECHO.
adb remount
adb push su /system/xbin/su
adb shell chmod 776 /system/xbin/su
adb shell su -c "mkdir /sdcard/tmp/"
adb push backup.img /sdcard/tmp/recovery.img
adb shell su -c "dd if=/sdcard/tmp/recovery.img of=/dev/block/mtd/by-name/recovery"
adb shell su -c "rm -rf /sdcard/tmp/recovery.img"
goto end
:end
echo.
pause
echo.
echo If every operation is OKAY, installation is nearly completed. 
echo if you have some "cannot load *.img", run the tool again.
echo.
rem echo Remember that to boot in recovery mode you need to start
rem echo the tablet with Power button + Vol. down (farthest from power button)
echo.
echo _PRESS ENTER_ to exit and Enjoy custom recovery :-)
echo.
pause
exit

