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