Untitled
Untitled
@setlocal enabledelayedexpansion
:: get platform
@set platform=sdm636
@set buildtype=eng
@set current-slot=a
@set frp-partition=QHYBSBJk
@set input=%1%
@set deviceId=%2%
@set flashtype=%3%
if !input! == 0 (
@echo Earse Data: No
) else (
@echo Earse Data: Yes
)
if "!deviceId!" == "" (
@echo Support All device !
) else (
@echo Support one device: !deviceId!
)
if "!deviceId!" == "" (
@fastboot getvar platform 2>&1 | findstr platform > %~dp0\platform.txt
@fastboot getvar current-slot 2>&1 | findstr current-slot > %~dp0\current-slot.txt
@fastboot getvar build-type 2>&1 | findstr build-type > %~dp0\build-type.txt
@fastboot getvar secret-key-opt 2>&1 | findstr secret-key-opt > %~dp0\secret-key-
opt.txt
@fastboot oem get_random_partition 2>&1 | findstr bootloader > %~dp0\frp-
partition.txt
) else (
@fastboot -s !deviceId! getvar platform 2>&1 | findstr platform > %~dp0\
platform.txt
@fastboot -s !deviceId! getvar current-slot 2>&1 | findstr current-slot > %~dp0\
current-slot.txt
@fastboot -s !deviceId! getvar build-type 2>&1 | findstr build-type > %~dp0\build-
type.txt
@fastboot -s !deviceId! getvar secret-key-opt 2>&1 | findstr secret-key-opt >
%~dp0\secret-key-opt.txt
@fastboot -s !deviceId! oem get_random_partition 2>&1 | findstr bootloader > %~dp0\
frp-partition.txt
)
if !input! == 0 (
@echo not earse data partition...
) else (
call:flash_one_image userdata userdata.img
)
if !buildtype! == user (
if "!deviceId!" == "" (
fastboot flashing lock
fastboot flashing lock_critical
if !flashtype! == tool (
fastboot flash !frp-partition! %~dp0\default_key.bin
)
) else (
fastboot -s !deviceId! flashing lock
fastboot -s !deviceId! flashing lock_critical
if !flashtype! == tool (
fastboot -s !deviceId! flash !frp-partition! %~dp0\default_key.bin
)
)
)
if "!deviceId!" == "" (
if !input! == 0 (
@echo not do factory reset...
) else (
fastboot oem recovery_and_reboot
)
) else (
if !input! == 0 (
@echo not do factory reset...
) else (
fastboot -s !deviceId! oem recovery_and_reboot
)
)
)