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