[Feature]add MT2731_MP2_MR2_SVN388 baseline version

Change-Id: Ief04314834b31e27effab435d3ca8ba33b499059
diff --git a/meta/meta-mediatek/classes/create-mtdverity.bbclass b/meta/meta-mediatek/classes/create-mtdverity.bbclass
new file mode 100644
index 0000000..e4a3fdb
--- /dev/null
+++ b/meta/meta-mediatek/classes/create-mtdverity.bbclass
@@ -0,0 +1,28 @@
+MTDVERITY_TOOL_DIR="${TOPDIR}/../src/devtools/nfsb/mtd_verity"
+MTDVERITY_TOOL="${MTDVERITY_TOOL_DIR}/mtd_verity"
+MTDVERITY_WORKING_PATH="${DEPLOY_DIR_IMAGE}"
+OLD_ROOTFS_NAME="${IMAGE_NAME}.rootfs.${IMAGE_FSTYPES}"
+NEW_ROOTFS_NAME="mtdverity_system.${IMAGE_FSTYPES}"
+IMG_KEY_FILE = "${MTK_KEY_DIR}/${VERIFIED_KEY}.pem"
+
+do_mtdverity_for_rootfs() {
+
+       if [ "${SECURE_BOOT_ENABLE}" = "yes" ] && [ "${ENABLE_ROOTFS_CHECK}" = "yes" ]; then
+			if [ "${STANDALONE_SIGN_PREPARE}" = "yes" ];then
+				exit 0
+			fi
+                        if [ ! -f ${MTDVERITY_WORKING_PATH}/${OLD_ROOTFS_NAME} ]; then
+			    cp ${MTDVERITY_WORKING_PATH}/${IMAGE_BASENAME}-${MACHINE}.${IMAGE_FSTYPES} ${MTDVERITY_WORKING_PATH}/${OLD_ROOTFS_NAME}
+			fi
+                       ${MTDVERITY_TOOL} ${MTDVERITY_WORKING_PATH}/${OLD_ROOTFS_NAME} 1048576 1048576 10 ${IMG_KEY_FILE} ${MTDVERITY_WORKING_PATH}/${NEW_ROOTFS_NAME}
+                       rm -f ${MTDVERITY_WORKING_PATH}/${OLD_ROOTFS_NAME}
+                       mv ${MTDVERITY_WORKING_PATH}/${NEW_ROOTFS_NAME} ${MTDVERITY_WORKING_PATH}/${OLD_ROOTFS_NAME}
+       else
+              exit 0
+       fi
+}
+
+addtask mtdverity_for_rootfs after do_image_complete before do_packing_images_post_funcs
+do_rootfs[nostamp] = "1"
+
+#IMAGE_POSTPROCESS_COMMAND += " add_mtdverity_for_rootfs;"