blob: 638887bb1866ec7745068728e8a28b67029d631e [file] [log] [blame]
rjw91288f92022-11-01 13:59:36 +08001#!/usr/bin/python
2import os
3
4procedures = {
5 # product : fastboot args
6 'DEFAULT': [['fbWait'],
7 ['fastboot', 'flash', 'EMPTY', 'hsm_bl.img'],
8 ['fastboot', 'continue'],
9 ['fbWait'],
10 ['fastboot', 'flash', 'EMPTY', 'bl2.img'],
11 ['fastboot', 'continue'],
12 ['fbWait'],
13 ['fastboot', 'flash', 'download:tz', 'tee.img'],
14 ['fastboot', 'flash', 'download:bl33', 'bl33.img'],
15 ['fastboot', 'flash', 'download:spmfw', 'spmfw.img'],
16 ['fastboot', 'flash', 'download:mcupm', 'mcupm.img'],
17 ['fastboot', 'flash', 'download:medmcu', 'medmcu.img'],
18 ['fastboot', 'flash', 'download:sspm', 'sspm.img'],
19 ['fastboot', 'flash', 'download:dpm', 'dpm.img'],
20 ['fastboot', 'flash', 'download:hsmos', 'hsm_os.img'],
21 ['fastboot', 'oem', 'continue'],
22 ['fbWait'],
23 ['fastboot', 'erase', 'nand0'],
24 ['fastboot', 'flash', 'nand0', 'MBR_NAND'],
25 ['fastboot', 'flash', 'hsm_bl', 'hsm_bl.img'],
26 ['fastboot', 'flash', 'hsm_os', 'hsm_os.img'],
27 ['fastboot', 'flash', 'bl2', 'bl2.img'],
28 ['fastboot', 'flash', 'bl33', 'bl33.img'],
29 ['fastboot', 'flash', 'spm_a', 'spmfw.img'],
30 ['fastboot', 'flash', 'dtbo', 'combo.dtbo'],
31 ['fastboot', 'flash', 'proinfo', 'sncfg.ubi'],
32 ['fastboot', 'flash', 'boot_a', 'boot.img'],
33 ['fastboot', 'flash', 'boot_b', 'boot.img'],
34 ['fastboot', 'flash', 'system_a', 'system.img'],
35 ['fastboot', 'flash', 'system_b', 'system.img'],
36 ['fastboot', 'flash', 'md1img_a', 'md1img.img'],
37 ['fastboot', 'flash', 'md1dsp_a', 'md1dsp.img'],
38 ['fastboot', 'flash', 'tee_a', 'tee.img'],
39 ['fastboot', 'flash', 'tee_b', 'tee.img'],
40 ['fastboot', 'flash', 'nvram', 'nvram.ubi'],
41 ['fastboot', 'flash', 'mcupm', 'mcupm.img'],
42 ['fastboot', 'flash', 'medmcu', 'medmcu.img'],
43 ['fastboot', 'flash', 'sspm', 'sspm.img'],
44 ['fastboot', 'flash', 'dpm', 'dpm.img'],
45 ['fastboot', 'flash', 'userdata', 'userdata.img']]
46}
47
48userprocedures = {
49 # product : fastboot args
50 'DEFAULT': [['fbWait'],
51 ['fastboot', 'flash', 'EMPTY', 'hsm_bl.img'],
52 ['fastboot', 'continue'],
53 ['fbWait'],
54 ['fastboot', 'flash', 'EMPTY', 'bl2.img'],
55 ['fastboot', 'continue'],
56 ['fbWait'],
57 ['fastboot', 'flash', 'download:tz', 'tee.img'],
58 ['fastboot', 'flash', 'download:bl33', 'bl33.img'],
59 ['fbWait'],
60 ['fastboot', 'erase', 'system_a'],
61 ['fastboot', 'flash', 'system_a', 'system.img'],
62 ['fastboot', 'oem', 'set_active', '0']]
63}
64
65bootprocedures = {
66 # product : fastboot args
67 'DEFAULT': [['fbWait'],
68 ['fastboot', 'flash', 'EMPTY', 'hsm_bl.img'],
69 ['fastboot', 'continue'],
70 ['fbWait'],
71 ['fastboot', 'flash', 'EMPTY', 'bl2.img'],
72 ['fastboot', 'continue'],
73 ['fbWait'],
74 ['fastboot', 'flash', 'download:tz', 'tee.img'],
75 ['fastboot', 'flash', 'download:bl33', 'bl33.img'],
76 ['fastboot', 'flash', 'bl2', 'bl2.img'],
77 ['fastboot', 'flash', 'bl33', 'bl33.img'],
78 ['fastboot', 'flash', 'boot_a', 'boot.img'],
79 ['fastboot', 'flash', 'tee_a', 'tee.img'],
80 ['fastboot', 'oem', 'set_active', '0']]
81}
82
83testprocedures = {
84 # product : fastboot args
85 'DEFAULT': [['fbWait'],
86 ['fastboot', 'flash', 'EMPTY', 'hsm_bl.img'],
87 ['fastboot', 'continue'],
88 ['fbWait'],
89 ['fastboot', 'flash', 'EMPTY', 'bl2.img'],
90 ['fastboot', 'continue'],
91 ['fbWait'],
92 ['fastboot', 'flash', 'download:tz', 'tee.img'],
93 ['fastboot', 'flash', 'download:bl33', 'bl33.img'],
94 ['fastboot', 'oem', 'continue'],
95 ['fbWait'],
96 ['fastboot', 'erase', 'bl2'],
97 ['fastboot', 'flash', 'bl2', 'bl2.img'],
98 ['fastboot', 'erase', 'bl33'],
99 ['fastboot', 'flash', 'bl33', 'bl33.img'],
100 ['fastboot', 'erase', 'dtbo'],
101 ['fastboot', 'flash', 'dtbo', 'combo.dtbo'],
102 ['fastboot', 'erase', 'proinfo'],
103 ['fastboot', 'flash', 'proinfo', 'sncfg.ubi'],
104 ['fastboot', 'erase', 'boot_a'],
105 ['fastboot', 'flash', 'boot_a', 'boot.img'],
106 ['fastboot', 'erase', 'boot_b'],
107 ['fastboot', 'flash', 'boot_b', 'boot.img'],
108 ['fastboot', 'erase', 'system_a'],
109 ['fastboot', 'flash', 'system_a', 'system.img'],
110 ['fastboot', 'erase', 'system_b'],
111 ['fastboot', 'flash', 'system_b', 'system.img'],
112 ['fastboot', 'erase', 'md1img_a'],
113 ['fastboot', 'flash', 'md1img_a', 'md1img.img'],
114 ['fastboot', 'erase', 'md1dsp_b'],
115 ['fastboot', 'flash', 'md1dsp_b', 'md1dsp.img'],
116 ['fastboot', 'erase', 'tee_a'],
117 ['fastboot', 'flash', 'tee_a', 'tee.img'],
118 ['fastboot', 'erase', 'tee_b'],
119 ['fastboot', 'flash', 'tee_b', 'tee.img']]
120}
121
122# return procedure list
123def getFlashProc(product):
124 try:
125 ret = procedures[product.upper()]
126 return ret
127 except:
128 return None
129
130
131def getFlashUserProc(product):
132 try:
133 ret = userprocedures[product.upper()]
134 return ret
135 except:
136 return None
137
138def getFlashBootProc(product):
139 try:
140 ret = bootprocedures[product.upper()]
141 return ret
142 except:
143 return None
144
145def getFlashTestProc(product):
146 try:
147 ret = testprocedures[product.upper()]
148 return ret
149 except:
150 return None