| #!/usr/bin/python |
| import os |
| |
| procedures = { |
| # product : fastboot args |
| 'DEFAULT': [['fbWait'], |
| ['fastboot', 'flash', 'EMPTY', 'bl2.img'], |
| ['fastboot', 'continue'], |
| ['fbWait'], |
| ['fastboot', 'flash', 'download:tz', 'tee.img'], |
| ['fastboot', 'flash', 'download:bl33', 'bl33.img'], |
| ['fastboot', 'flash', 'download:spmfw', 'spmfw.img'], |
| ['fastboot', 'oem', 'continue'], |
| ['fbWait'], |
| ['fastboot', 'erase', 'nand0'], |
| ['fastboot', 'erase', 'mmc0'], |
| ['fastboot', 'erase', 'mmc0boot0'], |
| ['fastboot', 'flash', 'mmc0boot0', 'MBR_EMMC_BOOT0'], |
| ['fastboot', 'flash', 'mmc0', 'MBR_EMMC'], |
| ['fastboot', 'flash', 'bl2', 'bl2.img'], |
| ['fastboot', 'flash', 'bl33', 'bl33.img'], |
| ['fastboot', 'flash', 'spm', 'spmfw.img'], |
| ['fastboot', 'flash', 'boot_a', 'boot.img'], |
| ['fastboot', 'flash', 'boot_b', 'boot.img'], |
| ['fastboot', 'flash', 'dtbo', 'combo.dtbo'], |
| ['fastboot', 'flash', 'tee_a', 'tee.img'], |
| ['fastboot', 'flash', 'tee_b', 'tee.img'], |
| ['fastboot', 'flash', 'md1img_a', 'md1img.img'], |
| ['fastboot', 'flash', 'md1img_b', 'md1img.img'], |
| ['fastboot', 'flash', 'sncfg', 'sncfg.ext4'], |
| ['fastboot', 'flash', 'system_a', 'system.img'], |
| ['fastboot', 'flash', 'system_b', 'system.img'], |
| ['fastboot', 'flash', 'userdata', 'userdata.img']] |
| } |
| |
| userprocedures = { |
| # product : fastboot args |
| 'DEFAULT': [['fbWait'], |
| ['fastboot', 'flash', 'EMPTY', 'bl2.img'], |
| ['fastboot', 'continue'], |
| ['fbWait'], |
| ['fastboot', 'flash', 'download:tz', 'tee.img'], |
| ['fastboot', 'flash', 'download:bl33', 'bl33.img'], |
| ['fastboot', 'flash', 'download:spmfw', 'spmfw.img'], |
| ['fbWait'], |
| ['fastboot', 'erase', 'system'], |
| ['fastboot', 'flash', 'system', 'system.ubi'], |
| ['fastboot', 'oem', 'set_active', '0']] |
| } |
| |
| bootprocedures = { |
| # product : fastboot args |
| 'DEFAULT': [['fbWait'], |
| ['fastboot', 'flash', 'EMPTY', 'bl2.img'], |
| ['fastboot', 'continue'], |
| ['fbWait'], |
| ['fastboot', 'flash', 'download:tz', 'tee.img'], |
| ['fastboot', 'flash', 'download:bl33', 'bl33.img'], |
| ['fastboot', 'flash', 'download:spmfw', 'spmfw.img'], |
| ['fastboot', 'flash', 'bl2', 'bl2.img'], |
| ['fastboot', 'flash', 'tee_a', 'tee.img'], |
| ['fastboot', 'flash', 'bl33', 'bl33.img'], |
| ['fastboot', 'flash', 'spm', 'spmfw.img'], |
| ['fastboot', 'flash', 'boot', 'boot.img'], |
| ['fastboot', 'oem', 'set_active', '0']] |
| } |
| |
| testprocedures = { |
| # product : fastboot args |
| 'DEFAULT': [['fbWait'], |
| ['fastboot', 'flash', 'EMPTY', 'bl2.img'], |
| ['fastboot', 'continue'], |
| ['fbWait'], |
| ['fastboot', 'flash', 'download:tz', 'tee.img'], |
| ['fastboot', 'flash', 'download:bl33', 'bl33.img'], |
| ['fastboot', 'flash', 'download:spmfw', 'spmfw.img'], |
| ['fastboot', 'oem', 'continue'], |
| ['fbWait'], |
| ['fastboot', 'erase', 'bl2'], |
| ['fastboot', 'flash', 'bl2', 'bl2.img'], |
| ['fastboot', 'erase', 'bl33'], |
| ['fastboot', 'flash', 'bl33', 'bl33.img'], |
| ['fastboot', 'erase', 'spm'], |
| ['fastboot', 'flash', 'spm', 'spmfw.img'], |
| ['fastboot', 'erase', 'boot_a'], |
| ['fastboot', 'flash', 'boot_a', 'boot.img'], |
| ['fastboot', 'erase', 'boot_b'], |
| ['fastboot', 'flash', 'boot_b', 'boot.img'], |
| ['fastboot', 'erase', 'dtbo'], |
| ['fastboot', 'flash', 'dtbo', 'combo.dtbo'], |
| ['fastboot', 'erase', 'tee_a'], |
| ['fastboot', 'flash', 'tee_a', 'tee.img'], |
| ['fastboot', 'erase', 'tee_b'], |
| ['fastboot', 'flash', 'tee_b', 'tee.img'], |
| ['fastboot', 'erase', 'md1img_a'], |
| ['fastboot', 'flash', 'md1img_a', 'md1img.img'], |
| ['fastboot', 'erase', 'md1img_b'], |
| ['fastboot', 'flash', 'md1img_b', 'md1img.img'], |
| ['fastboot', 'erase', 'system_a'], |
| ['fastboot', 'flash', 'system_a', 'system.img'], |
| ['fastboot', 'erase', 'system_b'], |
| ['fastboot', 'flash', 'system_b', 'system.img'], |
| ['fastboot', 'erase', 'userdata'], |
| ['fastboot', 'flash', 'userdata', 'userdata.ext4']] |
| } |
| |
| # return procedure list |
| |
| |
| def getFlashProc(product): |
| try: |
| ret = procedures[product.upper()] |
| return ret |
| except: |
| return None |
| |
| |
| def getFlashUserProc(product): |
| try: |
| ret = userprocedures[product.upper()] |
| return ret |
| except: |
| return None |
| |
| |
| def getFlashBootProc(product): |
| try: |
| ret = bootprocedures[product.upper()] |
| return ret |
| except: |
| return None |
| |
| |
| def getFlashTestProc(product): |
| try: |
| ret = testprocedures[product.upper()] |
| return ret |
| except: |
| return None |