blob: b895511eccef356a5bbeca771e88f41c83ec76e2 [file] [log] [blame]
rjwdbb8a262022-11-01 14:17:32 +08001# SPDX-License-Identifier: MediaTekProprietary
2
3#!/usr/bin/python
4import os
5
6procedures = {
7 # product : fastboot args
8 'DEFAULT': [['fbWait'],
9 ['fastboot', 'flash', 'EMPTY', 'hsm_bl.img'],
10 ['fastboot', 'continue'],
11 ['fbWait'],
12 ['fastboot', 'flash', 'EMPTY', 'bl2.img'],
13 ['fastboot', 'continue'],
14 ['fbWait'],
15 ['fastboot', 'flash', 'download:tz', 'tee.img'],
16 ['fastboot', 'flash', 'download:bl33', 'bl33.img'],
17 ['fastboot', 'flash', 'download:spmfw', 'spmfw.img'],
18 ['fastboot', 'flash', 'download:mcupm', 'mcupm.img'],
19 ['fastboot', 'flash', 'download:medmcu', 'medmcu.img'],
20 ['fastboot', 'flash', 'download:sspm', 'sspm.img'],
21 ['fastboot', 'flash', 'download:dpm', 'dpm.img'],
22 ['fastboot', 'flash', 'download:hsmos', 'hsm_os.img'],
23 ['fastboot', 'oem', 'continue'],
24 ['fbWait'],
25 ['fastboot', 'erase', 'nand0'],
26 ['fastboot', 'flash', 'nand0', 'MBR_NAND'],
27 ['fastboot', 'flash', 'bl2', 'bl2.img'],
28 ['fastboot', 'flash', 'bl33', 'bl33.img'],
29 ['fastboot', 'flash', 'spm_a', 'spmfw.img'],
30 ['fastboot', 'flash', 'spm_b', 'spmfw.img'],
31 ['fastboot', 'flash', 'dtbo', 'combo.dtbo'],
32 ['fastboot', 'flash', 'hsm_bl', 'hsm_bl.img'],
33 ['fastboot', 'flash', 'hsm_os', 'hsm_os.img'],
34 ['fastboot', 'flash', 'proinfo', 'sncfg.ubi'],
35 ['fastboot', 'flash', 'boot_a', 'boot.img'],
36 ['fastboot', 'flash', 'boot_b', 'boot.img'],
37 ['fastboot', 'flash', 'system_a', 'system.img'],
38 ['fastboot', 'flash', 'system_b', 'system.img'],
39 ['fastboot', 'flash', 'md1img_a', 'md1img.img'],
40 ['fastboot', 'flash', 'md1img_b', 'md1img.img'],
41 ['fastboot', 'flash', 'md1dsp_a', 'md1dsp.img'],
42 ['fastboot', 'flash', 'md1dsp_b', 'md1dsp.img'],
43 ['fastboot', 'flash', 'tee_a', 'tee.img'],
44 ['fastboot', 'flash', 'tee_b', 'tee.img'],
45 ['fastboot', 'flash', 'nvram', 'nvram.ubi'],
46 ['fastboot', 'flash', 'mcupm', 'mcupm.img'],
47 ['fastboot', 'flash', 'medmcu', 'medmcu.img'],
48 ['fastboot', 'flash', 'sspm', 'sspm.img'],
49 ['fastboot', 'flash', 'dpm', 'dpm.img'],
50 ['fastboot', 'flash', 'userdata', 'userdata.img'],
51 ['fastboot', 'flash', 'vbmeta_a', 'vbmeta.img'],
52 ['fastboot', 'flash', 'vbmeta_b', 'vbmeta.img'],
53 ['fastboot', 'flash', 'oemdata', 'oemdata.img'],
54 ['fastboot', 'flash', 'oemapp_a', 'oemapp.img'],
55 ['fastboot', 'flash', 'oemapp_b', 'oemapp.img'],
56 ['fastboot', 'flash', 'oemapp2_a', 'oemapp2.img'],
57 ['fastboot', 'flash', 'oemapp2_b', 'oemapp2.img']]
58}
59
60userprocedures = {
61 # product : fastboot args
62 'DEFAULT': [['fbWait'],
63 ['fastboot', 'flash', 'EMPTY', 'hsm_bl.img'],
64 ['fastboot', 'continue'],
65 ['fbWait'],
66 ['fastboot', 'flash', 'EMPTY', 'bl2.img'],
67 ['fastboot', 'continue'],
68 ['fbWait'],
69 ['fastboot', 'flash', 'download:tz', 'tee.img'],
70 ['fastboot', 'flash', 'download:bl33', 'bl33.img'],
71 ['fbWait'],
72 ['fastboot', 'erase', 'system_a'],
73 ['fastboot', 'flash', 'system_a', 'system.img'],
74 ['fastboot', 'oem', 'set_active', '0']]
75}
76
77bootprocedures = {
78 # product : fastboot args
79 'DEFAULT': [['fbWait'],
80 ['fastboot', 'flash', 'EMPTY', 'hsm_bl.img'],
81 ['fastboot', 'continue'],
82 ['fbWait'],
83 ['fastboot', 'flash', 'EMPTY', 'bl2.img'],
84 ['fastboot', 'continue'],
85 ['fbWait'],
86 ['fastboot', 'flash', 'download:tz', 'tee.img'],
87 ['fastboot', 'flash', 'download:bl33', 'bl33.img'],
88 ['fastboot', 'flash', 'bl2', 'bl2.img'],
89 ['fastboot', 'flash', 'bl33', 'bl33.img'],
90 ['fastboot', 'flash', 'boot_a', 'boot.img'],
91 ['fastboot', 'flash', 'tee_a', 'tee.img'],
92 ['fastboot', 'oem', 'set_active', '0']]
93}
94
95testprocedures = {
96 # product : fastboot args
97 'DEFAULT': [['fbWait'],
98 ['fastboot', 'flash', 'EMPTY', 'hsm_bl.img'],
99 ['fastboot', 'continue'],
100 ['fbWait'],
101 ['fastboot', 'flash', 'EMPTY', 'bl2.img'],
102 ['fastboot', 'continue'],
103 ['fbWait'],
104 ['fastboot', 'flash', 'download:tz', 'tee.img'],
105 ['fastboot', 'flash', 'download:bl33', 'bl33.img'],
106 ['fastboot', 'oem', 'continue'],
107 ['fbWait'],
108 ['fastboot', 'erase', 'bl2'],
109 ['fastboot', 'flash', 'bl2', 'bl2.img'],
110 ['fastboot', 'erase', 'bl33'],
111 ['fastboot', 'flash', 'bl33', 'bl33.img'],
112 ['fastboot', 'erase', 'dtbo'],
113 ['fastboot', 'flash', 'dtbo', 'combo.dtbo'],
114 ['fastboot', 'erase', 'proinfo'],
115 ['fastboot', 'flash', 'proinfo', 'sncfg.ubi'],
116 ['fastboot', 'erase', 'boot_a'],
117 ['fastboot', 'flash', 'boot_a', 'boot.img'],
118 ['fastboot', 'erase', 'boot_b'],
119 ['fastboot', 'flash', 'boot_b', 'boot.img'],
120 ['fastboot', 'erase', 'system_a'],
121 ['fastboot', 'flash', 'system_a', 'system.img'],
122 ['fastboot', 'erase', 'system_b'],
123 ['fastboot', 'flash', 'system_b', 'system.img'],
124 ['fastboot', 'erase', 'md1img_a'],
125 ['fastboot', 'flash', 'md1img_a', 'md1img.img'],
126 ['fastboot', 'erase', 'md1img_b'],
127 ['fastboot', 'flash', 'md1img_b', 'md1img.img'],
128 ['fastboot', 'erase', 'md1dsp_a'],
129 ['fastboot', 'flash', 'md1dsp_a', 'md1dsp.img'],
130 ['fastboot', 'erase', 'md1dsp_b'],
131 ['fastboot', 'flash', 'md1dsp_b', 'md1dsp.img'],
132 ['fastboot', 'erase', 'tee_a'],
133 ['fastboot', 'flash', 'tee_a', 'tee.img'],
134 ['fastboot', 'erase', 'tee_b'],
135 ['fastboot', 'flash', 'tee_b', 'tee.img'],
136 ['fastboot', 'erase', 'vbmeta_a'],
137 ['fastboot', 'flash', 'vbmeta_a', 'vbmeta.img'],
138 ['fastboot', 'erase', 'vbmeta_b'],
139 ['fastboot', 'flash', 'vbmeta_b', 'vbmeta.img'],
140 ['fastboot', 'erase', 'oemapp_a'],
141 ['fastboot', 'flash', 'oemapp_a', 'oemapp.img'],
142 ['fastboot', 'erase', 'oemapp_b'],
143 ['fastboot', 'flash', 'oemapp_b', 'oemapp.img'],
144 ['fastboot', 'erase', 'oemapp2_a'],
145 ['fastboot', 'flash', 'oemapp2_a', 'oemapp2.img'],
146 ['fastboot', 'erase', 'oemapp2_b'],
147 ['fastboot', 'flash', 'oemapp2_b', 'oemapp2.img']]
148}
149
150userdataprocedures = {
151 # product : fastboot args
152 'DEFAULT': [['fbWait'],
153 ['fastboot', 'flash', 'EMPTY', 'hsm_bl.img'],
154 ['fastboot', 'continue'],
155 ['fbWait'],
156 ['fastboot', 'flash', 'EMPTY', 'bl2.img'],
157 ['fastboot', 'continue'],
158 ['fbWait'],
159 ['fastboot', 'flash', 'download:tz', 'tee.img'],
160 ['fastboot', 'flash', 'download:bl33', 'bl33.img'],
161 ['fastboot', 'oem', 'continue'],
162 ['fbWait'],
163 ['fastboot', 'erase', 'bl2'],
164 ['fastboot', 'flash', 'bl2', 'bl2.img'],
165 ['fastboot', 'erase', 'bl33'],
166 ['fastboot', 'flash', 'bl33', 'bl33.img'],
167 ['fastboot', 'erase', 'dtbo'],
168 ['fastboot', 'flash', 'dtbo', 'combo.dtbo'],
169 ['fastboot', 'erase', 'proinfo'],
170 ['fastboot', 'flash', 'proinfo', 'sncfg.ubi'],
171 ['fastboot', 'erase', 'boot_a'],
172 ['fastboot', 'flash', 'boot_a', 'boot.img'],
173 ['fastboot', 'erase', 'boot_b'],
174 ['fastboot', 'flash', 'boot_b', 'boot.img'],
175 ['fastboot', 'erase', 'system_a'],
176 ['fastboot', 'flash', 'system_a', 'system.img'],
177 ['fastboot', 'erase', 'system_b'],
178 ['fastboot', 'flash', 'system_b', 'system.img'],
179 ['fastboot', 'erase', 'md1img_a'],
180 ['fastboot', 'flash', 'md1img_a', 'md1img.img'],
181 ['fastboot', 'erase', 'md1img_b'],
182 ['fastboot', 'flash', 'md1img_b', 'md1img.img'],
183 ['fastboot', 'erase', 'md1dsp_a'],
184 ['fastboot', 'flash', 'md1dsp_a', 'md1dsp.img'],
185 ['fastboot', 'erase', 'md1dsp_b'],
186 ['fastboot', 'flash', 'md1dsp_b', 'md1dsp.img'],
187 ['fastboot', 'erase', 'tee_a'],
188 ['fastboot', 'flash', 'tee_a', 'tee.img'],
189 ['fastboot', 'erase', 'tee_b'],
190 ['fastboot', 'flash', 'tee_b', 'tee.img'],
191 ['fastboot', 'erase', 'vbmeta_a'],
192 ['fastboot', 'flash', 'vbmeta_a', 'vbmeta.img'],
193 ['fastboot', 'erase', 'vbmeta_b'],
194 ['fastboot', 'flash', 'vbmeta_b', 'vbmeta.img'],
195 ['fastboot', 'erase', 'oemapp_a'],
196 ['fastboot', 'flash', 'oemapp_a', 'oemapp.img'],
197 ['fastboot', 'erase', 'oemapp_b'],
198 ['fastboot', 'flash', 'oemapp_b', 'oemapp.img'],
199 ['fastboot', 'erase', 'oemapp2_a'],
200 ['fastboot', 'flash', 'oemapp2_a', 'oemapp2.img'],
201 ['fastboot', 'erase', 'oemapp2_b'],
202 ['fastboot', 'flash', 'oemapp2_b', 'oemapp2.img'],
203 ['fastboot', 'erase', 'oemdata'],
204 ['fastboot', 'flash', 'oemdata', 'oemdata.img'],
205 ['fastboot', 'erase', 'userdata'],
206 ['fastboot', 'flash', 'userdata', 'userdata.img']]
207}
208
209# return procedure list
210def getFlashProc(product):
211 try:
212 ret = procedures[product.upper()]
213 return ret
214 except:
215 return None
216
217
218def getFlashUserProc(product):
219 try:
220 ret = userprocedures[product.upper()]
221 return ret
222 except:
223 return None
224
225def getFlashBootProc(product):
226 try:
227 ret = bootprocedures[product.upper()]
228 return ret
229 except:
230 return None
231
232def getFlashTestProc(product):
233 try:
234 ret = testprocedures[product.upper()]
235 return ret
236 except:
237 return None
238
239def getFlashUserDataProc(product):
240 try:
241 ret = userdataprocedures[product.upper()]
242 return ret
243 except:
244 return None