TF-A-TOOLS: use original source from TF-A-STM32MP

This will allow to get advantage of TF-A-STM32MP code update on fiptool
and certtool.

Signed-off-by: Romuald JEANNE <romuald.jeanne@st.com>
Change-Id: Ibc215ac0d78d678633a5f8bc25636da2c99c21a0
This commit is contained in:
Romuald JEANNE 2022-09-20 15:25:50 +02:00 committed by bernard PUEL
parent 9f1216974d
commit 3870f7ba78
4 changed files with 65 additions and 113 deletions

View File

@ -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"

View File

@ -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 <ross.burton@arm.com>
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 <jose.quaresma@foundries.io>
---
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

View File

@ -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 <christophe.priouzeau@foss.st.com>
Date: Fri, 2 Sep 2022 10:18:51 +0200
Subject: [PATCH 3/3] FIX openssl for nativesdk
Signed-off-by: Christophe Priouzeau <christophe.priouzeau@foss.st.com>
---
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

View File

@ -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"