From 323362f682f327ca83c94a34a3e53d1f2bdd85ac Mon Sep 17 00:00:00 2001 From: Emekcan Aras Date: Wed, 19 Apr 2023 17:54:20 +0100 Subject: [PATCH] arm-bsp/trusted-firmware-m: apply patches correctly from external repos TF-M has out-of-tree patches on external projects such as mbedtls and qcbor. This needs to be applied in an orderly fashion to build TF-M and other TF-M related binaries correctly. Signed-off-by: Emekcan Aras Signed-off-by: Jon Mason --- .../trusted-firmware-m-1.7.0-corstone1000.inc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m-1.7.0-corstone1000.inc b/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m-1.7.0-corstone1000.inc index 5e44ea52..b6f30613 100644 --- a/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m-1.7.0-corstone1000.inc +++ b/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m-1.7.0-corstone1000.inc @@ -42,6 +42,16 @@ SRC_URI:append:corstone1000 = " \ file://0012-Platform-Corstone1000-get-fwu-and-private-metadata-f.patch \ " +# TF-M ships patches for external dependencies that needs to be applied +apply_tfm_patches() { + find ${S}/lib/ext/qcbor -type f -name '*.patch' -print0 | sort -z | xargs -r -t -0 -n 1 patch -p1 -d ${S}/../qcbor/ -i + find ${S}/lib/ext/mbedcrypto -type f -name '*.patch' -print0 | sort -z | xargs -r -t -0 -n 1 patch -p1 -d ${S}/../mbedtls/ -i + find ${S}/lib/ext/mcuboot -type f -name '*.patch' -print0 | sort -z | xargs -r -t -0 -n 1 patch -p1 -d ${S}/../mcuboot/ -i + find ${S}/lib/ext/tf-m-tests -type f -name '*.patch' -print0 | sort -z | xargs -r -t -0 -n 1 patch -p1 -d ${S}/../tf-m-tests/ -i +} + +do_patch[postfuncs] += "apply_tfm_patches" + do_install() { install -D -p -m 0644 ${B}/install/outputs/tfm_s_signed.bin ${D}/firmware/tfm_s_signed.bin install -D -p -m 0644 ${B}/install/outputs/bl2_signed.bin ${D}/firmware/bl2_signed.bin