diff --git a/recipes-bsp/trusted-firmware-a/tf-a-tools.inc b/recipes-bsp/trusted-firmware-a/tf-a-tools.inc new file mode 100644 index 0000000..b987a0c --- /dev/null +++ b/recipes-bsp/trusted-firmware-a/tf-a-tools.inc @@ -0,0 +1,43 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/tf-a-tools:" + +SRC_URI:append = " \ + file://0001-tools-allow-to-use-a-root-key-password-from-command-.patch \ + file://0002-fix-fiptool-respect-OPENSSL_DIR.patch \ + file://0003-FIX-openssl-for-nativesdk.patch \ + " + +DEPENDS += "dtc-native openssl" + +COMPATIBLE_HOST:class-target = "null" + +HOSTCC:class-native = "${BUILD_CC}" +HOSTCC:class-nativesdk = "${CC}" + +EXTRA_OEMAKE += "HOSTCC='${HOSTCC}' OPENSSL_DIR='${STAGING_EXECPREFIXDIR}'" +EXTRA_OEMAKE += "certtool fiptool" +EXTRA_OEMAKE += "PLAT=${TFA_PLATFORM}" + +do_configure[noexec] = "1" + +do_compile:prepend:class-native () { + # This is still needed to have the native fiptool executing properly by + # setting the RPATH + sed -e '/^LDLIBS/ s,$, \$\{BUILD_LDFLAGS},' \ + -e '/^INCLUDE_PATHS/ s,$, \$\{BUILD_CFLAGS},' \ + -i ${S}/tools/fiptool/Makefile + # This is still needed to have the native cert_create executing properly by + # setting the RPATH + sed -e '/^LIB_DIR/ s,$, \$\{BUILD_LDFLAGS},' \ + -e '/^INC_DIR/ s,$, \$\{BUILD_CFLAGS},' \ + -i ${S}/tools/cert_create/Makefile +} + +do_install() { + install -d ${D}${bindir} + install -m 0755 \ + ${B}/tools/fiptool/fiptool \ + ${B}/tools/cert_create/cert_create \ + ${D}${bindir} +} + +BBCLASSEXTEND += "native nativesdk" diff --git a/recipes-bsp/trusted-firmware-a/tf-a-tools/0002-fix-fiptool-respect-OPENSSL_DIR.patch b/recipes-bsp/trusted-firmware-a/tf-a-tools/0002-fix-fiptool-respect-OPENSSL_DIR.patch index 12446b9..fdefeb1 100644 --- a/recipes-bsp/trusted-firmware-a/tf-a-tools/0002-fix-fiptool-respect-OPENSSL_DIR.patch +++ b/recipes-bsp/trusted-firmware-a/tf-a-tools/0002-fix-fiptool-respect-OPENSSL_DIR.patch @@ -1,7 +1,7 @@ -From 1a9c13100d869ea94a7b987b4f502025c87b3b77 Mon Sep 17 00:00:00 2001 +From f033e4e6824dea386a44098720e3f700e4d5db1b Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Mon, 25 Oct 2021 12:27:59 +0100 -Subject: [PATCH 2/2] fix(fiptool): respect OPENSSL_DIR +Subject: [PATCH 2/3] fix(fiptool): respect OPENSSL_DIR fiptool links to libcrypto, so as with the other tools it should respect OPENSSL_DIR for include/library paths. @@ -13,45 +13,27 @@ Upstream-Status: Backport [https://github.com/ARM-software/arm-trusted-firmware/ Signed-off-by: Jose Quaresma --- Makefile | 2 +- - tools/fiptool/Makefile | 6 ++++-- - 2 files changed, 5 insertions(+), 3 deletions(-) + tools/fiptool/Makefile | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile -index 73007b413..fd60b5fba 100644 +index 77b9dd76cc..f3b2098026 100644 --- a/Makefile +++ b/Makefile -@@ -1427,7 +1427,7 @@ fwu_fip: ${BUILD_PLAT}/${FWU_FIP_NAME} +@@ -1438,7 +1438,7 @@ fwu_fip: ${BUILD_PLAT}/${FWU_FIP_NAME} ${FIPTOOL}: FORCE ifdef UNIX_MK -- ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" FIPTOOL=${FIPTOOL} --no-print-directory -C ${FIPTOOLPATH} -+ ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" FIPTOOL=${FIPTOOL} OPENSSL_DIR=${OPENSSL_DIR} --no-print-directory -C ${FIPTOOLPATH} +- ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" FIPTOOL=${FIPTOOL} --no-print-directory -C ${FIPTOOLPATH} all ++ ${Q}${MAKE} CPPFLAGS="-DVERSION='\"${VERSION_STRING}\"'" FIPTOOL=${FIPTOOL} OPENSSL_DIR=${OPENSSL_DIR} --no-print-directory -C ${FIPTOOLPATH} all else # Clear the MAKEFLAGS as we do not want # to pass the gnumake flags to nmake. diff --git a/tools/fiptool/Makefile b/tools/fiptool/Makefile -index 11d2e7b0b..7c2a08379 100644 +index 7fc5670eec..4c549748ad 100644 --- a/tools/fiptool/Makefile +++ b/tools/fiptool/Makefile -@@ -12,6 +12,8 @@ FIPTOOL ?= fiptool${BIN_EXT} - PROJECT := $(notdir ${FIPTOOL}) - OBJECTS := fiptool.o tbbr_config.o - V ?= 0 -+OPENSSL_DIR := /usr -+ - - override CPPFLAGS += -D_GNU_SOURCE -D_XOPEN_SOURCE=700 - HOSTCCFLAGS := -Wall -Werror -pedantic -std=c99 -@@ -20,7 +22,7 @@ ifeq (${DEBUG},1) - else - HOSTCCFLAGS += -O2 - endif --LDLIBS := -lcrypto -+LDLIBS := -L${OPENSSL_DIR}/lib -lcrypto - - ifeq (${V},0) - Q := @ -@@ -28,7 +30,7 @@ else +@@ -30,7 +30,7 @@ else Q := endif @@ -61,5 +43,5 @@ index 11d2e7b0b..7c2a08379 100644 HOSTCC ?= gcc -- -2.34.1 +2.17.1 diff --git a/recipes-bsp/trusted-firmware-a/tf-a-tools/0003-FIX-openssl-for-nativesdk.patch b/recipes-bsp/trusted-firmware-a/tf-a-tools/0003-FIX-openssl-for-nativesdk.patch index 2d72191..6783658 100644 --- a/recipes-bsp/trusted-firmware-a/tf-a-tools/0003-FIX-openssl-for-nativesdk.patch +++ b/recipes-bsp/trusted-firmware-a/tf-a-tools/0003-FIX-openssl-for-nativesdk.patch @@ -1,20 +1,18 @@ -From c9bbd3ac32d2850e8d0618f7bd29a747e0a8f0f9 Mon Sep 17 00:00:00 2001 +From 31d0401abd304f934fda6f701cc11df2c145951f Mon Sep 17 00:00:00 2001 From: Christophe Priouzeau Date: Fri, 2 Sep 2022 10:18:51 +0200 Subject: [PATCH 3/3] FIX openssl for nativesdk Signed-off-by: Christophe Priouzeau --- - Makefile | 20 ++++++++++---------- - tools/cert_create/Makefile | 2 +- - tools/fiptool/Makefile | 3 +-- - 3 files changed, 12 insertions(+), 13 deletions(-) + Makefile | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile -index fd60b5fba..b6d979b4f 100644 +index f3b2098026..588bf5c1d8 100644 --- a/Makefile +++ b/Makefile -@@ -174,18 +174,18 @@ endif +@@ -179,18 +179,18 @@ endif # Toolchain ################################################################################ @@ -43,37 +41,6 @@ index fd60b5fba..b6d979b4f 100644 DTC := dtc # Use ${LD}.bfd instead if it exists (as absolute path or together with $PATH). -diff --git a/tools/cert_create/Makefile b/tools/cert_create/Makefile -index 77d2007d5..c14bdee58 100644 ---- a/tools/cert_create/Makefile -+++ b/tools/cert_create/Makefile -@@ -9,7 +9,7 @@ V ?= 0 - DEBUG := 0 - CRTTOOL ?= cert_create${BIN_EXT} - BINARY := $(notdir ${CRTTOOL}) --OPENSSL_DIR := /usr -+OPENSSL_DIR ?= /usr - COT := tbbr - - MAKE_HELPERS_DIRECTORY := ../../make_helpers/ -diff --git a/tools/fiptool/Makefile b/tools/fiptool/Makefile -index 7c2a08379..24d48b3cd 100644 ---- a/tools/fiptool/Makefile -+++ b/tools/fiptool/Makefile -@@ -8,12 +8,11 @@ MAKE_HELPERS_DIRECTORY := ../../make_helpers/ - include ${MAKE_HELPERS_DIRECTORY}build_macros.mk - include ${MAKE_HELPERS_DIRECTORY}build_env.mk - -+OPENSSL_DIR ?= /usr - FIPTOOL ?= fiptool${BIN_EXT} - PROJECT := $(notdir ${FIPTOOL}) - OBJECTS := fiptool.o tbbr_config.o - V ?= 0 --OPENSSL_DIR := /usr -- - - override CPPFLAGS += -D_GNU_SOURCE -D_XOPEN_SOURCE=700 - HOSTCCFLAGS := -Wall -Werror -pedantic -std=c99 -- -2.25.1 +2.17.1 diff --git a/recipes-bsp/trusted-firmware-a/tf-a-tools_2.6.bb b/recipes-bsp/trusted-firmware-a/tf-a-tools_2.6.bb index a1879a9..b05eff8 100644 --- a/recipes-bsp/trusted-firmware-a/tf-a-tools_2.6.bb +++ b/recipes-bsp/trusted-firmware-a/tf-a-tools_2.6.bb @@ -1,48 +1,8 @@ +require tf-a-stm32mp-common.inc +require tf-a-tools.inc + SUMMARY = "Cert_create & Fiptool for fip generation for Trusted Firmware-A" LICENSE = "BSD-3-Clause" -LIC_FILES_CHKSUM = "file://license.rst;md5=1dd070c98a281d18d9eefd938729b031" -SRC_URI = "git://github.com/ARM-software/arm-trusted-firmware.git;protocol=https;branch=master \ - file://0001-tools-allow-to-use-a-root-key-password-from-command-.patch \ - file://0002-fix-fiptool-respect-OPENSSL_DIR.patch \ - file://0003-FIX-openssl-for-nativesdk.patch \ - " - -#SRCREV corresponds to v2.6 -SRCREV = "a1f02f4f3daae7e21ee58b4c93ec3e46b8f28d15" - -DEPENDS += "dtc-native openssl" - -S = "${WORKDIR}/git" - -COMPATIBLE_HOST:class-target = "null" - -HOSTCC:class-native = "${BUILD_CC}" -HOSTCC:class-nativesdk = "${CC}" -EXTRA_OEMAKE += "HOSTCC='${HOSTCC}' OPENSSL_DIR='${STAGING_EXECPREFIXDIR}'" -EXTRA_OEMAKE += "certtool fiptool" - -do_configure[noexec] = "1" - -do_compile:prepend:class-native () { - # This is still needed to have the native fiptool executing properly by - # setting the RPATH - sed -e '/^LDLIBS/ s,$, \$\{BUILD_LDFLAGS},' \ - -e '/^INCLUDE_PATHS/ s,$, \$\{BUILD_CFLAGS},' \ - -i ${S}/tools/fiptool/Makefile - # This is still needed to have the native cert_create executing properly by - # setting the RPATH - sed -e '/^LIB_DIR/ s,$, \$\{BUILD_LDFLAGS},' \ - -e '/^INC_DIR/ s,$, \$\{BUILD_CFLAGS},' \ - -i ${S}/tools/cert_create/Makefile -} - -do_install() { - install -d ${D}${bindir} - install -m 0755 \ - ${B}/tools/fiptool/fiptool \ - ${B}/tools/cert_create/cert_create \ - ${D}${bindir} -} - -BBCLASSEXTEND += "native nativesdk" +# Configure settings +TFA_PLATFORM = "stm32mp1"