Dos烧录脚本

Dos命令在此之前改动的太轻易,未来投入决断是或不是进入fasboot形式和剖断Android镜像是或不是存在;代码已经竭尽简化成这么,dos命令功用依然比较不好用的,用了一早上的时辰。。。

Dos烧录脚本。Dos烧录脚本,dos烧录

 1 @echo off
 2 
 3 
 4 
 5 @set flashpath=Z:\msm8909\out\target\product\msm8909\
 6 @set boot_image=%flashpath%boot.img
 7 @set mbn_image=%flashpath%emmc_appsboot.mbn
 8 @set system_image=%flashpath%system.img
 9 @set persist_image=%flashpath%persist.img
10 @set ramdisk_image=%flashpath%ramdisk.img
11 @set recover_image=%flashpath%recovery.img
12 @set cache_image=%flashpath%cache.img
13 
14 
15 @echo 1、烧录boot.img
16 @echo 2、烧录aboot.img
17 @echo 3、烧录persist.img
18 @echo 4、烧录ramdisk.img
19 @echo 5、烧录recovery.img
20 @echo 6、烧录system.img
21 @echo 7、烧录cache.img
22 @echo 8、烧录所有镜像
23 
24 @set /p option=请先设置路径后,再输入要烧录的选项:
25 
26 
27 adb wait-for-device
28 adb reboot-bootloader
29 
30 
31 
32 if "%option%" == "1" (
33 @echo 烧录boot.img........
34 fastboot flash boot %boot_image%
35 )
36 
37 if "%option%" == "2" (
38 @echo 烧录aboot.img........
39 fastboot flash aboot %mbn_image%
40 )
41 
42 if "%option%" == "3" (
43 @echo 烧录persist.img..........
44 fastboot flash persist %persist_image%
45 )
46 
47 if "%option%" == "4" (
48 @echo 烧录ramdisk.img..........
49 fastboot flash ramdisk %ramdisk_image%
50 )
51 
52 if "%option%" == "5" (
53 @echo 烧录recovery.img...........
54 fastboot flash recovery %recover_image%
55 )
56 
57 if "%option%" == "6" (
58 @echo 烧录system.img........
59 fastboot flash system %system_image%
60 )
61 
62 if "%option%" == "7" (
63 @echo 烧录cache.img...........
64 fastboot flash cache %cache_image%
65 )
66 
67 if "%option%" == "8" (
68 @echo 烧录所有镜像.............
69 fastboot flash boot %boot_image%
70 fastboot flash aboot %mbn_image%
71 fastboot flash persist %persist_image%
72 fastboot flash ramdisk %ramdisk_image%
73 fastboot flash recovery %recover_image%
74 fastboot flash system %system_image%
75 fastboot flash cache %cache_image%
76 )
77 
78 
79 
80 fastboot reboot
81 adb wait-for-device
82 adb root
83 adb wait-for-device
84 
85 
86 @ping -n 5 127.0.0.1>nul
87 adb shell dmesg > kmesg.log
88 @echo kernel log已经导出.....
89 
90 
91 
92 @echo [烧录成功,暂停5秒自动关闭]
93 @ping -n 5 127.0.0.1>nul

dos烧录镜像脚本,以免卫忘;

1 @echo off 2 3 4 5 @ set
flashpath=Z:\msm8909\out\target\product\msm8909\ 6 @ set
boot_image=%flashpath% boot . img 7 @ set
mbn_image=%flashpath%emmc_a…

 1 @echo off
 2 
 3 
 4 
 5 @set flashpath=Z:\msm8909\out\target\product\msm8909\
 6 @set boot_image=%flashpath%boot.img
 7 @set mbn_image=%flashpath%emmc_appsboot.mbn
 8 @set system_image=%flashpath%system.img
 9 @set persist_image=%flashpath%persist.img
10 @set ramdisk_image=%flashpath%ramdisk.img
11 @set recover_image=%flashpath%recovery.img
12 @set cache_image=%flashpath%cache.img
13 
14 
15 @echo 1、烧录boot.img
16 @echo 2、烧录aboot.img
17 @echo 3、烧录persist.img
18 @echo 4、烧录ramdisk.img
19 @echo 5、烧录recovery.img
20 @echo 6、烧录system.img
21 @echo 7、烧录cache.img
22 @echo 8、烧录所有镜像
23 
24 @set /p option=请先设置路径后,再输入要烧录的选项:
25 
26 
27 adb wait-for-device
28 adb reboot-bootloader
29 
30 
31 
32 if "%option%" == "1" (
33 @echo 烧录boot.img........
34 fastboot flash boot %boot_image%
35 )
36 
37 if "%option%" == "2" (
38 @echo 烧录aboot.img........
39 fastboot flash aboot %mbn_image%
40 )
41 
42 if "%option%" == "3" (
43 @echo 烧录persist.img..........
44 fastboot flash persist %persist_image%
45 )
46 
47 if "%option%" == "4" (
48 @echo 烧录ramdisk.img..........
49 fastboot flash ramdisk %ramdisk_image%
50 )
51 
52 if "%option%" == "5" (
53 @echo 烧录recovery.img...........
54 fastboot flash recovery %recover_image%
55 )
56 
57 if "%option%" == "6" (
58 @echo 烧录system.img........
59 fastboot flash system %system_image%
60 )
61 
62 if "%option%" == "7" (
63 @echo 烧录cache.img...........
64 fastboot flash cache %cache_image%
65 )
66 
67 if "%option%" == "8" (
68 @echo 烧录所有镜像.............
69 fastboot flash boot %boot_image%
70 fastboot flash aboot %mbn_image%
71 fastboot flash persist %persist_image%
72 fastboot flash ramdisk %ramdisk_image%
73 fastboot flash recovery %recover_image%
74 fastboot flash system %system_image%
75 fastboot flash cache %cache_image%
76 )
77 
78 
79 
80 fastboot reboot
81 adb wait-for-device
82 adb root
83 adb wait-for-device
84 
85 
86 @ping -n 5 127.0.0.1>nul
87 adb shell dmesg > kmesg.log
88 @echo kernel log已经导出.....
89 
90 
91 
92 @echo [烧录成功,暂停5秒自动关闭]
93 @ping -n 5 127.0.0.1>nul

投机写的run.bat脚本

  1 @echo off
  2 
  3 
  4 
  5 
  6 ::路径注意增加\
  7 @set flashpath=Z:\DT380\LINUX\android\out\target\product\msm8953_64\
  8 @set Dynamic_library_Path=Z:\msm8909\out\target\product\msm8909\obj\lib\sensors.msm8909.so
  9 @set Sensors_conf=Z:\DT380\LINUX\android\vendor\qcom\proprietary\sensors\dsps\reg_defaults\sensor_def_qcomdev.conf
 10 @set boot_image=%flashpath%boot.img
 11 @set mbn_image=%flashpath%emmc_appsboot.mbn
 12 @set userdata_image=%flashpath%userdata.img
 13 @set system_image=%flashpath%system.img
 14 @set persist_image=%flashpath%persist.img
 15 @set ramdisk_image=%flashpath%ramdisk.img
 16 @set recover_image=%flashpath%recovery.img
 17 @set cache_image=%flashpath%cache.img
 18 @set Dynamic_library=%Dynamic_library_Path%
 19 @set Dynamic_library_Board_Path=/system/lib/
 20 
 21 ::初始化,下面便是判断是否有文件
 22 @set Image_Index=0
 23 @set Image_Current-path=0
 24 @set Image_Length=7
 25 @set Image[0]-path=%boot_image%
 26 @set Image[1]-path=%mbn_image%
 27 @set Image[2]-path=%system_image%
 28 @set Image[3]-path=%persist_image%
 29 @set Image[4]-path=%ramdisk_image%
 30 @set Image[5]-path=%recover_image%
 31 @set Image[6]-path=%cache_image%
 32 @set Image[7]-path=%Dynamic_library%
 33 ::初始化
 34 
 35 :LoopStart
 36 
 37 ::清空字符串
 38 @set Image_Current-path=0
 39 
 40 if %Image_Index% equ %Image_Length% goto BeginRun
 41 
 42 for /f "usebackq tokens=1,2,3 delims==-" %%a in (`set Image[%Image_Index%]`) do (
 43     set Image_Current-%%b=%%c
 44 )
 45 
 46 if exist %Image_Current-path% (
 47     @echo 该路径%Image_Current-path%存在......
 48     @echo.
 49 ) else (
 50     @echo %Image_Current-path%
 51     @echo 请确定该文件文件是否存在?如果不存在,请确定路径,打开脚本重新设置。10秒后关闭....
 52     @ping -n 10 127.0.0.1>nul
 53     exit
 54 )
 55 
 56 @set /a Image_Index=%Image_Index%+1
 57 
 58 goto LoopStart
 59 
 60 :BeginRun
 61 @echo 检查Android镜像文件已经完成,请继续下一步......
 62 @echo.
 63 
 64 @echo 0、同时烧录emmc_appsboot.mbn和boot.img
 65 @echo 1、烧录boot.img
 66 @echo 2、烧录aboot.img
 67 @echo 3、烧录persist.img
 68 @echo 4、烧录ramdisk.img
 69 @echo 5、烧录recovery.img
 70 @echo 6、烧录system.img
 71 @echo 7、烧录cache.img
 72 @echo 8、烧录所有镜像
 73 @echo 9、重新推进sensor.so
 74 ::@echo 10、烧录并更新adsp架构下的sensor文件
 75 
 76 @set /p option=请先设置路径后,再输入要烧录的选项:
 77 
 78 
 79 if "%option%" == "9" (
 80 adb root
 81 adb wait-for-device
 82 adb remount
 83 @echo 重新推进sensor........
 84 adb push %Dynamic_library% %Dynamic_library_Board_Path%
 85 adb reboot
 86 @echo 正在重启...... 5秒后关闭....
 87 @ping -n 5 127.0.0.1>nul
 88 
 89 exit
 90 )
 91 
 92 
 93 ::判断是否进入fastboot模式
 94 fastboot devices>1.txt
 95 set /p message=<1.txt
 96 del 1.txt
 97 if not defined message (
 98     echo 正处于adb mode模式.....
 99     adb wait-for-device
100     adb reboot-bootloader
101 ) else ( 
102     echo 正处于fastboot mode模式.....
103 )
104 
105 
106 @echo.
107 
108 if "%option%" == "0" (
109 @echo 同时烧录emmc_appsboot.mbn和boot.img........
110 fastboot flash boot %boot_image%
111 fastboot flash aboot %mbn_image%
112 )
113 
114 if "%option%" == "1" (
115 @echo 烧录boot.img........
116 fastboot flash boot %boot_image%
117 )
118 
119 if "%option%" == "2" (
120 @echo 烧录aboot.img........
121 fastboot flash aboot %mbn_image%
122 )
123 
124 if "%option%" == "3" (
125 @echo 烧录persist.img..........
126 fastboot flash persist %persist_image%
127 )
128 
129 if "%option%" == "4" (
130 @echo 烧录ramdisk.img..........
131 fastboot flash ramdisk %ramdisk_image%
132 )
133 
134 if "%option%" == "5" (
135 @echo 烧录recovery.img...........
136 fastboot flash recovery %recover_image%
137 )
138 
139 if "%option%" == "6" (
140 @echo 烧录system.img........
141 fastboot flash system %system_image%
142 )
143 
144 if "%option%" == "7" (
145 @echo 烧录cache.img...........
146 fastboot flash cache %cache_image%
147 )
148 
149 if "%option%" == "8" (
150 @echo 烧录所有镜像.............
151 fastboot flash boot %boot_image%
152 fastboot flash aboot %mbn_image%
153 fastboot flash persist %persist_image%
154 fastboot flash ramdisk %ramdisk_image%
155 fastboot flash recovery %recover_image%
156 fastboot flash system %system_image%
157 fastboot flash cache %cache_image%
158 fastboot flash userdata %userdata_image%
159 )
160 
161 
162 
163 
164 fastboot reboot
165 @echo 正在重启 请稍后......
166 adb wait-for-device
167 adb root
168 adb wait-for-device
169 
170 
171 @ping -n 5 127.0.0.1>nul
172 adb shell dmesg > kmesg.log
173 @echo kernel log已经导出.....
174 
175 
176 
177 @echo [烧录成功,暂停5秒自动关闭]
178 @ping -n 5 127.0.0.1>nul

dos烧录镜像脚本,以幸免忘;

@REM jenkins持续化构建的项目iqas-ios-syn,通过maven会生成jar包,每次构建完成后需要调用该脚本把生成的jar包拷贝到 E:\project  下,然后调用java命令运行项目
@REM 有待改进的地方:这里maven生成的jar名称随着项目的迭代会变化,所以应该动态获取,这里是写死了,即maven构建该项目时版本号都要保持为0.0.1-SNAPSHOT,如果后期版本号变了则需要在此处修改。


@echo off

@REM  要拷贝maven生成的jar文件
set jar_file=iqas-ios-syn-0.0.1-SNAPSHOT.jar

@REM  修改成运行的jar文件名
set run_jar_file=iossyn.jar

@REM 查看E:\soft\jenkins\jenkins_work\workspace\iqas-ios-syn\target\%jar_file%是否存在,如果存在则拷贝到E:\project目录下
if exist E:\soft\jenkins\jenkins_work\workspace\iqas-ios-syn\target\%jar_file% goto _copy

@REM 文件不存在
goto _fileNofind


:_copy
@REM   拷贝%jar_file%到E:\project目录下,并判断拷贝是否成功
copy E:\soft\jenkins\jenkins_work\workspace\iqas-ios-syn\target\%jar_file%  E:\project  
if errorlevel 1 goto  _copyerror
if errorlevel 0 goto  _copysuccess 


@REM 拷贝成功输出
:_copysuccess
echo %errorlevel%"iqas-ios-syn-0.0.1-SNAPSHOT.jar拷贝到E:\project目录下成功"

@REM 重新命名
ren  E:\project\%jar_file%  %run_jar_file%
goto runproject

@REM 拷贝失败输出
:_copyerror
echo %errorlevel%""E:\soft\jenkins\jenkins_work\workspace\iqas-ios-syn\target\%jar_file% 拷贝出错"
goto end 


@REM 文件不存在输出
:_fileNofind
echo "E:\soft\jenkins\jenkins_work\workspace\iqas-ios-syn\target\%jar_file% 文件不存在"
goto end 


@REM 运行项目
:runproject

echo %run_jar_file%"开始启动......."
java -jar E:\project\%run_jar_file%  --spring.profiles.active=remoteproduction 

:end

 

参考小说:
Bat脚本编写之Dos
基本操作命令
Bat脚本及示范