blob: 7104ae8053a2f4d631505d3069bfb76b7c9b073b [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', 'nand0'],
16 ['fastboot', 'erase', 'mmc0'],
17 ['fastboot', 'erase', 'mmc0boot0'],
18 ['fastboot', 'flash', 'mmc0boot0', 'MBR_EMMC_BOOT0'],
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.ext4'],
31 ['fastboot', 'flash', 'system_a', 'system.img'],
32 ['fastboot', 'flash', 'system_b', 'system.img'],
33 ['fastboot', 'flash', 'userdata', 'userdata.img'],
34 ['fastboot', 'flash', 'hsm_os', 'hsm_os.img']]
35}
36
37userprocedures = {
38 # product : fastboot args
39 'DEFAULT': [['fbWait'],
40 ['fastboot', 'flash', 'EMPTY', 'bl2.img'],
41 ['fastboot', 'continue'],
42 ['fbWait'],
43 ['fastboot', 'flash', 'download:tz', 'tee.img'],
44 ['fastboot', 'flash', 'download:bl33', 'bl33.img'],
45 ['fastboot', 'flash', 'download:spmfw', 'spmfw.img'],
46 ['fbWait'],
47 ['fastboot', 'erase', 'system'],
48 ['fastboot', 'flash', 'system', 'system.ext4'],
49 ['fastboot', 'oem', 'set_active', '0']]
50}
51
52bootprocedures = {
53 # product : fastboot args
54 'DEFAULT': [['fbWait'],
55 ['fastboot', 'flash', 'EMPTY', 'bl2.img'],
56 ['fastboot', 'continue'],
57 ['fbWait'],
58 ['fastboot', 'flash', 'download:tz', 'tee.img'],
59 ['fastboot', 'flash', 'download:bl33', 'bl33.img'],
60 ['fastboot', 'flash', 'download:spmfw', 'spmfw.img'],
61 ['fastboot', 'flash', 'bl2', 'bl2.img'],
62 ['fastboot', 'flash', 'tee_a', 'tee.img'],
63 ['fastboot', 'flash', 'bl33', 'bl33.img'],
64 ['fastboot', 'flash', 'spm', 'spmfw.img'],
65 ['fastboot', 'flash', 'boot', 'boot.img'],
66 ['fastboot', 'oem', 'set_active', '0']]
67}
68
69testprocedures = {
70 # product : fastboot args
71 'DEFAULT': [['fbWait'],
72 ['fastboot', 'flash', 'EMPTY', 'bl2.img'],
73 ['fastboot', 'continue'],
74 ['fbWait'],
75 ['fastboot', 'flash', 'download:tz', 'tee.img'],
76 ['fastboot', 'flash', 'download:bl33', 'bl33.img'],
77 ['fastboot', 'flash', 'download:spmfw', 'spmfw.img'],
78 ['fastboot', 'oem', 'continue'],
79 ['fbWait'],
80 ['fastboot', 'erase', 'bl2'],
81 ['fastboot', 'flash', 'bl2', 'bl2.img'],
82 ['fastboot', 'erase', 'bl33'],
83 ['fastboot', 'flash', 'bl33', 'bl33.img'],
84 ['fastboot', 'erase', 'spm'],
85 ['fastboot', 'flash', 'spm', 'spmfw.img'],
86 ['fastboot', 'erase', 'boot_a'],
87 ['fastboot', 'flash', 'boot_a', 'boot.img'],
88 ['fastboot', 'erase', 'boot_b'],
89 ['fastboot', 'flash', 'boot_b', 'boot.img'],
90 ['fastboot', 'erase', 'dtbo'],
91 ['fastboot', 'flash', 'dtbo', 'combo.dtbo'],
92 ['fastboot', 'erase', 'tee_a'],
93 ['fastboot', 'flash', 'tee_a', 'tee.img'],
94 ['fastboot', 'erase', 'tee_b'],
95 ['fastboot', 'flash', 'tee_b', 'tee.img'],
96 ['fastboot', 'erase', 'md1img_a'],
97 ['fastboot', 'flash', 'md1img_a', 'md1img.img'],
98 ['fastboot', 'erase', 'md1img_b'],
99 ['fastboot', 'flash', 'md1img_b', 'md1img.img'],
100 ['fastboot', 'erase', 'system_a'],
101 ['fastboot', 'flash', 'system_a', 'system.img'],
102 ['fastboot', 'erase', 'system_b'],
103 ['fastboot', 'flash', 'system_b', 'system.img'],
104 ['fastboot', 'erase', 'userdata'],
105 ['fastboot', 'flash', 'userdata', 'userdata.img']]
106}
107
108# return procedure list
109
110
111def getFlashProc(product):
112 try:
113 ret = procedures[product.upper()]
114 return ret
115 except:
116 return None
117
118
119def getFlashUserProc(product):
120 try:
121 ret = userprocedures[product.upper()]
122 return ret
123 except:
124 return None
125
126
127def getFlashBootProc(product):
128 try:
129 ret = bootprocedures[product.upper()]
130 return ret
131 except:
132 return None
133
134
135def getFlashTestProc(product):
136 try:
137 ret = testprocedures[product.upper()]
138 return ret
139 except:
140 return None