[Feature]add MT2731_MP2_MR2_SVN388 baseline version
Change-Id: Ief04314834b31e27effab435d3ca8ba33b499059
diff --git a/meta/meta-mediatek-mt2731/recipes-devtools/flashtool/files/align_4kb.py b/meta/meta-mediatek-mt2731/recipes-devtools/flashtool/files/align_4kb.py
new file mode 100644
index 0000000..c9c9a99
--- /dev/null
+++ b/meta/meta-mediatek-mt2731/recipes-devtools/flashtool/files/align_4kb.py
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+
+import sys
+import os
+
+
+if len(sys.argv) != 2:
+ print('Usage : align_4kb [file_name]')
+ sys.exit()
+
+if not os.path.isfile(sys.argv[1]):
+ print(sys.argv[1] + ' not exist')
+ sys.exit()
+
+if os.path.getsize(sys.argv[1]) % 4096 == 0:
+ print('file size is 4KB alignment')
+ sys.exit()
+
+file_src = sys.argv[1]
+file_dst = os.path.splitext(
+ file_src)[0] + "_original" + os.path.splitext(file_src)[1]
+
+if os.path.exists(file_dst):
+ os.remove(file_dst)
+
+os.rename(file_src, file_dst)
+
+file_src = file_dst
+file_dst = sys.argv[1]
+
+with open(file_dst, 'ab') as fdst:
+ with open(file_src, 'rb') as fsrc:
+ data = fsrc.read()
+ len_diff = 4096 - len(data) % 4096
+ fdst.write(data)
+ if len_diff:
+ fdst.write(b'\xff' * len_diff)
diff --git a/meta/meta-mediatek-mt2731/recipes-devtools/flashtool/files/auto2731evb-ivt-main-user/flashproc.py b/meta/meta-mediatek-mt2731/recipes-devtools/flashtool/files/auto2731evb-ivt-main-user/flashproc.py
new file mode 100644
index 0000000..22e7e45
--- /dev/null
+++ b/meta/meta-mediatek-mt2731/recipes-devtools/flashtool/files/auto2731evb-ivt-main-user/flashproc.py
@@ -0,0 +1,135 @@
+#!/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', 'mmc0'],
+ ['fastboot', 'erase', 'mmc0boot0'],
+ ['fastboot', 'erase', 'nand0'],
+ ['fastboot', 'flash', 'nand0', 'MBR_NAND'],
+ ['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.ubi'],
+ ['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.img']]
+}
+
+# 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
diff --git a/meta/meta-mediatek-mt2731/recipes-devtools/flashtool/files/auto2731evb-ivt-main/flashproc.py b/meta/meta-mediatek-mt2731/recipes-devtools/flashtool/files/auto2731evb-ivt-main/flashproc.py
new file mode 100644
index 0000000..db2a1eb
--- /dev/null
+++ b/meta/meta-mediatek-mt2731/recipes-devtools/flashtool/files/auto2731evb-ivt-main/flashproc.py
@@ -0,0 +1,142 @@
+#!/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', 'flash', 'nand0', 'MBR_NAND'],
+ ['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.ubi'],
+ ['fastboot', 'flash', 'system_a', 'system.img'],
+ ['fastboot', 'flash', 'system_b', 'system.img'],
+ ['fastboot', 'flash', 'userdata', 'userdata.img'],
+ ['fastboot', 'flash', 'vbmeta_a', 'vbmeta.img'],
+ ['fastboot', 'flash', 'vbmeta_b', 'vbmeta.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.img'],
+ ['fastboot', 'erase', 'vbmeta_a'],
+ ['fastboot', 'flash', 'vbmeta_a', 'vbmeta.img'],
+ ['fastboot', 'erase', 'vbmeta_b'],
+ ['fastboot', 'flash', 'vbmeta_b', 'vbmeta.img']]
+}
+
+# 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
diff --git a/meta/meta-mediatek-mt2731/recipes-devtools/flashtool/files/auto2731evb-ivt-test/flashproc.py b/meta/meta-mediatek-mt2731/recipes-devtools/flashtool/files/auto2731evb-ivt-test/flashproc.py
new file mode 100644
index 0000000..c623175
--- /dev/null
+++ b/meta/meta-mediatek-mt2731/recipes-devtools/flashtool/files/auto2731evb-ivt-test/flashproc.py
@@ -0,0 +1,139 @@
+#!/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
diff --git a/meta/meta-mediatek-mt2731/recipes-devtools/flashtool/files/auto2731evb-ivt-vp1/flashproc.py b/meta/meta-mediatek-mt2731/recipes-devtools/flashtool/files/auto2731evb-ivt-vp1/flashproc.py
new file mode 100644
index 0000000..c58be5c
--- /dev/null
+++ b/meta/meta-mediatek-mt2731/recipes-devtools/flashtool/files/auto2731evb-ivt-vp1/flashproc.py
@@ -0,0 +1,146 @@
+#!/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', 'mmc0'],
+ ['fastboot', 'erase', 'mmc0boot0'],
+ ['fastboot', 'erase', 'nand0'],
+ ['fastboot', 'flash', 'nand0', 'MBR_NAND'],
+ ['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.ubi'],
+ ['fastboot', 'flash', 'system_a', 'system.img'],
+ ['fastboot', 'flash', 'system_b', 'system.img'],
+ ['fastboot', 'flash', 'userdata', 'userdata.img'],
+ ['fastboot', 'flash', 'vbmeta_a', 'vbmeta.img'],
+ ['fastboot', 'flash', 'vbmeta_b', 'vbmeta.img'],
+ ['fastboot', 'flash', 'hsm_os', 'hsm_os.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.img'],
+ ['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.ubi'],
+ ['fastboot', 'erase', 'vbmeta_a'],
+ ['fastboot', 'flash', 'vbmeta_a', 'vbmeta.img'],
+ ['fastboot', 'erase', 'vbmeta_b'],
+ ['fastboot', 'flash', 'vbmeta_b', 'vbmeta.img']]
+}
+
+# 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
diff --git a/meta/meta-mediatek-mt2731/recipes-devtools/flashtool/files/auto2731evb-ivt-vp2/flashproc.py b/meta/meta-mediatek-mt2731/recipes-devtools/flashtool/files/auto2731evb-ivt-vp2/flashproc.py
new file mode 100644
index 0000000..7104ae8
--- /dev/null
+++ b/meta/meta-mediatek-mt2731/recipes-devtools/flashtool/files/auto2731evb-ivt-vp2/flashproc.py
@@ -0,0 +1,140 @@
+#!/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'],
+ ['fastboot', 'flash', 'hsm_os', 'hsm_os.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.ext4'],
+ ['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.img']]
+}
+
+# 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
diff --git a/meta/meta-mediatek-mt2731/recipes-devtools/flashtool/files/auto2731evb-ivt-vp3-user/flashproc.py b/meta/meta-mediatek-mt2731/recipes-devtools/flashtool/files/auto2731evb-ivt-vp3-user/flashproc.py
new file mode 100644
index 0000000..22e7e45
--- /dev/null
+++ b/meta/meta-mediatek-mt2731/recipes-devtools/flashtool/files/auto2731evb-ivt-vp3-user/flashproc.py
@@ -0,0 +1,135 @@
+#!/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', 'mmc0'],
+ ['fastboot', 'erase', 'mmc0boot0'],
+ ['fastboot', 'erase', 'nand0'],
+ ['fastboot', 'flash', 'nand0', 'MBR_NAND'],
+ ['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.ubi'],
+ ['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.img']]
+}
+
+# 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
diff --git a/meta/meta-mediatek-mt2731/recipes-devtools/flashtool/files/auto2731evb-ivt-vp3/flashproc.py b/meta/meta-mediatek-mt2731/recipes-devtools/flashtool/files/auto2731evb-ivt-vp3/flashproc.py
new file mode 100644
index 0000000..5904b5c
--- /dev/null
+++ b/meta/meta-mediatek-mt2731/recipes-devtools/flashtool/files/auto2731evb-ivt-vp3/flashproc.py
@@ -0,0 +1,139 @@
+#!/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', 'mmc0'],
+ ['fastboot', 'erase', 'mmc0boot0'],
+ ['fastboot', 'erase', 'nand0'],
+ ['fastboot', 'flash', 'nand0', 'MBR_NAND'],
+ ['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.ubi'],
+ ['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.img']]
+}
+
+# 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
diff --git a/meta/meta-mediatek-mt2731/recipes-devtools/flashtool/files/auto2731evb-ivt-vp4/flashproc.py b/meta/meta-mediatek-mt2731/recipes-devtools/flashtool/files/auto2731evb-ivt-vp4/flashproc.py
new file mode 100644
index 0000000..5904b5c
--- /dev/null
+++ b/meta/meta-mediatek-mt2731/recipes-devtools/flashtool/files/auto2731evb-ivt-vp4/flashproc.py
@@ -0,0 +1,139 @@
+#!/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', 'mmc0'],
+ ['fastboot', 'erase', 'mmc0boot0'],
+ ['fastboot', 'erase', 'nand0'],
+ ['fastboot', 'flash', 'nand0', 'MBR_NAND'],
+ ['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.ubi'],
+ ['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.img']]
+}
+
+# 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
diff --git a/meta/meta-mediatek-mt2731/recipes-devtools/flashtool/files/flashimage.py b/meta/meta-mediatek-mt2731/recipes-devtools/flashtool/files/flashimage.py
new file mode 100644
index 0000000..9bdef11
--- /dev/null
+++ b/meta/meta-mediatek-mt2731/recipes-devtools/flashtool/files/flashimage.py
@@ -0,0 +1,387 @@
+#!/usr/bin/python
+
+import os
+import os.path
+import sys
+import platform
+import argparse
+import shlex
+import subprocess
+import time
+import re
+
+################################################################################
+# check python version
+if sys.hexversion >= 0x02070000:
+ pass
+else:
+ print('Please install Python 2.7.x or newer to run this script')
+ exit(1)
+
+# override input() in python2
+try:
+ input = raw_input
+except NameError:
+ pass
+
+################################################################################
+
+verbose = False
+for_nata = False
+skipFlash = False
+
+fbtool = 'fbtool.py'
+fastboot = 'fastboot'
+
+system = platform.system()
+machine = platform.machine()
+product_out = os.path.abspath('.')
+
+if 'Windows' in system or 'CYGWIN' in system:
+ fastboot += '.exe'
+elif 'Linux' in system:
+ if 'x86_64' in machine:
+ fastboot += '-linux-x86_64'
+ elif 'arm' in machine or 'aarch64' in machine:
+ fastboot += '-linux-arm'
+elif 'Darwin' in system:
+ fastboot += '-darwin'
+
+# Generate image list from procedure list
+
+
+def getImageList(procs):
+ imgs = []
+ try:
+ for p in procs:
+ if p[0] == 'fastboot' and p[1] == 'flash' and p[3] not in imgs:
+ imgs.append(p[3])
+ except Exception as e:
+ print(e)
+ return imgs
+
+
+def call(cmd):
+ '''cmd: the command list for subprocess.call'''
+ if verbose:
+ print('call:', ' '.join(cmd))
+ if for_nata is True:
+ return subprocess.call(cmd, stdout=sys.stdout, stderr=subprocess.STDOUT, shell=True)
+ else:
+ return subprocess.call(formatArgsForSubprocess(cmd))
+
+def check_output(cmd):
+ '''cmd: the command list for subprocess.check_output'''
+ if verbose:
+ print('check_output:', ' '.join(cmd))
+ return subprocess.check_output(formatArgsForSubprocess(cmd), stderr=subprocess.STDOUT)
+
+
+def checkImage(filename, needreboot=True, _verbose=False):
+ filepath = os.path.join(product_out, filename)
+ if os.path.exists(filepath):
+ if _verbose:
+ print(filename.rjust(39, ' ') + ':' + ' PASS')
+ return filepath
+ if needreboot:
+ print(filename.rjust(39, ' ') + ':' + ' FAIL')
+ if args.nata:
+ print('[AT] Image not exist!')
+ else:
+ call([fastboot, 'reboot'])
+ exit(1)
+ return None
+
+# return 0 if success
+
+
+def cmdRun(cmd, dryrun=False):
+ ret = 1
+ raw_cmd = []
+ if cmd[0] == 'daWait':
+ daWait()
+ print('')
+ return 0
+ elif cmd[0] == 'fbWait':
+ fbWait()
+ print('')
+ return 0
+ elif cmd[0] == 'fastboot': # processing fastboot commands
+ cmd[0] = fastboot
+ if cmd[1] == 'flash':
+ # check if image path exits and valid
+ filepath = checkImage(cmd[3], False, False)
+ if filepath != None:
+ if 'CYGWIN' in system:
+ p = subprocess.check_output(
+ 'cygpath --absolute --mixed %s' % filepath)
+ if p:
+ filepath = p.strip()
+ raw_cmd += [cmd[0], cmd[1], cmd[2], filepath]
+ else:
+ raw_cmd += cmd
+ else:
+ print('FAIL: Unknown command!')
+ return -1
+ if dryrun:
+ print(' '.join(raw_cmd))
+ ret = 0
+ else:
+ ret = call(raw_cmd)
+ # Bypass fastboot continue
+ if cmd[1] == 'continue':
+ ret = 0
+ if ret == 0 and cmd[0] == 'fastboot' and cmd[1] == 'reboot-bootloader' and not dryrun:
+ fbWait()
+ return ret
+
+
+def daWait(secs=60):
+ print('Waiting for DA mode')
+ ret = None
+ for i in range(secs):
+ sys.stdout.write('.')
+ sys.stdout.flush()
+ time.sleep(1)
+ ret = check_output('python %s ' % fbtool)
+ if ret != None and len(ret) != 0:
+ print('')
+ print('datool - device detected: ')
+ break
+ if ret == None:
+ print('No device detected. Please ensure that datool is running')
+ exit(1)
+
+
+def fbWait(secs=60):
+ print('Waiting for fastboot mode')
+ ret = None
+ for i in range(secs):
+ sys.stdout.write('.')
+ sys.stdout.flush()
+ time.sleep(1)
+ ret = check_output('%s devices' % fastboot)
+ if ret != None and len(ret) != 0:
+ print('')
+ print('Fastboot - device detected: %s' % (ret.split())[0])
+ break
+ if ret == None:
+ print('No device detected. Please ensure that fastboot is running on the target device')
+ exit(1)
+
+
+def cmdReboot(toBootloader=True):
+ if toBootloader:
+ call([fastboot, 'reboot-bootloader'])
+ fbWait()
+ else:
+ call([fastboot, 'reboot'])
+
+
+def formatArgsForSubprocess(cmd):
+ if not 'Windows' in system:
+ return shlex.split(cmd)
+ else:
+ return cmd
+
+
+if __name__ == '__main__':
+ # parse args
+ parser = argparse.ArgumentParser(
+ description='''
+Auto device flasher, Python 2.7.x required
+''',
+ formatter_class=argparse.RawTextHelpFormatter)
+ parser.add_argument('partition', nargs='?', default='all',
+ help='partition to flash [default: all] , not include test partition')
+ parser.add_argument('-d', '--dryrun', action='store_true', default=False,
+ help='dryrun for debug, no image would be flashed')
+ parser.add_argument('-u', '--user', action='store_true', default=False,
+ help='Flash user data partition')
+ parser.add_argument('-b', '--boot', action='store_true', default=False,
+ help='Flash boot partition')
+ parser.add_argument('-t', '--test', action='store_true', default=False,
+ help='Flash test partition')
+ parser.add_argument('-v', '--verbose', action='store_true', default=False,
+ help='print more information while flashing')
+ parser.add_argument('-n', '--nata', action = 'store_true', default = False,
+ help = 'Flash image in nata')
+ parser.add_argument('--toolsdir', default=None,
+ help='''\
+The tools dir where to find fbtool and fastboot.
+Path priority order:
+ 1. --toolsdir specified
+ 2. current directory
+ 3. $PATH
+''')
+ parser.add_argument('--productdir', default=None,
+ help='''\
+The product out directory where to find images.
+Path priority order:
+ 1. --productdir specified
+ 2. current directory
+''')
+
+ args = parser.parse_args()
+ verbose = args.verbose
+ if args.dryrun:
+ verbose = True
+
+ print('')
+ parser.print_usage()
+ print('')
+ print(''.center(80, '*'))
+ print(('Running flasher on ' + platform.platform()).center(80))
+ print(''.center(80, '*'))
+ print('')
+
+ if args.nata:
+ for_nata = True
+ args.toolsdir = os.path.abspath(os.path.dirname(__file__))
+ args.productdir = args.toolsdir
+ print ('[AT] Flash Dir: %s' %args.productdir)
+
+ try:
+ from flashproc import getFlashProc
+ except ImportError as e:
+ print('ImportError:', e)
+ print('')
+ exit(1)
+ try:
+ from flashproc import getFlashUserProc
+ except:
+ getFlashUserProc = getFlashProc
+ try:
+ from flashproc import getFlashBootProc
+ except:
+ getFlashBootProc = getFlashProc
+ try:
+ from flashproc import getFlashTestProc
+ except:
+ getFlashTestProc = getFlashProc
+
+ # check flash tools
+ toolsdir = ''
+ try:
+ if args.toolsdir:
+ toolsdir = os.path.abspath(args.toolsdir)
+ fbtool = os.path.join(toolsdir, fbtool)
+ fastboot = os.path.join(toolsdir, fastboot)
+ if not os.path.exists(fbtool) or not os.path.exists(fastboot):
+ raise Exception(str(toolsdir))
+ else:
+ toolsdir = os.path.abspath('.')
+ if os.path.exists(os.path.join(toolsdir, fbtool)) and os.path.exists(os.path.join(toolsdir, fastboot)):
+ fbtool = os.path.join(toolsdir, fbtool)
+ fastboot = os.path.join(toolsdir, fastboot)
+ except Exception as e:
+ print('Can not find fbtool or fastboot in %s' % str(e))
+ print('')
+ exit(1)
+
+ devProduct = 'DEFAULT'
+
+ procs = getFlashProc(devProduct)
+ if args.user:
+ procs = getFlashUserProc(devProduct)
+ if args.boot:
+ procs = getFlashBootProc(devProduct)
+ if args.test:
+ procs = getFlashTestProc(devProduct)
+ if procs:
+ if verbose:
+ print('Flash procedure'.center(80))
+ print(''.center(80, '-'))
+ for p in procs:
+ print('fastboot', ' '.join(p))
+ print('')
+ else:
+ print('Can not retrieve flash procedure according to product type of', devProduct)
+ print('Exit !')
+ exit(1)
+
+ # check image path
+ if args.productdir:
+ # take user specific product directory
+ product_out = os.path.abspath(args.productdir)
+ else:
+ # check current directory
+ product_out = os.path.abspath('.')
+ for img in getImageList(procs):
+ if checkImage(img, False, False) is None:
+ product_out = None
+ break
+ if product_out is None:
+ product_out = os.getenv('PRODUCT_OUT', '.')
+ product_out = os.path.abspath(product_out)
+
+ print(''.center(80, '*'))
+ print('* flash images under:'.ljust(79, ' ') + '*')
+ print('* ' + product_out.ljust(73, ' ') + '*')
+ print(''.center(80, '*'))
+ print('')
+
+ # check images
+ print('Checking image'.center(80))
+ print(''.center(80, '-'))
+ images = getImageList(procs)
+ try:
+ for img in images:
+ checkImage(img, _verbose=True)
+ except Exception as e:
+ print(e)
+ time.sleep(2)
+ if args.nata:
+ print ('[AT] Check image fail, stop to flash!')
+ else:
+ cmdReboot(False)
+ input('Fail, press enter to exit: ')
+ exit(1)
+ # For NATA
+ if args.nata:
+ #POWER OFF
+ print ('[AT] POWER PIN KEY:0, %s' %time.ctime())
+ time.sleep(2)
+ #PRESS DOWNLOAD KEY
+ print ('[AT] DOWNLOAD KEY:1, %s' %time.ctime())
+ time.sleep(2)
+ #POWER ON
+ print ('[AT] POWER PIN KEY:1, %s' %time.ctime())
+ time.sleep(2)
+
+ # align 4kb for modem related images
+ os.system('python align_4kb.py \"%s\"' % checkImage('md1img.img', False, False))
+
+ # flash images
+ print('')
+ print('Start flashing'.center(80))
+ print(''.center(80, '-'))
+ try:
+ for proc in procs:
+ if skipFlash == False:
+ if 0 != cmdRun(proc, args.dryrun):
+ raise Exception('<<FAILED>> %s' % ' '.join(proc))
+ else:
+ if proc[0] == 'fastboot' and proc[1] == 'flash':
+ print('Skip flashing', proc[3])
+ except Exception as e:
+ print(e)
+ if args.nata:
+ #RELEASE DOWNLOAD KEY
+ print ('[AT] DOWNLOAD KEY:0, %s' %time.ctime())
+ time.sleep(2)
+ time.sleep(2)
+ cmdReboot(False)
+ exit(1)
+
+ if args.nata:
+ #RELEASE DOWNLOAD KEY
+ print ('[AT] DOWNLOAD KEY:0, %s' %time.ctime())
+ time.sleep(2)
+ time.sleep(2)
+ cmdReboot(False)
+ print('')
+ if args.nata:
+ print ('[AT] Flash Success')
+ else:
+ print('Success')