From da4145dd13d7538844e564f29c4cf09ac81f824b Mon Sep 17 00:00:00 2001 From: Arturo Buzarra Date: Fri, 29 May 2020 11:26:11 +0200 Subject: [PATCH] imx-mkimage: move recipe to native and include its binaries in the SDK imx-mkimage is a host recipe to provide the mkimage_imx8 binaries, required for the trustfence support with platform based on AHAB (ccimx8x). Since these binaries are required to the sign process we need to export it in the SDK to allow the standalone sign mode, and with that we can simplify the mechanism to share these binaries with another recipes (u-boot, linux). Also the do_deploy() from imx-mkimage recipe was removed to avoid overriding the implementation from the native class and allow populating the mkimage binaries. Signed-off-by: Arturo Buzarra --- meta-digi-arm/classes/image_types_digi.bbclass | 5 ++--- .../recipes-bsp/imx-mkimage/imx-mkimage_%.bbappend | 7 ------- .../recipes-bsp/imx-mkimage/imx-mkimage_git.bb | 7 ++----- meta-digi-arm/recipes-bsp/u-boot/digi-u-boot.inc | 5 ++--- .../nativesdk-packagegroup-sdk-host.bbappend | 11 +++++++++-- .../trustfence/trustfence-sign-tools_git.bb | 1 + meta-digi-arm/recipes-kernel/linux/linux-dey.inc | 7 +++---- 7 files changed, 19 insertions(+), 24 deletions(-) delete mode 100644 meta-digi-arm/recipes-bsp/imx-mkimage/imx-mkimage_%.bbappend diff --git a/meta-digi-arm/classes/image_types_digi.bbclass b/meta-digi-arm/classes/image_types_digi.bbclass index a3e0a3f88..60bd5d6b7 100644 --- a/meta-digi-arm/classes/image_types_digi.bbclass +++ b/meta-digi-arm/classes/image_types_digi.bbclass @@ -208,7 +208,7 @@ trustence_sign_cpio() { [ -n "${TRUSTFENCE_SIGN_MODE}" ] && export CONFIG_SIGN_MODE="${TRUSTFENCE_SIGN_MODE}" if [ "${TRUSTFENCE_SIGN_MODE}" = "AHAB" ]; then - ${DEPLOY_DIR_IMAGE}/imx-boot-tools/mkimage_imx8 -soc ${MX8_SOC_VAR} -rev ${MX8_CHIP_REV} -c -ap ${1} a35 ${RAM_CONTAINER_LOC_TF} -out ${1}-mkimg + mkimage_imx8 -soc ${MX8_SOC_VAR} -rev ${MX8_CHIP_REV} -c -ap ${1} a35 ${RAM_CONTAINER_LOC_TF} -out ${1}-mkimg mv "${1}-mkimg" "${1}" fi # Sign/encrypt the ramdisk @@ -220,8 +220,7 @@ trustence_sign_cpio() { } CONVERSIONTYPES += "tf" CONVERSION_CMD_tf = "trustence_sign_cpio ${IMAGE_NAME}.rootfs.${type}" -CONVERSION_DEPENDS_tf = "${@oe.utils.conditional('TRUSTFENCE_SIGN', '1', \ - oe.utils.conditional('TRUSTFENCE_SIGN_MODE', 'AHAB', 'trustfence-sign-tools-native imx-mkimage', 'trustfence-sign-tools-native', d), '', d)}" +CONVERSION_DEPENDS_tf = "${@oe.utils.conditional('TRUSTFENCE_SIGN', '1', 'trustfence-sign-tools-native', '', d)}" IMAGE_TYPES += "cpio.gz.u-boot.tf" ################################################################################ diff --git a/meta-digi-arm/recipes-bsp/imx-mkimage/imx-mkimage_%.bbappend b/meta-digi-arm/recipes-bsp/imx-mkimage/imx-mkimage_%.bbappend deleted file mode 100644 index 8ca737057..000000000 --- a/meta-digi-arm/recipes-bsp/imx-mkimage/imx-mkimage_%.bbappend +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (C) 2018-2020 Digi International, Inc. - -do_deploy_append () { - install -d ${DEPLOYDIR}/${BOOT_TOOLS} - install -m 0755 ${S}/iMX8M/mkimage_imx8 ${DEPLOYDIR}/${BOOT_TOOLS}/mkimage_imx8m - install -m 0755 ${S}/mkimage_imx8 ${DEPLOYDIR}/${BOOT_TOOLS}/mkimage_imx8 -} diff --git a/meta-digi-arm/recipes-bsp/imx-mkimage/imx-mkimage_git.bb b/meta-digi-arm/recipes-bsp/imx-mkimage/imx-mkimage_git.bb index 65ed37b35..d76f879c2 100644 --- a/meta-digi-arm/recipes-bsp/imx-mkimage/imx-mkimage_git.bb +++ b/meta-digi-arm/recipes-bsp/imx-mkimage/imx-mkimage_git.bb @@ -31,8 +31,5 @@ do_install () { install -m 0755 mkimage_imx8 ${D}${bindir}/mkimage_imx8 } -do_deploy () { - install -m 0644 ${S}/iMX8QM/imx8qm_dcd.cfg.tmp ${DEPLOYDIR} - install -m 0644 ${S}/iMX8QX/imx8qx_dcd.cfg.tmp ${DEPLOYDIR} -} -addtask deploy before do_build after do_install +FILES_${PN} = "${bindir}" +BBCLASSEXTEND = "native nativesdk" diff --git a/meta-digi-arm/recipes-bsp/u-boot/digi-u-boot.inc b/meta-digi-arm/recipes-bsp/u-boot/digi-u-boot.inc index 279082c75..1599ddcd7 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/digi-u-boot.inc +++ b/meta-digi-arm/recipes-bsp/u-boot/digi-u-boot.inc @@ -8,8 +8,7 @@ LIC_FILES_CHKSUM = "file://Licenses/README;md5=a2c678cfd4a4d97135585cad908541c6" SECTION = "bootloaders" DEPENDS += "bc-native dtc-native u-boot-mkimage-native" -DEPENDS += "${@oe.utils.conditional('TRUSTFENCE_SIGN', '1', \ - oe.utils.conditional('TRUSTFENCE_SIGN_MODE', 'AHAB', 'trustfence-sign-tools-native imx-mkimage', 'trustfence-sign-tools-native', d), '', d)}" +DEPENDS += "${@oe.utils.conditional('TRUSTFENCE_SIGN', '1', 'trustfence-sign-tools-native', '', d)}" PROVIDES += "u-boot" @@ -190,7 +189,7 @@ do_deploy_append_ccimx8x() { mv ${DEPLOYDIR}/u-boot* ${DEPLOYDIR}/${BOOT_TOOLS}/ mv ${DEPLOYDIR}/${UBOOT_SYMLINK}-* ${DEPLOYDIR}/${BOOT_TOOLS}/ if [ "${TRUSTFENCE_SIGN}" = "1" ]; then - ${DEPLOY_DIR_IMAGE}/${BOOT_TOOLS}/mkimage_imx8 -soc ${MX8_SOC_VAR} -rev ${MX8_CHIP_REV} -c -ap ${DEPLOYDIR}/boot.scr a35 ${RAM_CONTAINER_LOC_BOOT} -out ${DEPLOYDIR}/boot-mkimg.scr + mkimage_imx8 -soc ${MX8_SOC_VAR} -rev ${MX8_CHIP_REV} -c -ap ${DEPLOYDIR}/boot.scr a35 ${RAM_CONTAINER_LOC_BOOT} -out ${DEPLOYDIR}/boot-mkimg.scr trustfence-sign-kernel.sh -p "${DIGI_FAMILY}" -b "${DEPLOYDIR}/boot-mkimg.scr" "${DEPLOYDIR}/boot.scr" rm -f ${DEPLOYDIR}/boot-mkimg.scr fi diff --git a/meta-digi-arm/recipes-core/packagegroup/nativesdk-packagegroup-sdk-host.bbappend b/meta-digi-arm/recipes-core/packagegroup/nativesdk-packagegroup-sdk-host.bbappend index eabb44c95..0d55d1c4c 100644 --- a/meta-digi-arm/recipes-core/packagegroup/nativesdk-packagegroup-sdk-host.bbappend +++ b/meta-digi-arm/recipes-core/packagegroup/nativesdk-packagegroup-sdk-host.bbappend @@ -1,5 +1,12 @@ -# Copyright (C) 2016 Digi International. +# Copyright (C) 2016-2020 Digi International. + +# Default TrustFence SDK tools +TRUSTFENCE_SDK_TOOLS ?= "\ + nativesdk-trustfence-sign-tools \ + nativesdk-trustfence-cst \ +" RDEPENDS_${PN} += " \ - ${@oe.utils.conditional('TRUSTFENCE_SIGN', '1', 'nativesdk-trustfence-sign-tools nativesdk-trustfence-cst', '', d)} \ + ${@oe.utils.conditional('TRUSTFENCE_SIGN', '1', \ + oe.utils.conditional('TRUSTFENCE_SIGN_MODE', 'AHAB', '${TRUSTFENCE_SDK_TOOLS} nativesdk-imx-mkimage', '${TRUSTFENCE_SDK_TOOLS}', d), '', d)} \ " diff --git a/meta-digi-arm/recipes-digi/trustfence/trustfence-sign-tools_git.bb b/meta-digi-arm/recipes-digi/trustfence/trustfence-sign-tools_git.bb index 36d0b8800..17d1ab0b6 100644 --- a/meta-digi-arm/recipes-digi/trustfence/trustfence-sign-tools_git.bb +++ b/meta-digi-arm/recipes-digi/trustfence/trustfence-sign-tools_git.bb @@ -4,6 +4,7 @@ LICENSE = "GPL-2.0" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" DEPENDS = "trustfence-cst coreutils util-linux" +DEPENDS += "${@oe.utils.conditional('TRUSTFENCE_SIGN_MODE', 'AHAB', 'imx-mkimage', '', d)}" SRCBRANCH = "v2019.04/master" SRCREV = "${AUTOREV}" diff --git a/meta-digi-arm/recipes-kernel/linux/linux-dey.inc b/meta-digi-arm/recipes-kernel/linux/linux-dey.inc index f057b8344..6919f7f24 100644 --- a/meta-digi-arm/recipes-kernel/linux/linux-dey.inc +++ b/meta-digi-arm/recipes-kernel/linux/linux-dey.inc @@ -5,8 +5,7 @@ LICENSE = "GPLv2" LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7" DEPENDS += "lzop-native bc-native" -DEPENDS += "${@oe.utils.conditional('TRUSTFENCE_SIGN', '1', \ - oe.utils.conditional('TRUSTFENCE_SIGN_MODE', 'AHAB', 'trustfence-sign-tools-native imx-mkimage', 'trustfence-sign-tools-native', d), '', d)}" +DEPENDS += "${@oe.utils.conditional('TRUSTFENCE_SIGN', '1', 'trustfence-sign-tools-native', '', d)}" inherit kernel fsl-kernel-localversion @@ -48,7 +47,7 @@ trustfence_sign() { # Sign the kernel images for type in ${KERNEL_IMAGETYPES}; do KERNEL_IMAGE="${type}-${KERNEL_IMAGE_NAME}.bin" - ${DEPLOY_DIR_IMAGE}/imx-boot-tools/mkimage_imx8 -soc ${MX8_SOC_VAR} -rev ${MX8_CHIP_REV} -c -ap ${WORKDIR}/build/arch/arm64/boot/Image a35 ${RAM_CONTAINER_LOC_BOOT} -out flash_os.bin + mkimage_imx8 -soc ${MX8_SOC_VAR} -rev ${MX8_CHIP_REV} -c -ap ${WORKDIR}/build/arch/arm64/boot/Image a35 ${RAM_CONTAINER_LOC_BOOT} -out flash_os.bin trustfence-sign-kernel.sh -p "${DIGI_FAMILY}" -l "flash_os.bin" "${type}-${MACHINE}-signed.bin" gzip ${type}-${MACHINE}-signed.bin mv ${type}-${MACHINE}-signed.bin.gz "${KERNEL_IMAGE}" @@ -60,7 +59,7 @@ trustfence_sign() { DTB_EXT=${DTB##*.} DTB_BASE_NAME=`basename ${DTB} ."${DTB_EXT}"` DTB_IMAGE="${DTB_BASE_NAME}-${KERNEL_IMAGE_NAME}.${DTB_EXT}" - ${DEPLOY_DIR_IMAGE}/imx-boot-tools/mkimage_imx8 -soc ${MX8_SOC_VAR} -rev ${MX8_CHIP_REV} -c -ap ${DTB_IMAGE} a35 ${RAM_CONTAINER_LOC_DTB} -out ${DTB_IMAGE}-mkimg-signed + mkimage_imx8 -soc ${MX8_SOC_VAR} -rev ${MX8_CHIP_REV} -c -ap ${DTB_IMAGE} a35 ${RAM_CONTAINER_LOC_DTB} -out ${DTB_IMAGE}-mkimg-signed trustfence-sign-kernel.sh -p "${DIGI_FAMILY}" -d "${DTB_IMAGE}-mkimg-signed" "${DTB_IMAGE}-signed" mv "${DTB_IMAGE}-signed" "${DTB_IMAGE}" rm -f ${DTB_IMAGE}-mkimg-signed