From 281a8202bd4c6972f952aba2f7e45b120df361df Mon Sep 17 00:00:00 2001 From: Jose Quaresma Date: Tue, 23 Aug 2022 20:27:09 +0000 Subject: [PATCH] tf-a-tools: fix building - disabling the target build as it is a native tool - use the EXTRA_OEMAKE for the make arguments - RDEPENDS and FILES is not needed - don't run do_configure and use the default do_compile - openssl is need for native and nativesdk Signed-off-by: Jose Quaresma --- ...e-a-root-key-password-from-command-.patch} | 6 +- ...0002-fix-fiptool-respect-OPENSSL_DIR.patch | 65 +++++++++++++++++++ .../trusted-firmware-a/tf-a-tools_2.6.bb | 31 +++++---- 3 files changed, 83 insertions(+), 19 deletions(-) rename recipes-bsp/trusted-firmware-a/tf-a-tools/{0099-tools-allow-to-use-a-root-key-password-from-command-.patch => 0001-tools-allow-to-use-a-root-key-password-from-command-.patch} (96%) create mode 100644 recipes-bsp/trusted-firmware-a/tf-a-tools/0002-fix-fiptool-respect-OPENSSL_DIR.patch diff --git a/recipes-bsp/trusted-firmware-a/tf-a-tools/0099-tools-allow-to-use-a-root-key-password-from-command-.patch b/recipes-bsp/trusted-firmware-a/tf-a-tools/0001-tools-allow-to-use-a-root-key-password-from-command-.patch similarity index 96% rename from recipes-bsp/trusted-firmware-a/tf-a-tools/0099-tools-allow-to-use-a-root-key-password-from-command-.patch rename to recipes-bsp/trusted-firmware-a/tf-a-tools/0001-tools-allow-to-use-a-root-key-password-from-command-.patch index 884aa70..edd4f34 100644 --- a/recipes-bsp/trusted-firmware-a/tf-a-tools/0099-tools-allow-to-use-a-root-key-password-from-command-.patch +++ b/recipes-bsp/trusted-firmware-a/tf-a-tools/0001-tools-allow-to-use-a-root-key-password-from-command-.patch @@ -1,7 +1,7 @@ -From 63e10c11b0fb33e0343d6ffc81fd214e81903f36 Mon Sep 17 00:00:00 2001 +From f8cc9fc84827c03cecc9059dff254cb39d224696 Mon Sep 17 00:00:00 2001 From: Lionel Debieve Date: Tue, 19 Jan 2021 15:40:36 +0100 -Subject: [PATCH] tools: allow to use a root key password from command line +Subject: [PATCH 1/2] tools: allow to use a root key password from command line By defining the ROT_KEY_PWD, user is able to define the private root key password. Useful for build system management. @@ -126,5 +126,5 @@ index b39378ca9..71bf85722 100644 continue; } -- -2.25.1 +2.34.1 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 new file mode 100644 index 0000000..12446b9 --- /dev/null +++ b/recipes-bsp/trusted-firmware-a/tf-a-tools/0002-fix-fiptool-respect-OPENSSL_DIR.patch @@ -0,0 +1,65 @@ +From 1a9c13100d869ea94a7b987b4f502025c87b3b77 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 + +fiptool links to libcrypto, so as with the other tools it should respect +OPENSSL_DIR for include/library paths. + +Change-Id: Icd8c15fa5097db1da9a3a9222d9e267548c4c7e2 +Signed-off-by: Ross Burton + +Upstream-Status: Backport [https://github.com/ARM-software/arm-trusted-firmware/commit/dd14d0f63f7d049cbcbfd3f8128f05e9a351bbe5] +Signed-off-by: Jose Quaresma +--- + Makefile | 2 +- + tools/fiptool/Makefile | 6 ++++-- + 2 files changed, 5 insertions(+), 3 deletions(-) + +diff --git a/Makefile b/Makefile +index 73007b413..fd60b5fba 100644 +--- a/Makefile ++++ b/Makefile +@@ -1427,7 +1427,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} + 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 +--- 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 + Q := + endif + +-INCLUDE_PATHS := -I../../include/tools_share ++INCLUDE_PATHS := -I../../include/tools_share -I${OPENSSL_DIR}/include + + HOSTCC ?= gcc + +-- +2.34.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 dabf450..2526b3b 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 @@ -2,31 +2,30 @@ 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;nobranch=1" -#SRCREV corresponds to v2.6 +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 \ + " + SRCREV = "a1f02f4f3daae7e21ee58b4c93ec3e46b8f28d15" -# Mandatory fix to allow feeding password through command line -SRC_URI += "file://0099-tools-allow-to-use-a-root-key-password-from-command-.patch" +DEPENDS = "openssl" -DEPENDS:class-nativesdk = "nativesdk-openssl" +COMPATIBLE_HOST:class-target = "null" S = "${WORKDIR}/git" -do_compile() { - oe_runmake certtool fiptool -} +EXTRA_OEMAKE += "V=1 HOSTCC='${BUILD_CC}' OPENSSL_DIR='${STAGING_EXECPREFIXDIR}'" +EXTRA_OEMAKE += "certtool fiptool" + +do_configure[noexec] = "1" do_install() { install -d ${D}${bindir} - # cert_create - install -m 0755 ${B}/tools/cert_create/cert_create ${D}${bindir}/cert_create - # fiptool - install -m 0755 ${B}/tools/fiptool/fiptool ${D}${bindir}/fiptool + install -m 0755 \ + ${B}/tools/fiptool/fiptool \ + ${B}/tools/cert_create/cert_create \ + ${D}${bindir} } -FILES:${PN}:class-nativesdk = "${bindir}/cert_create ${bindir}/fiptool" - -RDEPENDS:${PN}:class-nativesdk += "nativesdk-libcrypto" - BBCLASSEXTEND += "native nativesdk"