diff mbox series

arm/trusted-firmware-m: apply TF-M downstream patches

Message ID 20250725105305.9589-1-hamideh.izadyar@arm.com
State New
Headers show
Series arm/trusted-firmware-m: apply TF-M downstream patches | expand

Commit Message

Hamideh Izadyar July 25, 2025, 10:53 a.m. UTC
Apply TF-M downstream patches in the main TF-M recipe, rather than doing
it in corstone1000 recipe.

Signed-off-by: Hamideh Izadyar <hamideh.izadyar@arm.com>
---
 .../trusted-firmware-m-corstone1000.inc              | 10 ----------
 .../trusted-firmware-m-2.1.1-src.inc                 | 11 +++++++++++
 .../trusted-firmware-m-2.2.0-src.inc                 | 12 ++++++++++++
 3 files changed, 23 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m-corstone1000.inc b/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m-corstone1000.inc
index e3a07b72..b47dbe9b 100644
--- a/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m-corstone1000.inc
+++ b/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m-corstone1000.inc
@@ -51,16 +51,6 @@  SRC_URI:append:corstone1000-mps3 = " \
     file://0003-Fix-psa_key_handle_t-initialization.patch;patchdir=../tfm-psa-adac \
     "
 
-# 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}/bin/tfm_s_signed.bin ${D}/firmware/tfm_s_signed.bin
   install -D -p -m 0644 ${B}/bin/bl2_signed.bin ${D}/firmware/bl2_signed.bin
diff --git a/meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m-2.1.1-src.inc b/meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m-2.1.1-src.inc
index 1e47589d..5eaf48c5 100644
--- a/meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m-2.1.1-src.inc
+++ b/meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m-2.1.1-src.inc
@@ -55,3 +55,14 @@  SRCREV_tfm-psa-adac = "5f5490cebe66ae997f316f83c3fbf1f97deef625"
 SRCREV_FORMAT = "tfm"
 
 S = "${UNPACKDIR}/tfm"
+
+# Apply patches
+inherit apply_local_src_patches
+LOCAL_SRC_PATCHES_INPUT_DIR = "N/A"
+
+do_apply_local_src_patches() {
+    apply_local_src_patches ${S}/lib/ext/qcbor ${UNPACKDIR}/qcbor
+    apply_local_src_patches ${S}/lib/ext/mbedcrypto ${UNPACKDIR}/mbedtls
+    apply_local_src_patches ${S}/lib/ext/mcuboot ${UNPACKDIR}/mcuboot
+    apply_local_src_patches ${S}/lib/ext/tf-m-tests ${UNPACKDIR}/tf-m-tests
+}
diff --git a/meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m-2.2.0-src.inc b/meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m-2.2.0-src.inc
index c2015253..4162cc9c 100644
--- a/meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m-2.2.0-src.inc
+++ b/meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m-2.2.0-src.inc
@@ -64,3 +64,15 @@  SRCREV_t-cose = "3076010eeb6383f0827bd992c75b68af9311cf1d"
 SRCREV_FORMAT = "tfm"
 
 S = "${UNPACKDIR}/tfm"
+
+# Apply patches
+inherit apply_local_src_patches
+LOCAL_SRC_PATCHES_INPUT_DIR = "N/A"
+
+do_apply_local_src_patches() {
+    apply_local_src_patches ${S}/lib/ext/qcbor ${UNPACKDIR}/qcbor
+    apply_local_src_patches ${S}/lib/ext/mbedcrypto ${UNPACKDIR}/mbedtls
+    apply_local_src_patches ${S}/lib/ext/mcuboot ${UNPACKDIR}/mcuboot
+    apply_local_src_patches ${S}/lib/ext/tf-m-tests ${UNPACKDIR}/tf-m-tests
+    apply_local_src_patches ${S}/lib/ext/t_cose ${UNPACKDIR}/t_cose
+}