needrom.top

Asus ZenFone Max Pro M1 (ZB602KL)

::

:: file create by liunianliang for windows fastboot flash image

::

:: 20181029

::

@echo off

@echo ————————

@echo Begin fastboot flashall

@echo ————————

@setlocal enabledelayedexpansion

@set current-slot=bak

@set buildtype=userdebug

@set frp-partition=QHYBSBJk

@set input=%1%

@set deviceId=%2%

@set flashtype=%3%

@set script_dir=%~dp0

@set local_dir=%cd%

@cd /d !script_dir!

@set android_double_par=boot system vendor

@set android_one_par=userdata cache recovery asusfw

@set qcom_double_par_1=modem:NON-HLOS.bin abl xbl rpm tz devcfg dsp:dspso.bin

@set qcom_double_par_2=cmnlib cmnlib64 hyp pmic mdtpsecapp mdtp

@set qcom_double_par_3=keymaster:keymaster64.mbn bluetooth:BTFM.bin storsec

@if !input! == 0 (

@echo Earse Data: No

) else (

@echo Earse Data: Yes

)

@if “!deviceId!” == “” (

@echo Support All device !

fastboot devices > devices.txt

@for /f “tokens=1” %%m in (devices.txt) do @(

set “deviceId=%%m”

)

) else (

@set run_frome_aft_tool=1

@echo Support one device: !deviceId!

)

@fastboot -s !deviceId! getvar current-slot 2>&1 | findstr current-slot > current-slot.txt

@fastboot -s !deviceId! getvar build-type 2>&1 | findstr build-type > build-type.txt

@fastboot -s !deviceId! oem get_random_partition 2>&1 | findstr bootloader > frp-partition.txt

@fastboot -s !deviceId! getvar secret-key-opt 2>&1 | findstr secret-key-opt > secret-key-opt.txt

@for /f “tokens=2 delims=: ” %%a in (build-type.txt) do (

set “buildtype=%%a”

@echo buildtype is !buildtype!

)

@for /f “tokens=2 delims=: ” %%k in (secret-key-opt.txt) do (

set “secret_key=%%k”

set /p =!secret_key!<nul> default_key.bin

)

@for /f “tokens=2 delims=: ” %%m in (frp-partition.txt) do (

set “frp-partition=%%m”

)

@for /f “tokens=2 delims=: ” %%i in (current-slot.txt) do @(

set “current-slot=%%i”

)

@echo current-slot is !current-slot!

if !current-slot! == a (

set “hassolt=true”

) else (

if !current-slot! == b (

set “hassolt=true”

) else (

set “hassolt=flase”

)

)

if !buildtype! == user (

fastboot -s !deviceId! flash !frp-partition! default_key.bin

fastboot -s !deviceId! flashing unlock

fastboot -s !deviceId! flashing unlock_critical

)

call:flash

if errorlevel 1 (

@exit /B 1

)

if !buildtype! == user (

fastboot -s !deviceId! flashing lock

fastboot -s !deviceId! flashing lock_critical

if “!flashtype!” == “tool” (

fastboot -s !deviceId! flash !frp-partition! default_key.bin

)

)

if !input! == 0 (

@echo not do factory reset…

) else (

fastboot -s !deviceId! oem recovery_and_reboot

)

@echo All is download

goto:eof

:: function for check

:flash

@for %%p in (%android_one_par%) do (

call:flash_one_image %%p %%p.img

if errorlevel 1 (

call:FAIL

@exit /B 1

)

)

@for %%p in (%android_double_par%) do (

if “!hassolt!” == “true” (

set suffix=_a _b

for %%s in (%suffix%) do (

call:flash_one_image %%p%%s %%p.img

if errorlevel 1 (

call:FAIL

@exit /B 1

)

)

) else (

call:flash_one_image %%p %%p.img

if errorlevel 1 (

call:FAIL

@exit /B 1

)

)

)

@for %%p in (%qcom_double_par_1% %qcom_double_par_2% %qcom_double_par_3%) do (

set str=%%p

for /f “tokens=1,2 delims=: ” %%i in (‘echo !str!’) do @(

set a=%%i

set b=%%j

if “!b!” == “” (

@echo use default file…

if exist !a!.elf (

set Z=!a!.elf

)

if exist !a!.mbn (

set Z=!a!.mbn

)

if exist !a!.img (

set Z=!a!.img

)

) else (

if exist !b! (

set Z=!b!

)

)

if “!Z!” == “” (

call:error 2 !a!

if errorlevel 1 (

@exit /B 1

)

) else (

if “!hassolt!” == “true” (

set suffix=_a _b

for %%s in (%suffix%) do (

call:flash_one_image !a!%%s !Z!

if errorlevel 1 (

call:FAIL

@exit /B 1

)

)

) else (

call:flash_one_image !a! !Z!

if errorlevel 1 (

call:FAIL

@exit /B 1

)

if “!a!” == “modem” (

@echo .

) else (

if “!a!” == “storsec” (

@echo .

) else (

if “!a!” == “dsp” (

@echo .

) else (

call:flash_one_image !a!bak !Z!

if errorlevel 1 (

call:FAIL

@exit /B 1

)

)

)

)

)

)

set a= b=

)

)

goto:eof

:: function for download

:flash_one_image

@echo ————————————————-

@if !input! == 0 @(

if “%1” == “userdata” (

call:skip

goto:eof

)

)

@echo begin to flash partition %1 with %2

@if exist %2 @(

fastboot -s !deviceId! flash %1 %2

if errorlevel 1 (

call:error 3 %1

)

) else (

call:error 1 %1 %2

)

@echo done!

@echo ————————————————-

goto:eof

:: not flash userdata

:skip

@echo not earse data partition…

goto:eof

:: error exit

:error

@if “%1” == “1” (

@echo can’t flash partion %2, %3 is not exist

)

@if “%1” == “2” (

@echo can’t flash partion %2, no file found to flash

)

@if “%1” == “3” (

@echo flash partition %2 fail, data transfers fail

)

@if “%1” == “4” (

@echo command run fail !!!

)

@if “%run_frome_aft_tool%” == “1” (

exit /B 1

) else (

pause

)

goto:eof

:: fail

:FAIL

@echo FLASH_FAIL

@echo All is download

goto:eof

@cd %local_dir%

NOTE : You can’t download pls sent email to kenfuang123@gmail.com , i will sent link download for you

AND PLEASE DONATE FOR ME, THANKS

Leave a Comment