Asus Max M2 ZB632KL

::

:: file create by liunianliang for windows fastboot flash image

::

:: 20180629

::

@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 cmd_path=%~dp0

@set local_path=%cd%

@set android_double_par=boot system vendor

@set android_one_par=userdata cache recovery splashkernel splashlk splashlowbattery splashsocbattery APD asusfw

@set qcom_double_par_1=modem:NON-HLOS.bin sbl1 rpm tz devcfg dsp:adspso.bin

@set qcom_double_par_2=aboot:emmc_appsboot.mbn dtbo vbmeta lksecapp cmnlib:cmnlib_30.mbn

@set qcom_double_par_3=cmnlib64:cmnlib64_30.mbn keymaster:keymaster64.mbn

@if !input! == 0 (

@echo Earse Data: No

) else (

@echo Earse Data: Yes

)

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

@echo Support All device !

fastboot devices > %~dp0devices.txt

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

set “deviceId=%%m”

)

) else (

@echo Support one device: !deviceId!

)

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

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

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

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

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

set “buildtype=%%a”

@echo buildtype is !buildtype!

)

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

set “secret_key=%%k”

set /p =!secret_key!<nul> %~dp0default_key.bin

)

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

set “frp-partition=%%m”

)

@for /f “tokens=2 delims=: ” %%i in (%~dp0current-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! %~dp0default_key.bin

fastboot -s !deviceId! flashing unlock

fastboot -s !deviceId! flashing unlock_critical

)

call:flash

if !buildtype! == user (

fastboot -s !deviceId! flashing lock

fastboot -s !deviceId! flashing lock_critical

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

fastboot -s !deviceId! flash !frp-partition! %~dp0default_key.bin

) else (

fastboot -s !deviceId! oem lock_frp

)

)

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

)

@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

)

) else (

call:flash_one_image %%p %%p.img

)

)

@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 %~dp0!a!.elf (

set Z=!a!.elf

)

if exist %~dp0!a!.mbn (

set Z=!a!.mbn

)

if exist %~dp0!a!.img (

set Z=!a!.img

)

) else (

if exist %~dp0!b! (

set Z=!b!

)

)

if “!Z!” == “” (

@echo Can’t find a file flash to !a!

) else (

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

set suffix=_a _b

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

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

)

) else (

@echo flash_one_image !a! !Z!

call:flash_one_image !a! !Z!

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

@echo .

) else (

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

@echo no dsp bak partition

)else (

call:flash_one_image !a!bak !Z!

)

)

)

)

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 %1 == userdata (

::@cd !cmd_path!

::@echo —–generate_image %2

::generate_image %2

::@cd !local_path!

::)

::@if %1 == system (

::@cd !cmd_path!

::@echo —–generate_image %2

::generate_image %2

::@cd !local_path!

::)

::@if %1 == vendor (

::@cd !cmd_path!

::@echo —–generate_image %2

::generate_image %2

::@cd !local_path!

::)

::@if %1 == cache (

::@cd !cmd_path!

::@echo —–generate_image %2

::generate_image %2

::@cd !local_path!

::)

@if exist %~dp0%2 @(

fastboot -s !deviceId! flash %1 %~dp0%2

) else (

@echo can’t flash partion %1

)

@echo done!

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

goto:eof

:: not flash userdata

:skip

@echo not earse data partition…

GET 1 USD FOR LINK DOWNLOAD

NOTE: contact via email [email protected] , i will sent link download for you

More from my site