Bug 1288373 - Add missing task.h for NewRunnableFunction r=tzimmermann
[gecko.git] / b2g / installer / flash.bat
blob9b5093677de849e1fb7742ec97b6a75055d9614b
1 @ECHO OFF\r
2 \r
3 REM read config file\r
4 setlocal ENABLEDELAYEDEXPANSION\r
5 set loop=0\r
6 for /F "tokens=*" %%A in (.config) do (\r
7     SET /A loop=!loop! + 1\r
8     set %%A\r
9 )\r
11 set DEVICE_FOUND=0\r
13 REM nexus has device instead of product name\r
14 IF [%PRODUCT_NAME%]==[] (\r
15  set PRODUCT_NAME=%DEVICE%\r
16 )\r
18 REM if nexus 4 assume you are in fastboot mode, can't seem to find drivers \r
19 IF [%DEVICE%]==[mako] (\r
20 call :flash\r
21 )\r
23 REM push device from adb to fastboot mode\r
24 win_adb kill-server\r
25 win_adb devices\r
26 win_adb get-state > devicestate.txt\r
27 set /p DEVICE_STATE= < devicestate.txt\r
29 IF NOT "%DEVICE_STATE%"=="device" (\r
30    ECHO Please check :\r
31    ECHO 1. to make sure that only one device is connected to the computer\r
32    ECHO 2. the device is turned on with the screen showing\r
33    ECHO 3. the device is set to debugging via USB : ADB Only or ADB and Devtools\r
34    ECHO 4. the device drivers are installed on the computer.\r
35    Del devicestate.txt\r
36    PAUSE\r
37    EXIT /b\r
38 )\r
40 Del devicestate.txt\r
41 win_adb reboot bootloader\r
43 TIMEOUT 5\r
45 :flash\r
46 win_fastboot devices 2> fastboot_state.txt\r
47 set /p FASTBOOT_STATE= < fastboot_state.txt\r
49 IF NOT [%FASTBOOT_STATE%]==[] (\r
50    ECHO Please check :\r
51    ECHO 1. to make sure that only one device is connected to the computer\r
52    ECHO 2. the device is turned on with an indication that the device is in fastboot mode\r
53    ECHO 3. the fastboot drivers are installed on the computer.\r
54    Del fastboot_state.txt\r
55    PAUSE\r
56    EXIT /b\r
57 )\r
59 Del fastboot_state.txt\r
61 ECHO "Flashing build. If nothing mentions that it flashed anything and it looks stuck, make sure you have the drivers installed."\r
62 win_fastboot flash boot out/target/product/%PRODUCT_NAME%/boot.img\r
63 win_fastboot flash system out/target/product/%PRODUCT_NAME%/system.img\r
64 win_fastboot flash persist out/target/product/%PRODUCT_NAME%/persist.img\r
65 win_fastboot flash recovery out/target/product/%PRODUCT_NAME%/recovery.img\r
66 win_fastboot flash cache out/target/product/%PRODUCT_NAME%/cache.img\r
67 win_fastboot flash userdata out/target/product/%PRODUCT_NAME%/userdata.img\r
69 ECHO "Done..."\r
71 win_fastboot reboot\r
72 echo "Just close the windows as you wish."\r
73 TIMEOUT 5