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