Skip to contentSkip to conversation

arm/optee-os: improve sysroot lookup

PATCH In review Ross Burton 3 participants 12 messages Nov 2, 2020 – Nov 4, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/7 arm/optee-os: improve sysroot lookup

optee-test uses the same functionality to find libstdc++ and libgcc_eh, so ensure that these libraries are found with the right sysroot too.

Change-Id Ice0506a42655223045bcabec790eae3a3dbcf245
---
 ...ow-setting-sysroot-for-libgcc-lookup.patch | 26 ++++++++++++++-----
 1 file changed, 19 insertions(+), 7 deletions(-)
meta-arm/recipes-security/optee/optee-os/0006-allow-setting-sysroot-for-libgcc-lookup.patch +19 -7
index 86e8428..1700539 100644
@@ -1,22 +1,34 @@
-From 017994c477e2d082395460de83a7828d4e7d4b70 Mon Sep 17 00:00:00 2001
-From: Joshua Watt <[email protected]>
+From 0bab935695ebcf0c533b49896ab18ff33d4a47d1 Mon Sep 17 00:00:00 2001
+From: Ross Burton <[email protected]>
 Date: Tue, 26 May 2020 14:38:02 -0500
 Subject: [PATCH] allow setting sysroot for libgcc lookup
 
+Explicitly pass the new variable LIBGCC_LOCATE_CFLAGS variable when searching
+for the compiler libraries as there's no easy way to reliably pass --sysroot
+otherwise.
+
+Upstream-Status: Pending [https://github.com/OP-TEE/optee_os/issues/4188]
+Signed-off-by: Ross Burton <[email protected]>
 ---
- mk/gcc.mk | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
+ mk/gcc.mk | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
 
 diff --git a/mk/gcc.mk b/mk/gcc.mk
-index adc77a24..e238b9f3 100644
+index adc77a24..81bfa78a 100644
 --- a/mk/gcc.mk
 +++ b/mk/gcc.mk
-@@ -13,7 +13,7 @@ nostdinc$(sm)	:= -nostdinc -isystem $(shell $(CC$(sm)) \
+@@ -13,11 +13,11 @@ nostdinc$(sm)	:= -nostdinc -isystem $(shell $(CC$(sm)) \
  			-print-file-name=include 2> /dev/null)
  
  # Get location of libgcc from gcc
 -libgcc$(sm)  	:= $(shell $(CC$(sm)) $(CFLAGS$(arch-bits-$(sm))) \
 +libgcc$(sm)  	:= $(shell $(CC$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CFLAGS$(arch-bits-$(sm))) \
  			-print-libgcc-file-name 2> /dev/null)
- libstdc++$(sm)	:= $(shell $(CXX$(sm)) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \
+-libstdc++$(sm)	:= $(shell $(CXX$(sm)) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \
++libstdc++$(sm)	:= $(shell $(CXX$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \
  			-print-file-name=libstdc++.a 2> /dev/null)
+-libgcc_eh$(sm)	:= $(shell $(CXX$(sm)) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \
++libgcc_eh$(sm)	:= $(shell $(CXX$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \
+ 			-print-file-name=libgcc_eh.a 2> /dev/null)
+ 
+ # Define these to something to discover accidental use
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/7 arm/optee-test: add bug links

These issues now have upstream bugs.

Change-Id I9eacedbbf6e7874f6d1843b08fd9a8c04d030855
---
 .../0001-host-xtest-Adjust-order-of-including-compiler.h.patch  | 2 +-
 .../optee-test/0002-make-remove-Wno-unsafe-loop-for-clang.patch | 2 +-
 .../0003-make-remove-Wmissing-noreturn-for-clang.patch          | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
meta-arm/recipes-security/optee/optee-test/0001-host-xtest-Adjust-order-of-including-compiler.h.patch +1 -1
index 3066b66..3c500d7 100644
@@ -12,7 +12,7 @@ recipe-sysroot/usr/include/bits/stat.h:17:19: error: expected identifier or '('
                    ^
 including compiler.h afer sys/stat.h fixes the problem.
 
-Upstream-Status: Pending
+Upstream-Status: Pending [https://github.com/OP-TEE/optee_test/issues/453]
 Signed-off-by: Khem Raj <[email protected]>
 ---
  host/xtest/install_ta.c | 2 +-
meta-arm/recipes-security/optee/optee-test/0002-make-remove-Wno-unsafe-loop-for-clang.patch +1 -1
index ef09c56..17dd7d8 100644
@@ -6,7 +6,7 @@ Subject: [PATCH] make: remove -Wmissing-noreturn for clang
 When compiling when clang, -Wmissing-noreturn causes an error because
 of non-compliant code. This option is removed to workaround this.
 
-Upstream-Status: Pending
+Upstream-Status: Pending [https://github.com/OP-TEE/optee_test/issues/452]
 Changed-Id: 71cb511904547d790d1ea98f93bf8e5a6afcb36d
 Signed-off-by: Brett Warren <[email protected]>
 ---
meta-arm/recipes-security/optee/optee-test/0003-make-remove-Wmissing-noreturn-for-clang.patch +1 -1
index b265e81..bbc303f 100644
@@ -7,7 +7,7 @@ When compiling with clang, the -Wno-unsafe-loop-optimizations option
 throws an error because clang doesn't recognise it. This option is
 removed to workaround this.
 
-Upstream-Status: Pending
+Upstream-Status: Pending [https://github.com/OP-TEE/optee_test/issues/452]
 Change-Id: 5fe0892c73208aaffac8c9995cb3275936fb1ba6
 Signed-off-by: Brett Warren <[email protected]>
 ---
Signature · 1 line
2.25.1
#2 lore raw

PATCH 3/7 arm/optee-os: fix the optee-test build with GCC 10

In reply to Ross Burton

GCC 10 calls __getauxval in some situations so backport some patches from upstream to fix the linking with this symbol.

Change-Id I68af7ff9d058b9f602f54350a35908d178a8e688
---
 ...ide-empty-__getauxval-implementation.patch | 62 +++++++++++++++++++
 ...t-support-for-libnames-after-libgcc-.patch | 55 ++++++++++++++++
 ...ke-sure-that-libutils-is-linked-seco.patch | 44 +++++++++++++
 .../recipes-security/optee/optee-os_3.11.0.bb |  4 +-
 4 files changed, 164 insertions(+), 1 deletion(-)
 create mode 100644 meta-arm/recipes-security/optee/optee-os/0001-libutils-provide-empty-__getauxval-implementation.patch
 create mode 100644 meta-arm/recipes-security/optee/optee-os/0002-link.mk-implement-support-for-libnames-after-libgcc-.patch
 create mode 100644 meta-arm/recipes-security/optee/optee-os/0003-ta_dev_kit.mk-make-sure-that-libutils-is-linked-seco.patch
meta-arm/recipes-security/optee/optee-os/0001-libutils-provide-empty-__getauxval-implementation.patch new file +62 -0
new file mode 100644
index 0000000..0120f5c
@@ -0,0 +1,62 @@
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <[email protected]>
+
+From 36e784f621bf5d5be9183beba35f39426277c110 Mon Sep 17 00:00:00 2001
+From: Volodymyr Babchuk <[email protected]>
+Date: Tue, 13 Oct 2020 22:45:39 +0300
+Subject: [PATCH 1/3] libutils: provide empty __getauxval() implementation
+
+Never version of libgcc are built with LSE implementation in mind. To
+determine if LSE is available on platform it calls __getauxval(), so in
+some cases we can get undefined reference to __getauxval() error.
+
+Prominent case is libgcc_eh.a library, which is used by C++ TAs. Exception
+handler depends on atomic operations, so it tries to call
+init_have_lse_atomics() first. This function in turn calls __getauxval(),
+which causes linking error.
+
+In the future we can make __getauxval() to return actual platform
+capabilities.
+
+Signed-off-by: Volodymyr Babchuk <[email protected]>
+Reviewed-by: Jens Wiklander <[email protected]>
+Reviewed-by: Jerome Forissier <[email protected]>
+---
+ lib/libutils/ext/arch/arm/auxval.c | 12 ++++++++++++
+ lib/libutils/ext/arch/arm/sub.mk   |  1 +
+ 2 files changed, 13 insertions(+)
+ create mode 100644 lib/libutils/ext/arch/arm/auxval.c
+
+diff --git a/lib/libutils/ext/arch/arm/auxval.c b/lib/libutils/ext/arch/arm/auxval.c
+new file mode 100644
+index 00000000..98bca850
+--- /dev/null
++++ b/lib/libutils/ext/arch/arm/auxval.c
+@@ -0,0 +1,12 @@
++// SPDX-License-Identifier: BSD-2-Clause
++/*
++ * Copyright (c) 2020, EPAM Systems
++ */
++
++#include <compiler.h>
++
++unsigned long int __getauxval (unsigned long int type);
++unsigned long int __getauxval (unsigned long int type __unused)
++{
++	return 0;
++}
+diff --git a/lib/libutils/ext/arch/arm/sub.mk b/lib/libutils/ext/arch/arm/sub.mk
+index dc5eed67..2e779066 100644
+--- a/lib/libutils/ext/arch/arm/sub.mk
++++ b/lib/libutils/ext/arch/arm/sub.mk
+@@ -3,6 +3,7 @@ srcs-$(CFG_ARM32_$(sm)) += aeabi_unwind.c
+ endif
+ srcs-$(CFG_ARM32_$(sm)) += atomic_a32.S
+ srcs-$(CFG_ARM64_$(sm)) += atomic_a64.S
++srcs-y += auxval.c
+ ifneq ($(sm),ldelf) # TA, core
+ srcs-$(CFG_ARM32_$(sm)) += mcount_a32.S
+ srcs-$(CFG_ARM64_$(sm)) += mcount_a64.S
+-- 
+2.25.1
+
meta-arm/recipes-security/optee/optee-os/0002-link.mk-implement-support-for-libnames-after-libgcc-.patch new file +55 -0

55 lines not on this page · raw message

meta-arm/recipes-security/optee/optee-os/0003-ta_dev_kit.mk-make-sure-that-libutils-is-linked-seco.patch new file +44 -0

44 lines not on this page · raw message

meta-arm/recipes-security/optee/optee-os_3.11.0.bb +3 -1
index a8f2a11..13b3dc6 100644
@@ -5,5 +5,7 @@ SRCREV = "c4def2a8262a03244d9a88461699b9b8e43c6b55"
 SRC_URI_append = " \
     file://0006-allow-setting-sysroot-for-libgcc-lookup.patch \
     file://0007-allow-setting-sysroot-for-clang.patch \
+    file://0001-libutils-provide-empty-__getauxval-implementation.patch \
+    file://0002-link.mk-implement-support-for-libnames-after-libgcc-.patch \
+    file://0003-ta_dev_kit.mk-make-sure-that-libutils-is-linked-seco.patch \
 "
-
Signature · 1 line
2.25.1
#3 lore raw

PATCH 4/7 arm/optee-client: rewrite recipe

In reply to Ross Burton

The license is 2-clause BSD, so specify that precisely.

No need to inherit python3native as it is not used.

Instead of using the bare Makefile build, use CMake.

Change-Id I324f633428f10fdaabaa57b2f2561c2fdc847919
---
 .../recipes-security/optee/optee-client.inc   | 35 +++----------------
 1 file changed, 5 insertions(+), 30 deletions(-)
meta-arm/recipes-security/optee/optee-client.inc +5 -30
index d82392c..26f9724 100644
@@ -2,12 +2,10 @@ SUMMARY = "OP-TEE Client API"
 DESCRIPTION = "Open Portable Trusted Execution Environment - Normal World Client side of the TEE"
 HOMEPAGE = "https://www.op-tee.org/"
 
-LICENSE = "BSD"
-LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=69663ab153298557a59c67a60a743e5b"
+LICENSE = "BSD-2-Clause"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=69663ab153298557a59c67a60a743e5b"
 
-require optee.inc
-
-inherit python3native systemd update-rc.d
+inherit systemd update-rc.d cmake
 
 SRC_URI = " \
     git://github.com/OP-TEE/optee_client.git \
@@ -16,31 +14,11 @@ SRC_URI = " \
 "
 
 S = "${WORKDIR}/git"
-B = "${WORKDIR}/build"
-
-EXTRA_OEMAKE = "O=${B}"
-
-do_compile() {
-    cd ${S}
-    oe_runmake
-}
-do_compile[cleandirs] = "${B}"
-
-do_install() {
-    cd ${S}
-    oe_runmake install
-
-    install -D -p -m0755 ${B}/export/usr/sbin/tee-supplicant ${D}${sbindir}/tee-supplicant
 
-    install -D -p -m0644 ${B}/export/usr/lib/libteec.so.1.0 ${D}${libdir}/libteec.so.1.0
-    ln -sf libteec.so.1.0 ${D}${libdir}/libteec.so
-    ln -sf libteec.so.1.0 ${D}${libdir}/libteec.so.1
-
-    install -d ${D}${includedir}
-    install -p -m0644 ${B}/export/usr/include/*.h ${D}${includedir}
+EXTRA_OECMAKE = "-DBUILD_SHARED_LIBS=ON"
 
+do_install_append() {
     install -D -p -m0644 ${WORKDIR}/tee-supplicant.service ${D}${systemd_system_unitdir}/tee-supplicant.service
-
     install -D -p -m0755 ${WORKDIR}/tee-supplicant.sh ${D}${sysconfdir}/init.d/tee-supplicant
 
     sed -i -e s:@sysconfdir@:${sysconfdir}:g \
@@ -52,8 +30,5 @@ do_install() {
 SYSTEMD_SERVICE_${PN} = "tee-supplicant.service"
 
 INITSCRIPT_PACKAGES = "${PN}"
-
 INITSCRIPT_NAME_${PN} = "tee-supplicant"
 INITSCRIPT_PARAMS_${PN} = "start 10 1 2 3 4 5 . stop 90 0 6 ."
-
-
Signature · 1 line
2.25.1
#4 lore raw

Re: [meta-arm] [PATCH 4/7] arm/optee-client: rewrite recipe

Quoted 17 lines · Ross Burton

The license is 2-clause BSD, so specify that precisely.

No need to inherit python3native as it is not used.

Instead of using the bare Makefile build, use CMake.

Change-Id I324f633428f10fdaabaa57b2f2561c2fdc847919
---
 .../recipes-security/optee/optee-client.inc   | 35 +++----------------
 1 file changed, 5 insertions(+), 30 deletions(-)
meta-arm/recipes-security/optee/optee-client.inc +0 -0
index d82392c..26f9724 100644

meta-arm/recipes-security/optee/optee-client.inc SUMMARY = "OP-TEE Client API" · line 8

Quoted 9 lines
meta-arm/recipes-security/optee/optee-client.inc +2 -3
@@ -2,12 +2,10 @@ SUMMARY = "OP-TEE Client API"
 DESCRIPTION = "Open Portable Trusted Execution Environment - Normal World Client side of the TEE"
 HOMEPAGE = "https://www.op-tee.org/"
 
-LICENSE = "BSD"
-LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=69663ab153298557a59c67a60a743e5b"
+LICENSE = "BSD-2-Clause"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=69663ab153298557a59c67a60a743e5b"
 
-require optee.inc

Was this a mistake?

Quoted 56 lines
meta-arm/recipes-security/optee/optee-client.inc +3 -27
-
-inherit python3native systemd update-rc.d
+inherit systemd update-rc.d cmake
 
 SRC_URI = " \
     git://github.com/OP-TEE/optee_client.git \
@@ -16,31 +14,11 @@ SRC_URI = " \
 "
 
 S = "${WORKDIR}/git"
-B = "${WORKDIR}/build"
-
-EXTRA_OEMAKE = "O=${B}"
-
-do_compile() {
-    cd ${S}
-    oe_runmake
-}
-do_compile[cleandirs] = "${B}"
-
-do_install() {
-    cd ${S}
-    oe_runmake install
-
-    install -D -p -m0755 ${B}/export/usr/sbin/tee-supplicant ${D}${sbindir}/tee-supplicant
 
-    install -D -p -m0644 ${B}/export/usr/lib/libteec.so.1.0 ${D}${libdir}/libteec.so.1.0
-    ln -sf libteec.so.1.0 ${D}${libdir}/libteec.so
-    ln -sf libteec.so.1.0 ${D}${libdir}/libteec.so.1
-
-    install -d ${D}${includedir}
-    install -p -m0644 ${B}/export/usr/include/*.h ${D}${includedir}
+EXTRA_OECMAKE = "-DBUILD_SHARED_LIBS=ON"
 
+do_install_append() {
     install -D -p -m0644 ${WORKDIR}/tee-supplicant.service ${D}${systemd_system_unitdir}/tee-supplicant.service
-
     install -D -p -m0755 ${WORKDIR}/tee-supplicant.sh ${D}${sysconfdir}/init.d/tee-supplicant
 
     sed -i -e s:@sysconfdir@:${sysconfdir}:g \
@@ -52,8 +30,5 @@ do_install() {
 SYSTEMD_SERVICE_${PN} = "tee-supplicant.service"
 
 INITSCRIPT_PACKAGES = "${PN}"
-
 INITSCRIPT_NAME_${PN} = "tee-supplicant"
 INITSCRIPT_PARAMS_${PN} = "start 10 1 2 3 4 5 . stop 90 0 6 ."
-
-
Signature · 1 line
2.25.1
#5 lore raw

Re: [meta-arm] [PATCH 4/7] arm/optee-client: rewrite recipe

Quoted 3 lines · Denys Dmytriyenko
Quoted 1 line

-require optee.inc

Was this a mistake?

No, the client library is sufficiently different that optee.inc doesn't bring any gains.

Ross

#6 lore raw

PATCH 5/7 arm/optee-examples: cleanup recipe

In reply to Ross Burton

Clarify the license and clean up oe_runmake calls.

Change-Id I6d0eb9aee895e3ed9de73ea14f11084c214ca5af
---
 meta-arm/recipes-security/optee/optee-examples.inc | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
meta-arm/recipes-security/optee/optee-examples.inc +3 -5
index 7d12858..73193f5 100644
@@ -2,8 +2,8 @@ SUMMARY = "OP-TEE examples"
 DESCRIPTION = "Open Portable Trusted Execution Environment - Sample Applications"
 HOMEPAGE = "https://github.com/linaro-swg/optee_examples"
 
-LICENSE = "GPLv2"
-LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=cd95ab417e23b94f381dafc453d70c30"
+LICENSE = "BSD-2-Clause"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=cd95ab417e23b94f381dafc453d70c30"
 
 DEPENDS = "optee-client optee-os python3-pycryptodomex-native"
 
@@ -36,8 +36,7 @@ TEEC_EXPORT = "${STAGING_DIR_HOST}${prefix}"
 TA_DEV_KIT_DIR = "${STAGING_INCDIR}/optee/export-user_ta"
 
 do_compile() {
-    cd ${S}
-    oe_runmake
+    oe_runmake -C ${S}
 }
 do_compile[cleandirs] = "${B}"
 
@@ -52,4 +51,3 @@ FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/"
 
 # Imports machine specific configs from staging to build
 PACKAGE_ARCH = "${MACHINE_ARCH}"
-
Signature · 1 line
2.25.1
#7 lore raw

PATCH 6/7 arm/optee-os: cleanup recipe

In reply to Ross Burton

Clarify license and clean up oe_runmake calls.

Change-Id I5952cd1b8014fa686ce4039fe8abca803fb4306a
---
 meta-arm/recipes-security/optee/optee-os.inc | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
meta-arm/recipes-security/optee/optee-os.inc +3 -4
index 3094b35..e513fcc 100644
@@ -2,8 +2,8 @@ SUMMARY = "OP-TEE Trusted OS"
 DESCRIPTION = "Open Portable Trusted Execution Environment - Trusted side of the TEE"
 HOMEPAGE = "https://www.op-tee.org/"
 
-LICENSE = "BSD"
-LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=c1f21c4f72f372ef38a5a4aee55ec173"
+LICENSE = "BSD-2-Clause"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=c1f21c4f72f372ef38a5a4aee55ec173"
 
 inherit deploy python3native
 require optee.inc
@@ -48,8 +48,7 @@ LD[unexport] = "1"
 do_configure[noexec] = "1"
 
 do_compile() {
-    cd ${S}
-    oe_runmake all CFG_TEE_TA_LOG_LEVEL=0
+    oe_runmake -C ${S} all CFG_TEE_TA_LOG_LEVEL=0
 }
 do_compile[cleandirs] = "${B}"
 
Signature · 1 line
2.25.1
#8 lore raw

PATCH 7/7 arm/optee: consolidate common variables

In reply to Ross Burton

Move a number of shared varibles into optee.inc so that they don't have to be duplicated repeatedly.

Change-Id Ie2565dfa66cbd61aad199224a4cdc7b2e1af0c5d
---
 .../recipes-security/optee/optee-examples.inc | 17 +++------------
 meta-arm/recipes-security/optee/optee-os.inc  | 14 +------------
 .../recipes-security/optee/optee-test.inc     | 16 +++-----------
 meta-arm/recipes-security/optee/optee.inc     | 21 +++++++++++++++++++
 4 files changed, 28 insertions(+), 40 deletions(-)
meta-arm/recipes-security/optee/optee-examples.inc +3 -14
index 73193f5..851043b 100644
@@ -15,26 +15,15 @@ SRC_URI = "git://github.com/linaro-swg/optee_examples.git \
            file://0001-make-Pass-ldflags-during-link.patch \
           "
 
-OPTEE_COMPILER = "${@d.getVar('TOOLCHAIN') or 'gcc'}"
-
-EXTRA_OEMAKE = " TA_DEV_KIT_DIR=${TA_DEV_KIT_DIR} \
-                 OPTEE_CLIENT_EXPORT=${OPTEE_CLIENT_EXPORT} \
-                 TEEC_EXPORT=${TEEC_EXPORT} \
-                 HOST_CROSS_COMPILE=${TARGET_PREFIX} \
-                 LIBGCC_LOCATE_CFLAGS=--sysroot=${STAGING_DIR_HOST} \
-                 COMPILER=${OPTEE_COMPILER} \
-                 TA_CROSS_COMPILE=${TARGET_PREFIX} \
-                 V=1 \
+EXTRA_OEMAKE += "TA_DEV_KIT_DIR=${TA_DEV_KIT_DIR} \
+                 HOST_CROSS_COMPILE=${HOST_PREFIX} \
+                 TA_CROSS_COMPILE=${HOST_PREFIX} \
                  OUTPUT_DIR=${B} \
                "
 
 S = "${WORKDIR}/git"
 B = "${WORKDIR}/build"
 
-OPTEE_CLIENT_EXPORT = "${STAGING_DIR_HOST}${prefix}"
-TEEC_EXPORT = "${STAGING_DIR_HOST}${prefix}"
-TA_DEV_KIT_DIR = "${STAGING_INCDIR}/optee/export-user_ta"
-
 do_compile() {
     oe_runmake -C ${S}
 }
meta-arm/recipes-security/optee/optee-os.inc +1 -13
index e513fcc..ea6c496 100644
@@ -17,25 +17,13 @@ SRC_URI = "git://github.com/OP-TEE/optee_os.git"
 S = "${WORKDIR}/git"
 B = "${WORKDIR}/build"
 
-OPTEEMACHINE ?= "${MACHINE}"
-OPTEEMACHINE_aarch64_qemuall ?= "vexpress-qemu_armv8a"
-OPTEE_ARCH = "null"
-OPTEE_ARCH_armv7a = "arm32"
-OPTEE_ARCH_aarch64 = "arm64"
-OPTEE_CORE = "${@d.getVar('OPTEE_ARCH').upper()}"
-OPTEE_COMPILER = "${@d.getVar('TOOLCHAIN') or 'gcc'}"
-
-
-EXTRA_OEMAKE = " \
+EXTRA_OEMAKE += " \
     PLATFORM=${OPTEEMACHINE} \
     CFG_${OPTEE_CORE}_core=y \
     CROSS_COMPILE_core=${HOST_PREFIX} \
     CROSS_COMPILE_ta_${OPTEE_ARCH}=${HOST_PREFIX} \
     NOWERROR=1 \
-    V=1 \
     ta-targets=ta_${OPTEE_ARCH} \
-    LIBGCC_LOCATE_CFLAGS=--sysroot=${STAGING_DIR_HOST} \
-    COMPILER=${OPTEE_COMPILER} \
     O=${B} \
 "
 
meta-arm/recipes-security/optee/optee-test.inc +3 -13
index 95ed311..467e687 100644
@@ -19,19 +19,9 @@ SRC_URI = "git://github.com/OP-TEE/optee_test.git \
 S = "${WORKDIR}/git"
 B = "${WORKDIR}/build"
 
-OPTEE_CLIENT_EXPORT = "${STAGING_DIR_HOST}${prefix}"
-TEEC_EXPORT         = "${STAGING_DIR_HOST}${prefix}"
-TA_DEV_KIT_DIR      = "${STAGING_INCDIR}/optee/export-user_ta"
-OPTEE_COMPILER = "${@d.getVar('TOOLCHAIN') or 'gcc'}"
-
-EXTRA_OEMAKE = " TA_DEV_KIT_DIR=${TA_DEV_KIT_DIR} \
-                 OPTEE_CLIENT_EXPORT=${OPTEE_CLIENT_EXPORT} \
-                 TEEC_EXPORT=${TEEC_EXPORT} \
-                 LIBGCC_LOCATE_CFLAGS=--sysroot=${STAGING_DIR_HOST} \
-                 COMPILER=${OPTEE_COMPILER} \
-                 CROSS_COMPILE_HOST=${TARGET_PREFIX} \
-                 CROSS_COMPILE_TA=${TARGET_PREFIX} \
-                 V=1 \
+EXTRA_OEMAKE += "TA_DEV_KIT_DIR=${TA_DEV_KIT_DIR} \
+                 CROSS_COMPILE_HOST=${HOST_PREFIX} \
+                 CROSS_COMPILE_TA=${HOST_PREFIX} \
                  O=${B} \
                "
 
meta-arm/recipes-security/optee/optee.inc +21 -0
index 4bf87fe..8aaf616 100644
@@ -1,3 +1,24 @@
 COMPATIBLE_MACHINE ?= "invalid"
 COMPATIBLE_MACHINE_qemuarm64 ?= "qemuarm64"
 # Please add supported machines below or set it in .bbappend or .conf
+
+OPTEEMACHINE ?= "${MACHINE}"
+OPTEEMACHINE_aarch64_qemuall ?= "vexpress-qemu_armv8a"
+
+OPTEE_ARCH = "null"
+OPTEE_ARCH_armv7a = "arm32"
+OPTEE_ARCH_aarch64 = "arm64"
+OPTEE_CORE = "${@d.getVar('OPTEE_ARCH').upper()}"
+
+OPTEE_COMPILER = "${@d.getVar('TOOLCHAIN') or 'gcc'}"
+
+# Set here but not passed to EXTRA_OEMAKE by default as that breaks
+# the optee-os build
+TA_DEV_KIT_DIR = "${STAGING_INCDIR}/optee/export-user_ta"
+
+EXTRA_OEMAKE += "V=1 \
+                 LIBGCC_LOCATE_CFLAGS=--sysroot=${STAGING_DIR_HOST} \
+                 COMPILER=${OPTEE_COMPILER} \
+                 OPTEE_CLIENT_EXPORT=${STAGING_DIR_HOST}${prefix} \
+                 TEEC_EXPORT=${STAGING_DIR_HOST}${prefix} \
+                "
Signature · 1 line
2.25.1
#9 lore raw

Re: [meta-arm] [PATCH 7/7] arm/optee: consolidate common variables

Quoted 61 lines · Ross Burton

Move a number of shared varibles into optee.inc so that they don't have to be duplicated repeatedly.

Change-Id Ie2565dfa66cbd61aad199224a4cdc7b2e1af0c5d
---
 .../recipes-security/optee/optee-examples.inc | 17 +++------------
 meta-arm/recipes-security/optee/optee-os.inc  | 14 +------------
 .../recipes-security/optee/optee-test.inc     | 16 +++-----------
 meta-arm/recipes-security/optee/optee.inc     | 21 +++++++++++++++++++
 4 files changed, 28 insertions(+), 40 deletions(-)
meta-arm/recipes-security/optee/optee-examples.inc +3 -14
index 73193f5..851043b 100644
@@ -15,26 +15,15 @@ SRC_URI = "git://github.com/linaro-swg/optee_examples.git \
            file://0001-make-Pass-ldflags-during-link.patch \
           "
 
-OPTEE_COMPILER = "${@d.getVar('TOOLCHAIN') or 'gcc'}"
-
-EXTRA_OEMAKE = " TA_DEV_KIT_DIR=${TA_DEV_KIT_DIR} \
-                 OPTEE_CLIENT_EXPORT=${OPTEE_CLIENT_EXPORT} \
-                 TEEC_EXPORT=${TEEC_EXPORT} \
-                 HOST_CROSS_COMPILE=${TARGET_PREFIX} \
-                 LIBGCC_LOCATE_CFLAGS=--sysroot=${STAGING_DIR_HOST} \
-                 COMPILER=${OPTEE_COMPILER} \
-                 TA_CROSS_COMPILE=${TARGET_PREFIX} \
-                 V=1 \
+EXTRA_OEMAKE += "TA_DEV_KIT_DIR=${TA_DEV_KIT_DIR} \
+                 HOST_CROSS_COMPILE=${HOST_PREFIX} \
+                 TA_CROSS_COMPILE=${HOST_PREFIX} \
                  OUTPUT_DIR=${B} \
                "
 
 S = "${WORKDIR}/git"
 B = "${WORKDIR}/build"
 
-OPTEE_CLIENT_EXPORT = "${STAGING_DIR_HOST}${prefix}"
-TEEC_EXPORT = "${STAGING_DIR_HOST}${prefix}"
-TA_DEV_KIT_DIR = "${STAGING_INCDIR}/optee/export-user_ta"
-
 do_compile() {
     oe_runmake -C ${S}
 }
meta-arm/recipes-security/optee/optee-os.inc +0 -7
index e513fcc..ea6c496 100644
@@ -17,25 +17,13 @@ SRC_URI = "git://github.com/OP-TEE/optee_os.git"
 S = "${WORKDIR}/git"
 B = "${WORKDIR}/build"
 
-OPTEEMACHINE ?= "${MACHINE}"
-OPTEEMACHINE_aarch64_qemuall ?= "vexpress-qemu_armv8a"
-OPTEE_ARCH = "null"
-OPTEE_ARCH_armv7a = "arm32"
-OPTEE_ARCH_aarch64 = "arm64"
-OPTEE_CORE = "${@d.getVar('OPTEE_ARCH').upper()}"
-OPTEE_COMPILER = "${@d.getVar('TOOLCHAIN') or 'gcc'}"

meta-arm/recipes-security/optee/optee-os.inc SRC_URI = "git://github.com/OP-TEE/optee_os.git" · line 35

Quoted 10 lines
meta-arm/recipes-security/optee/optee-os.inc +1 -4
-
-
-EXTRA_OEMAKE = " \
+EXTRA_OEMAKE += " \
     PLATFORM=${OPTEEMACHINE} \
     CFG_${OPTEE_CORE}_core=y \
     CROSS_COMPILE_core=${HOST_PREFIX} \
     CROSS_COMPILE_ta_${OPTEE_ARCH}=${HOST_PREFIX} \
     NOWERROR=1 \
-    V=1 \

I noticed verbose building got disabled - any specific reasons?

Quoted 69 lines
meta-arm/recipes-security/optee/optee-os.inc +0 -2
     ta-targets=ta_${OPTEE_ARCH} \
-    LIBGCC_LOCATE_CFLAGS=--sysroot=${STAGING_DIR_HOST} \
-    COMPILER=${OPTEE_COMPILER} \
     O=${B} \
 "
 
meta-arm/recipes-security/optee/optee-test.inc +3 -13
index 95ed311..467e687 100644
@@ -19,19 +19,9 @@ SRC_URI = "git://github.com/OP-TEE/optee_test.git \
 S = "${WORKDIR}/git"
 B = "${WORKDIR}/build"
 
-OPTEE_CLIENT_EXPORT = "${STAGING_DIR_HOST}${prefix}"
-TEEC_EXPORT         = "${STAGING_DIR_HOST}${prefix}"
-TA_DEV_KIT_DIR      = "${STAGING_INCDIR}/optee/export-user_ta"
-OPTEE_COMPILER = "${@d.getVar('TOOLCHAIN') or 'gcc'}"
-
-EXTRA_OEMAKE = " TA_DEV_KIT_DIR=${TA_DEV_KIT_DIR} \
-                 OPTEE_CLIENT_EXPORT=${OPTEE_CLIENT_EXPORT} \
-                 TEEC_EXPORT=${TEEC_EXPORT} \
-                 LIBGCC_LOCATE_CFLAGS=--sysroot=${STAGING_DIR_HOST} \
-                 COMPILER=${OPTEE_COMPILER} \
-                 CROSS_COMPILE_HOST=${TARGET_PREFIX} \
-                 CROSS_COMPILE_TA=${TARGET_PREFIX} \
-                 V=1 \
+EXTRA_OEMAKE += "TA_DEV_KIT_DIR=${TA_DEV_KIT_DIR} \
+                 CROSS_COMPILE_HOST=${HOST_PREFIX} \
+                 CROSS_COMPILE_TA=${HOST_PREFIX} \
                  O=${B} \
                "
 
meta-arm/recipes-security/optee/optee.inc +21 -0
index 4bf87fe..8aaf616 100644
@@ -1,3 +1,24 @@
 COMPATIBLE_MACHINE ?= "invalid"
 COMPATIBLE_MACHINE_qemuarm64 ?= "qemuarm64"
 # Please add supported machines below or set it in .bbappend or .conf
+
+OPTEEMACHINE ?= "${MACHINE}"
+OPTEEMACHINE_aarch64_qemuall ?= "vexpress-qemu_armv8a"
+
+OPTEE_ARCH = "null"
+OPTEE_ARCH_armv7a = "arm32"
+OPTEE_ARCH_aarch64 = "arm64"
+OPTEE_CORE = "${@d.getVar('OPTEE_ARCH').upper()}"
+
+OPTEE_COMPILER = "${@d.getVar('TOOLCHAIN') or 'gcc'}"
+
+# Set here but not passed to EXTRA_OEMAKE by default as that breaks
+# the optee-os build
+TA_DEV_KIT_DIR = "${STAGING_INCDIR}/optee/export-user_ta"
+
+EXTRA_OEMAKE += "V=1 \
+                 LIBGCC_LOCATE_CFLAGS=--sysroot=${STAGING_DIR_HOST} \
+                 COMPILER=${OPTEE_COMPILER} \
+                 OPTEE_CLIENT_EXPORT=${STAGING_DIR_HOST}${prefix} \
+                 TEEC_EXPORT=${STAGING_DIR_HOST}${prefix} \
+                "
Signature · 1 line
2.25.1
#10 lore raw

Re: [meta-arm] [PATCH 7/7] arm/optee: consolidate common variables

Quoted 10 lines · Denys Dmytriyenko

meta-arm/recipes-security/optee/optee-os.inc SRC_URI = "git://github.com/OP-TEE/optee_os.git" · line 35

Quoted 8 lines
meta-arm/recipes-security/optee/optee-os.inc +1 -2
-EXTRA_OEMAKE = " \
+EXTRA_OEMAKE += " \
     PLATFORM=${OPTEEMACHINE} \
     CFG_${OPTEE_CORE}_core=y \
     CROSS_COMPILE_core=${HOST_PREFIX} \
     CROSS_COMPILE_ta_${OPTEE_ARCH}=${HOST_PREFIX} \
     NOWERROR=1 \
-    V=1 \

I noticed verbose building got disabled - any specific reasons?

See optee.inc:

Quoted 1 line
Quoted 1 line

+EXTRA_OEMAKE += "V=1 \

Ross

#11 lore raw
In reply to Ross Burton
Quoted 5 lines · Ross Burton

optee-test uses the same functionality to find libstdc++ and libgcc_eh, so ensure that these libraries are found with the right sysroot too.

Change-Id Ice0506a42655223045bcabec790eae3a3dbcf245

Series applied to master.

Thanks,
Jon

Quoted 57 lines
---
 ...ow-setting-sysroot-for-libgcc-lookup.patch | 26 ++++++++++++++-----
 1 file changed, 19 insertions(+), 7 deletions(-)
meta-arm/recipes-security/optee/optee-os/0006-allow-setting-sysroot-for-libgcc-lookup.patch +19 -7
index 86e8428..1700539 100644
@@ -1,22 +1,34 @@
-From 017994c477e2d082395460de83a7828d4e7d4b70 Mon Sep 17 00:00:00 2001
-From: Joshua Watt <[email protected]>
+From 0bab935695ebcf0c533b49896ab18ff33d4a47d1 Mon Sep 17 00:00:00 2001
+From: Ross Burton <[email protected]>
 Date: Tue, 26 May 2020 14:38:02 -0500
 Subject: [PATCH] allow setting sysroot for libgcc lookup
 
+Explicitly pass the new variable LIBGCC_LOCATE_CFLAGS variable when searching
+for the compiler libraries as there's no easy way to reliably pass --sysroot
+otherwise.
+
+Upstream-Status: Pending [https://github.com/OP-TEE/optee_os/issues/4188]
+Signed-off-by: Ross Burton <[email protected]>
 ---
- mk/gcc.mk | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
+ mk/gcc.mk | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
 
 diff --git a/mk/gcc.mk b/mk/gcc.mk
-index adc77a24..e238b9f3 100644
+index adc77a24..81bfa78a 100644
 --- a/mk/gcc.mk
 +++ b/mk/gcc.mk
-@@ -13,7 +13,7 @@ nostdinc$(sm)	:= -nostdinc -isystem $(shell $(CC$(sm)) \
+@@ -13,11 +13,11 @@ nostdinc$(sm)	:= -nostdinc -isystem $(shell $(CC$(sm)) \
  			-print-file-name=include 2> /dev/null)
 
  # Get location of libgcc from gcc
 -libgcc$(sm)  	:= $(shell $(CC$(sm)) $(CFLAGS$(arch-bits-$(sm))) \
 +libgcc$(sm)  	:= $(shell $(CC$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CFLAGS$(arch-bits-$(sm))) \
  			-print-libgcc-file-name 2> /dev/null)
- libstdc++$(sm)	:= $(shell $(CXX$(sm)) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \
+-libstdc++$(sm)	:= $(shell $(CXX$(sm)) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \
++libstdc++$(sm)	:= $(shell $(CXX$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \
  			-print-file-name=libstdc++.a 2> /dev/null)
+-libgcc_eh$(sm)	:= $(shell $(CXX$(sm)) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \
++libgcc_eh$(sm)	:= $(shell $(CXX$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \
+ 			-print-file-name=libgcc_eh.a 2> /dev/null)
+ 
+ # Define these to something to discover accidental use
Signature · 1 line
2.25.1