blob: e4a3fdb0239c6193f415ea630bf4cbfb6389c995 [file] [log] [blame]
rjw1f884582022-01-06 17:20:42 +08001MTDVERITY_TOOL_DIR="${TOPDIR}/../src/devtools/nfsb/mtd_verity"
2MTDVERITY_TOOL="${MTDVERITY_TOOL_DIR}/mtd_verity"
3MTDVERITY_WORKING_PATH="${DEPLOY_DIR_IMAGE}"
4OLD_ROOTFS_NAME="${IMAGE_NAME}.rootfs.${IMAGE_FSTYPES}"
5NEW_ROOTFS_NAME="mtdverity_system.${IMAGE_FSTYPES}"
6IMG_KEY_FILE = "${MTK_KEY_DIR}/${VERIFIED_KEY}.pem"
7
8do_mtdverity_for_rootfs() {
9
10 if [ "${SECURE_BOOT_ENABLE}" = "yes" ] && [ "${ENABLE_ROOTFS_CHECK}" = "yes" ]; then
11 if [ "${STANDALONE_SIGN_PREPARE}" = "yes" ];then
12 exit 0
13 fi
14 if [ ! -f ${MTDVERITY_WORKING_PATH}/${OLD_ROOTFS_NAME} ]; then
15 cp ${MTDVERITY_WORKING_PATH}/${IMAGE_BASENAME}-${MACHINE}.${IMAGE_FSTYPES} ${MTDVERITY_WORKING_PATH}/${OLD_ROOTFS_NAME}
16 fi
17 ${MTDVERITY_TOOL} ${MTDVERITY_WORKING_PATH}/${OLD_ROOTFS_NAME} 1048576 1048576 10 ${IMG_KEY_FILE} ${MTDVERITY_WORKING_PATH}/${NEW_ROOTFS_NAME}
18 rm -f ${MTDVERITY_WORKING_PATH}/${OLD_ROOTFS_NAME}
19 mv ${MTDVERITY_WORKING_PATH}/${NEW_ROOTFS_NAME} ${MTDVERITY_WORKING_PATH}/${OLD_ROOTFS_NAME}
20 else
21 exit 0
22 fi
23}
24
25addtask mtdverity_for_rootfs after do_image_complete before do_packing_images_post_funcs
26do_rootfs[nostamp] = "1"
27
28#IMAGE_POSTPROCESS_COMMAND += " add_mtdverity_for_rootfs;"