diff mbox series

[07/10] arm/trusted-services: use apply_local_src_patches

Message ID 20230929152128.3401009-7-ross.burton@arm.com
State New
Headers show
Series [01/10] arm/apply_local_src_patches: allow use in multiple directories | expand

Commit Message

Ross Burton Sept. 29, 2023, 3:21 p.m. UTC
From: Ross Burton <ross.burton@arm.com>

Now that the apply_local_src_patches class supports being used with
multiple directories, use that instead of reimplementing the logic.

Also remove redundant patchdir assignments as these patches are against
the trusted-services repository, which is ${S}.  I suspect these are
exposing a subtle bug in the core patching logic which meant the local
patches were not applying correctly.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 .../trusted-services/ts-arm-platforms.inc     | 16 ++++++++--------
 .../trusted-services/trusted-services-src.inc | 19 ++++++++++---------
 .../ts-psa-api-test-common_git.inc            | 10 +++-------
 3 files changed, 21 insertions(+), 24 deletions(-)
diff mbox series

Patch

diff --git a/meta-arm-bsp/recipes-security/trusted-services/ts-arm-platforms.inc b/meta-arm-bsp/recipes-security/trusted-services/ts-arm-platforms.inc
index 29e33ffe..551a67dc 100644
--- a/meta-arm-bsp/recipes-security/trusted-services/ts-arm-platforms.inc
+++ b/meta-arm-bsp/recipes-security/trusted-services/ts-arm-platforms.inc
@@ -2,14 +2,14 @@  FILESEXTRAPATHS:prepend:corstone1000 := "${THISDIR}/corstone1000:"
 
 COMPATIBLE_MACHINE:corstone1000 = "corstone1000"
 SRC_URI:append:corstone1000  = " \
-    file://0001-Add-stub-capsule-update-service-components.patch;patchdir=../trusted-services \
-    file://0002-Fixes-in-AEAD-for-psa-arch-test-54-and-58.patch;patchdir=../trusted-services \
-    file://0003-FMP-Support-in-Corstone1000.patch;patchdir=../trusted-services \
-    file://0004-GetNextVariableName-Fix.patch;patchdir=../trusted-services     \
-    file://0005-plat-corstone1000-add-compile-definitions-for-ECP_DP.patch;patchdir=../trusted-services \
-    file://0006-plat-corstone1000-Use-the-stateless-platform-service.patch;patchdir=../trusted-services \
-    file://0007-plat-corstone1000-Initialize-capsule-update-provider.patch;patchdir=../trusted-services \
-    file://0008-plat-corstone1000-change-ns-interrupt-action.patch;patchdir=../trusted-services \
+    file://0001-Add-stub-capsule-update-service-components.patch \
+    file://0002-Fixes-in-AEAD-for-psa-arch-test-54-and-58.patch \
+    file://0003-FMP-Support-in-Corstone1000.patch \
+    file://0004-GetNextVariableName-Fix.patch     \
+    file://0005-plat-corstone1000-add-compile-definitions-for-ECP_DP.patch \
+    file://0006-plat-corstone1000-Use-the-stateless-platform-service.patch \
+    file://0007-plat-corstone1000-Initialize-capsule-update-provider.patch \
+    file://0008-plat-corstone1000-change-ns-interrupt-action.patch \
     "
 
 
diff --git a/meta-arm/recipes-security/trusted-services/trusted-services-src.inc b/meta-arm/recipes-security/trusted-services/trusted-services-src.inc
index 50360b1d..ce073943 100644
--- a/meta-arm/recipes-security/trusted-services/trusted-services-src.inc
+++ b/meta-arm/recipes-security/trusted-services/trusted-services-src.inc
@@ -61,16 +61,17 @@  LIC_FILES_CHKSUM += "file://../openamp/LICENSE.md;md5=a8d8cf662ef6bf9936a1e14135
 
 SRCREV_FORMAT = "trusted-services_dtc_mbedtls_nanopb_qcbor_tcose_cpputest_libmetal_openamp"
 
-# TS ships patches for external dependencies that needs to be applied
-apply_ts_patches() {
-    ( cd ${WORKDIR}/git/qcbor;    git stash; git branch -f bf_am; git am ${S}/external/qcbor/*.patch; git reset bf_am )
-    ( cd ${WORKDIR}/git/tcose;    git stash; git branch -f bf_am; git am ${S}/external/t_cose/*.patch; git reset bf_am )
-    ( cd ${WORKDIR}/git/mbedtls;  git stash; git branch -f bf_am; git am ${S}/external/MbedTLS/*.patch; git reset bf_am )
-    ( cd ${WORKDIR}/git/cpputest; git stash; git apply ${S}/external/CppUTest/*.patch )
-    ( cd ${WORKDIR}/git/dtc;      git stash; git apply ${S}/external/libfdt/*.patch )
-    ( cd ${WORKDIR}/git/nanopb;   git stash; git apply ${S}/external/nanopb/*.patch )
+inherit apply_local_src_patches
+LOCAL_SRC_PATCHES_INPUT_DIR = "N/A"
+
+do_apply_local_src_patches() {
+    apply_local_src_patches ${S}/external/qcbor ${WORKDIR}/git/qcbor
+    apply_local_src_patches ${S}/external/t_cose ${WORKDIR}/git/tcose
+    apply_local_src_patches ${S}/external/MbedTLS ${WORKDIR}/git/mbedtls
+    apply_local_src_patches ${S}/external/CppUTest ${WORKDIR}/git/cpputest
+    apply_local_src_patches ${S}/external/libfdt ${WORKDIR}/git/dtc
+    apply_local_src_patches ${S}/external/nanopb ${WORKDIR}/git/nanopb
 }
-do_patch[postfuncs] += "apply_ts_patches"
 
 # Paths to dependencies required by some TS SPs/tools
 EXTRA_OECMAKE += "-DDTC_SOURCE_DIR=${WORKDIR}/git/dtc \
diff --git a/meta-arm/recipes-security/trusted-services/ts-psa-api-test-common_git.inc b/meta-arm/recipes-security/trusted-services/ts-psa-api-test-common_git.inc
index 8a7b0e5c..c8b4e992 100644
--- a/meta-arm/recipes-security/trusted-services/ts-psa-api-test-common_git.inc
+++ b/meta-arm/recipes-security/trusted-services/ts-psa-api-test-common_git.inc
@@ -16,15 +16,11 @@  SRC_URI += "git://github.com/ARM-software/psa-arch-tests.git;name=psatest;protoc
 SRCREV_psatest = "38cb53a4d9e292435ddf7899960b15af62decfbe"
 LIC_FILES_CHKSUM += "file://../psatest/LICENSE.md;md5=2a944942e1496af1886903d274dedb13"
 
-EXTRA_OECMAKE += "\
-                  -DPSA_ARCH_TESTS_SOURCE_DIR=${WORKDIR}/git/psatest \
-                 "
+EXTRA_OECMAKE += "-DPSA_ARCH_TESTS_SOURCE_DIR=${WORKDIR}/git/psatest"
 
-# TS check if there are patches to apply to psa-arch-tests, if so apply them
-apply_ts_patch() {
-    find ${S}/external/psa_arch_tests -type f -name '*.patch' -exec patch -p1 -d ${WORKDIR}/git/psatest -i {} \;
+do_apply_local_src_patches:append() {
+    apply_local_src_patches ${S}/external/psa_arch_tests ${WORKDIR}/git/psatest
 }
-do_patch[postfuncs] += "apply_ts_patch"
 
 FILES:${PN} = "${bindir}/${PSA_TEST}"