From 1bef98b9ad4a6f73f49e059a8cee58783cbf31b5 Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Mon, 25 Oct 2021 16:42:06 +0100 Subject: [PATCH] arm/fiptool-native: improve OpenSSL build fix Take a patch that is heading upstream to pass OPENSSL_DIR to the fiptool build, removing the need to alter the Makefiles at build time. Signed-off-by: Ross Burton Signed-off-by: Jon Mason --- .../recipes-devtools/fiptool/files/ssl.patch | 52 +++++++++++++++++++ .../fiptool/fiptool-native_2.5.bb | 9 ++-- 2 files changed, 56 insertions(+), 5 deletions(-) create mode 100644 meta-arm/recipes-devtools/fiptool/files/ssl.patch diff --git a/meta-arm/recipes-devtools/fiptool/files/ssl.patch b/meta-arm/recipes-devtools/fiptool/files/ssl.patch new file mode 100644 index 00000000..cdabd1b7 --- /dev/null +++ b/meta-arm/recipes-devtools/fiptool/files/ssl.patch @@ -0,0 +1,52 @@ +fiptool: respect OPENSSL_DIR + +fiptool links to libcrypto, so as with the other tools it should respect +OPENSSL_DIR for include/library paths. + +Upstream-Status: Submitted +Signed-off-by: Ross Burton + +diff --git a/Makefile b/Makefile +index ec6f88585..2d3b9fc26 100644 +--- a/Makefile ++++ b/Makefile +@@ -1388,7 +1388,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 + diff --git a/meta-arm/recipes-devtools/fiptool/fiptool-native_2.5.bb b/meta-arm/recipes-devtools/fiptool/fiptool-native_2.5.bb index 2d0f333a..e733ff1e 100644 --- a/meta-arm/recipes-devtools/fiptool/fiptool-native_2.5.bb +++ b/meta-arm/recipes-devtools/fiptool/fiptool-native_2.5.bb @@ -5,7 +5,8 @@ DESCRIPTION = "fiptool - Trusted Firmware tool for packaging" LICENSE = "BSD-3-Clause" -SRC_URI = "git://git.trustedfirmware.org/TF-A/trusted-firmware-a.git;destsuffix=fiptool-${PV};protocol=https;" +SRC_URI = "git://git.trustedfirmware.org/TF-A/trusted-firmware-a.git;destsuffix=fiptool-${PV};protocol=https \ + file://ssl.patch" LIC_FILES_CHKSUM = "file://docs/license.rst;md5=713afe122abbe07f067f939ca3c480c5" # Use fiptool from TF-A v2.5 @@ -15,11 +16,9 @@ DEPENDS += "openssl-native" inherit native -do_compile () { - # These changes are needed to have the fiptool compiling and executing properly - sed -i '/^LDLIBS/ s,$, \$\{BUILD_LDFLAGS},' ${S}/tools/fiptool/Makefile - sed -i '/^INCLUDE_PATHS/ s,$, \$\{BUILD_CFLAGS},' ${S}/tools/fiptool/Makefile +EXTRA_OEMAKE = "V=1 HOSTCC='${BUILD_CC}' OPENSSL_DIR=${STAGING_DIR_NATIVE}/${prefix_native}" +do_compile () { oe_runmake fiptool }