blob: bc1bd559cb95af9ad666220f0a0ca40c21f56e7e [file] [log] [blame]
rjw91288f92022-11-01 13:59:36 +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', 'mcf1_a', 'MCF_MOD_OTA.img'],
44 ['fastboot', 'flash', 'mcf1_b', 'MCF_MOD_OTA.img'],
45 ['fastboot', 'flash', 'mcf2_a', 'MCF_OEM_OTA.img'],
46 ['fastboot', 'flash', 'mcf2_b', 'MCF_OEM_OTA.img'],
47 ['fastboot', 'flash', 'tee_a', 'tee.img'],
48 ['fastboot', 'flash', 'tee_b', 'tee.img'],
49 ['fastboot', 'flash', 'nvram', 'nvram.ubi'],
50 ['fastboot', 'flash', 'mcupm', 'mcupm.img'],
51 ['fastboot', 'flash', 'medmcu', 'medmcu.img'],
52 ['fastboot', 'flash', 'sspm', 'sspm.img'],
53 ['fastboot', 'flash', 'dpm', 'dpm.img'],
54 ['fastboot', 'flash', 'vbmeta_a', 'vbmeta.img'],
55 ['fastboot', 'flash', 'vbmeta_b', 'vbmeta.img'],
56 ['fastboot', 'flash', 'userdata', 'userdata.img']]
57}
58
59userprocedures = {
60 # product : fastboot args
61 'DEFAULT': [['fbWait'],
62 ['fastboot', 'flash', 'EMPTY', 'hsm_bl.img'],
63 ['fastboot', 'continue'],
64 ['fbWait'],
65 ['fastboot', 'flash', 'EMPTY', 'bl2.img'],
66 ['fastboot', 'continue'],
67 ['fbWait'],
68 ['fastboot', 'flash', 'download:tz', 'tee.img'],
69 ['fastboot', 'flash', 'download:bl33', 'bl33.img'],
70 ['fbWait'],
71 ['fastboot', 'erase', 'system_a'],
72 ['fastboot', 'flash', 'system_a', 'system.img'],
73 ['fastboot', 'oem', 'set_active', '0']]
74}
75
76bootprocedures = {
77 # product : fastboot args
78 'DEFAULT': [['fbWait'],
79 ['fastboot', 'flash', 'EMPTY', 'hsm_bl.img'],
80 ['fastboot', 'continue'],
81 ['fbWait'],
82 ['fastboot', 'flash', 'EMPTY', 'bl2.img'],
83 ['fastboot', 'continue'],
84 ['fbWait'],
85 ['fastboot', 'flash', 'download:tz', 'tee.img'],
86 ['fastboot', 'flash', 'download:bl33', 'bl33.img'],
87 ['fastboot', 'flash', 'bl2', 'bl2.img'],
88 ['fastboot', 'flash', 'bl33', 'bl33.img'],
89 ['fastboot', 'flash', 'boot_a', 'boot.img'],
90 ['fastboot', 'flash', 'tee_a', 'tee.img'],
91 ['fastboot', 'oem', 'set_active', '0']]
92}
93
94testprocedures = {
95 # product : fastboot args
96 'DEFAULT': [['fbWait'],
97 ['fastboot', 'flash', 'EMPTY', 'hsm_bl.img'],
98 ['fastboot', 'continue'],
99 ['fbWait'],
100 ['fastboot', 'flash', 'EMPTY', 'bl2.img'],
101 ['fastboot', 'continue'],
102 ['fbWait'],
103 ['fastboot', 'flash', 'download:tz', 'tee.img'],
104 ['fastboot', 'flash', 'download:bl33', 'bl33.img'],
105 ['fastboot', 'oem', 'continue'],
106 ['fbWait'],
107 ['fastboot', 'erase', 'bl2'],
108 ['fastboot', 'flash', 'bl2', 'bl2.img'],
109 ['fastboot', 'erase', 'bl33'],
110 ['fastboot', 'flash', 'bl33', 'bl33.img'],
111 ['fastboot', 'erase', 'dtbo'],
112 ['fastboot', 'flash', 'dtbo', 'combo.dtbo'],
113 ['fastboot', 'erase', 'proinfo'],
114 ['fastboot', 'flash', 'proinfo', 'sncfg.ubi'],
115 ['fastboot', 'erase', 'boot_a'],
116 ['fastboot', 'flash', 'boot_a', 'boot.img'],
117 ['fastboot', 'erase', 'boot_b'],
118 ['fastboot', 'flash', 'boot_b', 'boot.img'],
119 ['fastboot', 'erase', 'system_a'],
120 ['fastboot', 'flash', 'system_a', 'system.img'],
121 ['fastboot', 'erase', 'system_b'],
122 ['fastboot', 'flash', 'system_b', 'system.img'],
123 ['fastboot', 'erase', 'md1img_a'],
124 ['fastboot', 'flash', 'md1img_a', 'md1img.img'],
125 ['fastboot', 'erase', 'md1img_b'],
126 ['fastboot', 'flash', 'md1img_b', 'md1img.img'],
127 ['fastboot', 'erase', 'md1dsp_a'],
128 ['fastboot', 'flash', 'md1dsp_a', 'md1dsp.img'],
129 ['fastboot', 'erase', 'md1dsp_b'],
130 ['fastboot', 'flash', 'md1dsp_b', 'md1dsp.img'],
131 ['fastboot', 'erase', 'tee_a'],
132 ['fastboot', 'flash', 'tee_a', 'tee.img'],
133 ['fastboot', 'erase', 'tee_b'],
134 ['fastboot', 'flash', 'tee_b', 'tee.img']]
135}
136
137# return procedure list
138def getFlashProc(product):
139 try:
140 ret = procedures[product.upper()]
141 return ret
142 except:
143 return None
144
145
146def getFlashUserProc(product):
147 try:
148 ret = userprocedures[product.upper()]
149 return ret
150 except:
151 return None
152
153def getFlashBootProc(product):
154 try:
155 ret = bootprocedures[product.upper()]
156 return ret
157 except:
158 return None
159
160def getFlashTestProc(product):
161 try:
162 ret = testprocedures[product.upper()]
163 return ret
164 except:
165 return None