Untitled diff

Created Diff never expires
24 removals
89 lines
11 additions
75 lines
@ECHO OFF
@ECHO OFF
echo BY INSTALLING THE SOFTWARE, YOU ARE AGREEING TO BE BOUND BY THE BlackBerry
echo BY INSTALLING THE SOFTWARE, YOU ARE AGREEING TO BE BOUND BY THE BlackBerry
echo Solution License Agreement which can be reviewed at www.blackberry.com/leg-
echo Solution License Agreement which can be reviewed at www.blackberry.com/leg-
echo al/bbsla. IF YOU HAVE ANY QUESTIONS OR CONCERNS ABOUT THE TERMS OF THIS AG-
echo al/bbsla. IF YOU HAVE ANY QUESTIONS OR CONCERNS ABOUT THE TERMS OF THIS AG-
echo REEMENT, PLEASE CONTACT blackberry AT LEGALinfo@BLACKBERRY.COM. PLEASE READ
echo REEMENT, PLEASE CONTACT blackberry AT LEGALinfo@BLACKBERRY.COM. PLEASE READ
echo THIS DOCUMENT CAREFULLY BEFORE INSTALLING OR USING THE SOFTWARE.
echo THIS DOCUMENT CAREFULLY BEFORE INSTALLING OR USING THE SOFTWARE.
echo ***************************************************************************
echo ***************************************************************************
echo.
echo.
set BIN=.\host\windows-x86\bin
set BIN=.\host\windows-x86\bin
set IMG=.\img
set IMG=.\img
set FASTBOOT=fastboot.exe
set FASTBOOT=fastboot.exe


echo Note:If device is not in fastboot mode
echo Note:If device is not in fastboot mode
echo Please switch to fastboot mode by holding the power and volume down key for 30s
echo Please switch to fastboot mode by holding the power and volume down key for 30s
for /f "tokens=1 delims=" %%i in ('%BIN%\fastboot.exe getvar device 2^>^&1 ^| findstr device ') do (set var1=%%i)
for /f "tokens=1 delims=" %%i in ('%BIN%\fastboot.exe getvar device 2^>^&1 ^| findstr device ') do (set var1=%%i)
set devname=%var1:device:=%
set devname=%var1:device:=%
set devname=%devname: =%
set devname=%devname: =%
if "%devname%" == "" (
echo Failed to detect the device name
GOTO End
)
for /f "tokens=1 delims=" %%i in ('%BIN%\fastboot.exe getvar variant 2^>^&1 ^| findstr variant ') do (set var1=%%i)
set dev_variant=%var1:variant:=%
set dev_variant=%dev_variant: =%
if "%dev_variant%" == "" (
echo Failed to detect the device variant
GOTO End
)
for /f "tokens=1 delims=" %%i in ('%BIN%\fastboot.exe getvar subvariant 2^>^&1 ^| findstr subvariant ') do (set var1=%%i)
set dev_subvariant=%var1:subvariant:=%
set dev_subvariant=%dev_subvariant: =%
if not "%devname%" == "bbb100" (
if not "%devname%" == "bbb100" (
echo Loader is not valid for this device, the device product detected is %devname%%dev_variant%%dev_subvariant%.
echo Loader is not valid for this device, the device product detected is %devname%.
GOTO End
)
if not "%dev_variant%" == "usa" (
echo Loader is not valid for this device, the device product detected is %devname%%dev_variant%%dev_subvariant%.
GOTO End
)
if not "%dev_subvariant%" == "" (
echo Loader is not valid for this device, the device product detected is %devname%%dev_variant%%dev_subvariant%.
GOTO End
GOTO End
)
)
for /f "tokens=1 delims=" %%i in ('%BIN%\fastboot.exe getvar hlos-sig-tag 2^>^&1 ^| findstr hlos-sig-tag ') do (set var1=%%i)
for /f "tokens=1 delims=" %%i in ('%BIN%\fastboot.exe getvar hlos-sig-tag 2^>^&1 ^| findstr hlos-sig-tag ') do (set var1=%%i)
set devname=%var1:hlos-sig-tag:=%
set devname=%var1:hlos-sig-tag:=%
set devname=%devname: =%
set devname=%devname: =%
if not "%devname%" == "" (
if not "%devname%" == "" (
GOTO ERRORMSG
GOTO ERRORMSG
)
)


set /P answer=This script will wipe off all user data. Do you want to continue? [y/n]:
set /P answer=This script will wipe off all user data. Do you want to continue? [y/n]:
if "%answer%" == "n" ( GOTO End
if "%answer%" == "n" ( GOTO End
) else if "%answer%" == "y" ( GOTO COMMANDS
) else if "%answer%" == "y" ( GOTO COMMANDS
) else ( GOTO Error
) else ( GOTO Error
)
)
:COMMANDS
:COMMANDS
%BIN%\fastboot.exe oem securewipe
%BIN%\fastboot.exe oem securewipe
ECHO "It may take 5 to 15 minutes to securely wipe the device"
ECHO "It may take 5 to 15 minutes to securely wipe the device"
ping -n 5 127.0.0.1 > nul
ping -n 5 127.0.0.1 > nul
%BIN%\%FASTBOOT% flash tz %IMG%\tz.mbn
%BIN%\%FASTBOOT% flash tz %IMG%\tz.mbn
%BIN%\%FASTBOOT% flash devcfg %IMG%\devcfg.mbn
%BIN%\%FASTBOOT% flash devcfg %IMG%\devcfg.mbn
%BIN%\%FASTBOOT% flash rpm %IMG%\rpm.mbn
%BIN%\%FASTBOOT% flash rpm %IMG%\rpm.mbn
%BIN%\%FASTBOOT% flash sbl1 %IMG%\sbl1_signed.mbn
%BIN%\%FASTBOOT% flash sbl1 %IMG%\sbl1_signed.mbn
%BIN%\%FASTBOOT% flash aboot %IMG%\emmc_appsboot.mbn
%BIN%\%FASTBOOT% flash aboot %IMG%\emmc_appsboot.mbn
%BIN%\%FASTBOOT% flash bootsig %IMG%\boot.img.sig
%BIN%\%FASTBOOT% flash bootsig %IMG%\boot.img.sig
%BIN%\%FASTBOOT% flash recoverysig %IMG%\recovery.img.sig
%BIN%\%FASTBOOT% flash recoverysig %IMG%\recovery.img.sig
%BIN%\%FASTBOOT% flash boot %IMG%\boot.img
%BIN%\%FASTBOOT% flash boot %IMG%\boot.img
%BIN%\%FASTBOOT% flash recovery %IMG%\recovery.img
%BIN%\%FASTBOOT% flash recovery %IMG%\recovery.img
%BIN%\%FASTBOOT% flash cache %IMG%\cache.img
%BIN%\%FASTBOOT% flash cache %IMG%\cache.img
%BIN%\%FASTBOOT% flash userdata %IMG%\userdata.img
%BIN%\%FASTBOOT% flash userdata %IMG%\userdata.img
%BIN%\%FASTBOOT% flash modem %IMG%\NON-HLOS.bin
for /f "tokens=1 delims=" %%i in ('%BIN%\fastboot.exe getvar variant 2^>^&1 ^| findstr variant ') do (set var2=%%i)
set dev_variant=%var2:variant:=%
set dev_variant=%dev_variant: =%
if "%dev_variant%" == "" (
echo Failed to detect the device variant
GOTO End
) else (
%BIN%\%FASTBOOT% flash modem %IMG%\NON-HLOS-%dev_variant%.bin
)
%BIN%\%FASTBOOT% flash dsp %IMG%\adspso.bin
%BIN%\%FASTBOOT% flash dsp %IMG%\adspso.bin
%BIN%\%FASTBOOT% flash system %IMG%\system.img
%BIN%\%FASTBOOT% flash system %IMG%\system.img
%BIN%\%FASTBOOT% flash oem %IMG%\oem.img
%BIN%\%FASTBOOT% flash oem %IMG%\oem.img
%BIN%\%FASTBOOT% reboot
%BIN%\%FASTBOOT% reboot
GOTO End
GOTO End


:ERRORMSG
:ERRORMSG
if "%devname%" == "" set devname=common
if "%devname%" == "" set devname=common
echo.
echo.
echo Loader is not valid for this device variant, the device variant detected is %devname%.
echo Loader is not valid for this device variant, the device variant detected is %devname%.
echo Please obtain a loader which supports the device variant above and try again.
echo Please obtain a loader which supports the device variant above and try again.
GOTO End
GOTO End
:Error
:Error
ECHO Please enter y or n! Bye bye!!
ECHO Please enter y or n! Bye bye!!
:End
:End
echo Press any key to close this window
echo Press any key to close this window
pause >nul
pause >nul