diff --git a/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst.inc b/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst.inc index dae46cd48..e7e038103 100644 --- a/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst.inc +++ b/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst.inc @@ -10,7 +10,9 @@ DEPENDS = "openssl byacc flex" # Explicitly add byacc-native as a dependency when building the package for the # SDK, otherwise, it won't get installed in the sysroot, causing a compilation # error. -DEPENDS_append_class-nativesdk = " byacc-native" +# Explicitly add openssl-native for the SDK build to correctly link to the +# openssl libraries in the native dependencies folder. +DEPENDS_append_class-nativesdk = " byacc-native openssl-native" SRC_URI = " \ ${@oe.utils.conditional('TRUSTFENCE_SIGN', '1', 'file://cst-${PV}.tgz', '', d)} \ @@ -20,6 +22,7 @@ SRC_URI = " \ file://0004-hab4_pki_tree.sh-usa-a-random-password-for-the-defau.patch \ file://0005-ahab_pki_tree.sh-automate-script.patch \ file://0006-ahab_pki_tree.sh-use-a-random-password-for-the-defau.patch \ + file://0007-Makefile-statically-link-libcrypto.patch \ " # Usually local files (with file:// protocol) are not checked for @@ -36,6 +39,8 @@ python() { S = "${WORKDIR}/cst-${PV}/" do_compile() { + export LDLIBPATH=-L${WORKDIR}/recipe-sysroot-native/usr/lib + export COPTIONS=-I${WORKDIR}/recipe-sysroot-native/usr/include cd ${S}/code/cst oe_runmake OSTYPE=linux64 clean oe_runmake OSTYPE=linux64 rel_bin diff --git a/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst/0007-Makefile-statically-link-libcrypto.patch b/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst/0007-Makefile-statically-link-libcrypto.patch new file mode 100644 index 000000000..8cdde4006 --- /dev/null +++ b/meta-digi-arm/recipes-bsp/trustfence-cst/trustfence-cst/0007-Makefile-statically-link-libcrypto.patch @@ -0,0 +1,27 @@ +From: Gonzalo Ruiz +Date: Tue, 15 Dec 2020 17:01:45 +0100 +Subject: [PATCH] Makefile: statically link libcrypto + +Statically link libcrypto so the host machine does not require to have +installed the same openssl version that was used to build the binaries. + +This requires dynamically linking the libpthread and libdl libraries. + +Signed-off-by: Gonzalo Ruiz +--- + code/cst/code/build/make/gcc.mk | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/code/cst/code/build/make/gcc.mk b/code/cst/code/build/make/gcc.mk +index 0394f5a..cc57f6b 100755 +--- a/code/cst/code/build/make/gcc.mk ++++ b/code/cst/code/build/make/gcc.mk +@@ -28,7 +28,7 @@ COPTIONS += -std=c99 -D_POSIX_C_SOURCE=200809L -Wall -Werror -pedantic -fPIC -g + #============================================================================== + LDOPTIONS += -g + +-LDLIBS := -lcrypto ++LDLIBS := -Wl,-Bstatic -lcrypto -Wl,-Bdynamic -lpthread -ldl + + # Archiver flags + #==============================================================================