arm/optee: version uplift 3.11.0 -> 3.14.0
PATCH 1/1 arm/optee: version uplift 3.11.0 -> 3.14.0
Brief description of changes:
- Version uplift 3.11.0 -> 3.14.0.
- Removed OP-TEE patches that has already been accepted upstream.
- Added support for tee-supplicant plugin framework testing.
Tested on qemuarm64_secureboot:
$ xtest -l 15 $ optee-examples_*
--- .../optee/optee-client_3.11.0.bb | 3 - .../optee/optee-client_3.14.0.bb | 3 + .../recipes-security/optee/optee-examples.inc | 9 +- .../0001-make-Pass-ldflags-during-link.patch | 103 ------------------ ...efault-cross-compiler-environment-se.patch | 84 ++++++++++++++ ...nable-plugins-installation-in-rootfs.patch | 39 +++++++ .../optee/optee-examples_3.11.0.bb | 4 - .../optee/optee-examples_3.14.0.bb | 4 + ...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 | 11 -- .../recipes-security/optee/optee-os_3.14.0.bb | 8 ++ .../recipes-security/optee/optee-test.inc | 15 +-- ...Adjust-order-of-including-compiler.h.patch | 64 ----------- ...ake-remove-Wno-unsafe-loop-for-clang.patch | 31 ------ ...e-remove-Wmissing-noreturn-for-clang.patch | 31 ------ .../optee/optee-test_3.11.0.bb | 3 - .../optee/optee-test_3.14.0.bb | 3 + 19 files changed, 154 insertions(+), 422 deletions(-) delete mode 100644 meta-arm/recipes-security/optee/optee-client_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-client_3.14.0.bb delete mode 100644 meta-arm/recipes-security/optee/optee-examples/0001-make-Pass-ldflags-during-link.patch create mode 100644 meta-arm/recipes-security/optee/optee-examples/0001-plugins-Honour-default-cross-compiler-environment-se.patch create mode 100644 meta-arm/recipes-security/optee/optee-examples/0002-Makefile-Enable-plugins-installation-in-rootfs.patch delete mode 100644 meta-arm/recipes-security/optee/optee-examples_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-examples_3.14.0.bb delete mode 100644 meta-arm/recipes-security/optee/optee-os/0001-libutils-provide-empty-__getauxval-implementation.patch delete mode 100644 meta-arm/recipes-security/optee/optee-os/0002-link.mk-implement-support-for-libnames-after-libgcc-.patch delete mode 100644 meta-arm/recipes-security/optee/optee-os/0003-ta_dev_kit.mk-make-sure-that-libutils-is-linked-seco.patch delete mode 100644 meta-arm/recipes-security/optee/optee-os_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-os_3.14.0.bb delete mode 100644 meta-arm/recipes-security/optee/optee-test/0001-host-xtest-Adjust-order-of-including-compiler.h.patch delete mode 100644 meta-arm/recipes-security/optee/optee-test/0002-make-remove-Wno-unsafe-loop-for-clang.patch delete mode 100644 meta-arm/recipes-security/optee/optee-test/0003-make-remove-Wmissing-noreturn-for-clang.patch delete mode 100644 meta-arm/recipes-security/optee/optee-test_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-test_3.14.0.bb
meta-arm/recipes-security/optee/optee-client_3.11.0.bb deleted +0 -3
@@ -1,3 +0,0 @@ -require optee-client.inc - -SRCREV = "c0c925384c1d7e3558d27d2708857482952d7907"
meta-arm/recipes-security/optee/optee-client_3.14.0.bb new file +3 -0
@@ -0,0 +1,3 @@ +require optee-client.inc + +SRCREV = "06e1b32f6a7028e039c625b07cfc25fda0c17d53"
meta-arm/recipes-security/optee/optee-examples.inc +7 -2
@@ -12,7 +12,8 @@ inherit python3native require optee.inc SRC_URI = "git://github.com/linaro-swg/optee_examples.git \ - file://0001-make-Pass-ldflags-during-link.patch \ + file://0001-plugins-Honour-default-cross-compiler-environment-se.patch \ + file://0002-Makefile-Enable-plugins-installation-in-rootfs.patch \ " EXTRA_OEMAKE += "TA_DEV_KIT_DIR=${TA_DEV_KIT_DIR} \
@@ -32,11 +33,15 @@ do_compile[cleandirs] = "${B}" do_install () { mkdir -p ${D}${nonarch_base_libdir}/optee_armtz mkdir -p ${D}${bindir} + mkdir -p ${D}${libdir}/tee-supplicant/plugins install -D -p -m0755 ${B}/ca/* ${D}${bindir} install -D -p -m0444 ${B}/ta/* ${D}${nonarch_base_libdir}/optee_armtz + install -D -p -m0444 ${B}/plugins/* ${D}${libdir}/tee-supplicant/plugins } -FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/" +FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/ \ + ${libdir}/tee-supplicant/plugins/ \ + " # Imports machine specific configs from staging to build PACKAGE_ARCH = "${MACHINE_ARCH}"
meta-arm/recipes-security/optee/optee-examples/0001-make-Pass-ldflags-during-link.patch deleted +0 -103
103 lines not on this page · raw message
meta-arm/recipes-security/optee/optee-examples/0001-plugins-Honour-default-cross-compiler-environment-se.patch new file +84 -0
84 lines not on this page · raw message
meta-arm/recipes-security/optee/optee-examples/0002-Makefile-Enable-plugins-installation-in-rootfs.patch new file +39 -0
@@ -0,0 +1,39 @@ +From a865f2e25e178fc2c4617eb1faf79ac922d02ffd Mon Sep 17 00:00:00 2001 +From: Sumit Garg <[email protected]> +Date: Tue, 20 Jul 2021 14:20:10 +0530 +Subject: [PATCH 2/2] Makefile: Enable plugins installation in rootfs + +Upstream-Status: Submitted [https://github.com/linaro-swg/optee_examples/pull/87] + +Signed-off-by: Sumit Garg <[email protected]> +--- + Makefile | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/Makefile b/Makefile +index a275842..b3f16aa 100644 +--- a/Makefile ++++ b/Makefile +@@ -25,14 +25,19 @@ prepare-for-rootfs: examples + @mkdir -p $(OUTPUT_DIR) + @mkdir -p $(OUTPUT_DIR)/ta + @mkdir -p $(OUTPUT_DIR)/ca ++ @mkdir -p $(OUTPUT_DIR)/plugins + @for example in $(EXAMPLE_LIST); do \ + if [ -e $$example/host/optee_example_$$example ]; then \ + cp -p $$example/host/optee_example_$$example $(OUTPUT_DIR)/ca/; \ + fi; \ + cp -pr $$example/ta/*.ta $(OUTPUT_DIR)/ta/; \ ++ if [ $$example == plugins ]; then \ ++ cp -p plugins/syslog/*.plugin $(OUTPUT_DIR)/plugins/; \ ++ fi; \ + done + + prepare-for-rootfs-clean: + @rm -rf $(OUTPUT_DIR)/ta + @rm -rf $(OUTPUT_DIR)/ca ++ @rm -rf $(OUTPUT_DIR)/plugins + @rmdir --ignore-fail-on-non-empty $(OUTPUT_DIR) || test ! -e $(OUTPUT_DIR) +-- +2.25.1 +
meta-arm/recipes-security/optee/optee-examples_3.11.0.bb deleted +0 -4
@@ -1,4 +0,0 @@ -require optee-examples.inc - -SRCREV = "9a7dc598591990349d88b4dba3a37aadd6851295" -
meta-arm/recipes-security/optee/optee-examples_3.14.0.bb new file +4 -0
@@ -0,0 +1,4 @@ +require optee-examples.inc + +SRCREV = "e9c870525af8f7e7fccf575a0ca5394ce55adcec" +
meta-arm/recipes-security/optee/optee-os/0001-libutils-provide-empty-__getauxval-implementation.patch deleted +0 -62
62 lines not on this page · raw message
meta-arm/recipes-security/optee/optee-os/0002-link.mk-implement-support-for-libnames-after-libgcc-.patch deleted +0 -55
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 deleted +0 -44
44 lines not on this page · raw message
meta-arm/recipes-security/optee/optee-os_3.11.0.bb deleted +0 -11
@@ -1,11 +0,0 @@ -require optee-os.inc - -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 \ -"
meta-arm/recipes-security/optee/optee-os_3.14.0.bb new file +8 -0
@@ -0,0 +1,8 @@ +require optee-os.inc + +SRCREV = "d21befa5e53eae9db469eba1685f5aa5c6f92c2f" + +SRC_URI_append = " \ + file://0006-allow-setting-sysroot-for-libgcc-lookup.patch \ + file://0007-allow-setting-sysroot-for-clang.patch \ +"
meta-arm/recipes-security/optee/optee-test.inc +6 -9
@@ -8,17 +8,9 @@ LIC_FILES_CHKSUM = "file://${S}/LICENSE.md;md5=daa2bcccc666345ab8940aab1315a4fa" inherit python3native ptest require optee.inc -# Linking fails on musl due to C++/threads -# https://github.com/OP-TEE/optee_test/issues/458#issuecomment-720540834 -# When upgraded we should be able to remove this limitation -COMPATIBLE_HOST_libc-musl = 'null' - DEPENDS = "optee-client optee-os python3-pycryptodome-native" SRC_URI = "git://github.com/OP-TEE/optee_test.git \ - file://0001-host-xtest-Adjust-order-of-including-compiler.h.patch \ - file://0002-make-remove-Wno-unsafe-loop-for-clang.patch \ - file://0003-make-remove-Wmissing-noreturn-for-clang.patch \ file://run-ptest \ "
@@ -36,6 +28,7 @@ do_compile() { # Top level makefile doesn't seem to handle parallel make gracefully oe_runmake xtest oe_runmake ta + oe_runmake test_plugin } do_compile[cleandirs] = "${B}"
@@ -46,9 +39,13 @@ do_install () { # default TEEC_LOAD_PATH is /lib mkdir -p ${D}${nonarch_base_libdir}/optee_armtz/ install -D -p -m0444 ${B}/ta/*/*.ta ${D}${nonarch_base_libdir}/optee_armtz/ + mkdir -p ${D}${libdir}/tee-supplicant/plugins + install -D -p -m0444 ${B}/supp_plugin/*.plugin ${D}${libdir}/tee-supplicant/plugins/ } -FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/" +FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/ \ + ${libdir}/tee-supplicant/plugins/ \ + " # Imports machine specific configs from staging to build PACKAGE_ARCH = "${MACHINE_ARCH}"
meta-arm/recipes-security/optee/optee-test/0001-host-xtest-Adjust-order-of-including-compiler.h.patch deleted +0 -64
64 lines not on this page · raw message
meta-arm/recipes-security/optee/optee-test/0002-make-remove-Wno-unsafe-loop-for-clang.patch deleted +0 -31
@@ -1,31 +0,0 @@ -From 438533ce9da1df0b7c7914e64b39ffdc1da1ab79 Mon Sep 17 00:00:00 2001 -From: Brett Warren <[email protected]> -Date: Thu, 8 Oct 2020 10:03:25 +0100 -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 [https://github.com/OP-TEE/optee_test/issues/452] -Changed-Id: 71cb511904547d790d1ea98f93bf8e5a6afcb36d -Signed-off-by: Brett Warren <[email protected]> ---- - host/xtest/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/host/xtest/Makefile b/host/xtest/Makefile -index 3c206b0..96746de 100644 ---- a/host/xtest/Makefile -+++ b/host/xtest/Makefile -@@ -169,7 +169,7 @@ CFLAGS += -Wall -Wcast-align -Werror \ - -Werror-implicit-function-declaration -Wextra -Wfloat-equal \ - -Wformat-nonliteral -Wformat-security -Wformat=2 -Winit-self \ - -Wmissing-declarations -Wmissing-format-attribute \ -- -Wmissing-include-dirs -Wmissing-noreturn \ -+ -Wmissing-include-dirs \ - -Wmissing-prototypes -Wnested-externs -Wpointer-arith \ - -Wshadow -Wstrict-prototypes -Wswitch-default \ - -Wwrite-strings \ --- -2.17.1 -
meta-arm/recipes-security/optee/optee-test/0003-make-remove-Wmissing-noreturn-for-clang.patch deleted +0 -31
@@ -1,31 +0,0 @@ -From ed5a9d9f7a3e9e14ca0e8aea59008124ee0e5f96 Mon Sep 17 00:00:00 2001 -From: Brett Warren <[email protected]> -Date: Thu, 8 Oct 2020 10:20:52 +0100 -Subject: [PATCH] make: remove -Wno-unsafe-loop for clang - -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 [https://github.com/OP-TEE/optee_test/issues/452] -Change-Id: 5fe0892c73208aaffac8c9995cb3275936fb1ba6 -Signed-off-by: Brett Warren <[email protected]> ---- - host/xtest/Makefile | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/host/xtest/Makefile b/host/xtest/Makefile -index 96746de..73731d0 100644 ---- a/host/xtest/Makefile -+++ b/host/xtest/Makefile -@@ -174,7 +174,6 @@ CFLAGS += -Wall -Wcast-align -Werror \ - -Wshadow -Wstrict-prototypes -Wswitch-default \ - -Wwrite-strings \ - -Wno-declaration-after-statement \ -- -Wno-unsafe-loop-optimizations \ - -Wno-missing-field-initializers -Wno-format-zero-length - endif - --- -2.17.1 -
meta-arm/recipes-security/optee/optee-test_3.11.0.bb deleted +0 -3
@@ -1,3 +0,0 @@ -require optee-test.inc - -SRCREV = "159e295d5cc3ad2275ab15fe544620f6604d4ba4"
meta-arm/recipes-security/optee/optee-test_3.14.0.bb new file +3 -0
@@ -0,0 +1,3 @@ +require optee-test.inc + +SRCREV = "f2eb88affbb7f028561b4fd5cbd049d5d704f741"
Signature · 1 line
2.25.1
Quoted 8 lines · Sumit Garg
Brief description of changes:
- Version uplift 3.11.0 -> 3.14.0.
- Removed OP-TEE patches that has already been accepted upstream.
- Added support for tee-supplicant plugin framework testing.Tested on
qemuarm64_secureboot:$ xtest -l 15 $ optee-examples_*
Unfortunately, TC0 is using the 3.11 version. So, it breaks when applying this patch. Can you rework this patch to keep the old version around?
Thanks,
Jon
Quoted 778 lines
Signed-off-by Sumit Garg <[email protected]>--- .../optee/optee-client_3.11.0.bb | 3 - .../optee/optee-client_3.14.0.bb | 3 + .../recipes-security/optee/optee-examples.inc | 9 +- .../0001-make-Pass-ldflags-during-link.patch | 103 ------------------ ...efault-cross-compiler-environment-se.patch | 84 ++++++++++++++ ...nable-plugins-installation-in-rootfs.patch | 39 +++++++ .../optee/optee-examples_3.11.0.bb | 4 - .../optee/optee-examples_3.14.0.bb | 4 + ...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 | 11 -- .../recipes-security/optee/optee-os_3.14.0.bb | 8 ++ .../recipes-security/optee/optee-test.inc | 15 +-- ...Adjust-order-of-including-compiler.h.patch | 64 ----------- ...ake-remove-Wno-unsafe-loop-for-clang.patch | 31 ------ ...e-remove-Wmissing-noreturn-for-clang.patch | 31 ------ .../optee/optee-test_3.11.0.bb | 3 - .../optee/optee-test_3.14.0.bb | 3 + 19 files changed, 154 insertions(+), 422 deletions(-) delete mode 100644 meta-arm/recipes-security/optee/optee-client_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-client_3.14.0.bb delete mode 100644 meta-arm/recipes-security/optee/optee-examples/0001-make-Pass-ldflags-during-link.patch create mode 100644 meta-arm/recipes-security/optee/optee-examples/0001-plugins-Honour-default-cross-compiler-environment-se.patch create mode 100644 meta-arm/recipes-security/optee/optee-examples/0002-Makefile-Enable-plugins-installation-in-rootfs.patch delete mode 100644 meta-arm/recipes-security/optee/optee-examples_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-examples_3.14.0.bb delete mode 100644 meta-arm/recipes-security/optee/optee-os/0001-libutils-provide-empty-__getauxval-implementation.patch delete mode 100644 meta-arm/recipes-security/optee/optee-os/0002-link.mk-implement-support-for-libnames-after-libgcc-.patch delete mode 100644 meta-arm/recipes-security/optee/optee-os/0003-ta_dev_kit.mk-make-sure-that-libutils-is-linked-seco.patch delete mode 100644 meta-arm/recipes-security/optee/optee-os_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-os_3.14.0.bb delete mode 100644 meta-arm/recipes-security/optee/optee-test/0001-host-xtest-Adjust-order-of-including-compiler.h.patch delete mode 100644 meta-arm/recipes-security/optee/optee-test/0002-make-remove-Wno-unsafe-loop-for-clang.patch delete mode 100644 meta-arm/recipes-security/optee/optee-test/0003-make-remove-Wmissing-noreturn-for-clang.patch delete mode 100644 meta-arm/recipes-security/optee/optee-test_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-test_3.14.0.bbmeta-arm/recipes-security/optee/optee-client_3.11.0.bb deleted +0
-3@@ -1,3 +0,0 @@ -require optee-client.inc - -SRCREV = "c0c925384c1d7e3558d27d2708857482952d7907"meta-arm/recipes-security/optee/optee-client_3.14.0.bb new file +3
-0@@ -0,0 +1,3 @@ +require optee-client.inc + +SRCREV = "06e1b32f6a7028e039c625b07cfc25fda0c17d53"meta-arm/recipes-security/optee/optee-examples.inc +7
-2@@ -12,7 +12,8 @@ inherit python3native require optee.inc SRC_URI = "git://github.com/linaro-swg/optee_examples.git \ - file://0001-make-Pass-ldflags-during-link.patch \ + file://0001-plugins-Honour-default-cross-compiler-environment-se.patch \ + file://0002-Makefile-Enable-plugins-installation-in-rootfs.patch \ " EXTRA_OEMAKE += "TA_DEV_KIT_DIR=${TA_DEV_KIT_DIR} \@@ -32,11 +33,15 @@ do_compile[cleandirs] = "${B}" do_install () { mkdir -p ${D}${nonarch_base_libdir}/optee_armtz mkdir -p ${D}${bindir} + mkdir -p ${D}${libdir}/tee-supplicant/plugins install -D -p -m0755 ${B}/ca/* ${D}${bindir} install -D -p -m0444 ${B}/ta/* ${D}${nonarch_base_libdir}/optee_armtz + install -D -p -m0444 ${B}/plugins/* ${D}${libdir}/tee-supplicant/plugins } -FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/" +FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/ \ + ${libdir}/tee-supplicant/plugins/ \ + " # Imports machine specific configs from staging to build PACKAGE_ARCH = "${MACHINE_ARCH}"meta-arm/recipes-security/optee/optee-examples/0001-make-Pass-ldflags-during-link.patch deleted +0
-103@@ -1,103 +0,0 @@ -From 29ae21de41f2fbab6dbecbbf408826b28de82df1 Mon Sep 17 00:00:00 2001 -From: Khem Raj <[email protected]> -Date: Tue, 1 Sep 2020 21:09:56 -0700 -Subject: [PATCH] make: Pass ldflags during link - -OpenEmbeeded needs to pass essential linker flags to set correct flags -for gnu_hash among others which sets the linking straight -using LDFLAGS varible here means, we can affect the linker flags -from build environment - -Upstream-Status: Submitted [https://github.com/linaro-swg/optee_examples/pull/85] - -Signed-off-by: Khem Raj <[email protected]> ---- - acipher/host/Makefile | 2 +- - aes/host/Makefile | 2 +- - hello_world/host/Makefile | 2 +- - hotp/host/Makefile | 2 +- - random/host/Makefile | 2 +- - secure_storage/host/Makefile | 2 +- - 6 files changed, 6 insertions(+), 6 deletions(-) - -diff --git a/acipher/host/Makefile b/acipher/host/Makefile -index 8f4bc8a..c2cabef 100644 ---- a/acipher/host/Makefile -+++ b/acipher/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_acipher - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/aes/host/Makefile b/aes/host/Makefile -index dfeb4e8..f61c71b 100644 ---- a/aes/host/Makefile -+++ b/aes/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_aes - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/hello_world/host/Makefile b/hello_world/host/Makefile -index c4c8239..69cf42c 100644 ---- a/hello_world/host/Makefile -+++ b/hello_world/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_hello_world - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/hotp/host/Makefile b/hotp/host/Makefile -index cb7fd19..e7f013f 100644 ---- a/hotp/host/Makefile -+++ b/hotp/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_hotp - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/random/host/Makefile b/random/host/Makefile -index fd407d9..9377f7a 100644 ---- a/random/host/Makefile -+++ b/random/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_random - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/secure_storage/host/Makefile b/secure_storage/host/Makefile -index 29bfb87..b3265ae 100644 ---- a/secure_storage/host/Makefile -+++ b/secure_storage/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_secure_storage - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: --- -2.28.0 -meta-arm/recipes-security/optee/optee-examples/0001-plugins-Honour-default-cross-compiler-environment-se.patch new file +84
-0@@ -0,0 +1,84 @@ +From 79c826c249001700007a6dffe80c3d61ff4428ef Mon Sep 17 00:00:00 2001 +From: Sumit Garg <[email protected]> +Date: Tue, 20 Jul 2021 13:54:30 +0530 +Subject: [PATCH 1/2] plugins: Honour default cross compiler environment setup + +Honour default $(CC), $(CFLAGS) and $(LDFLAGS) variables. Without this +plugins example fails to build for OE/Yocto. + +Upstream-Status: Submitted [https://github.com/linaro-swg/optee_examples/pull/87] + +Signed-off-by: Sumit Garg <[email protected]> +--- + plugins/Makefile | 2 +- + plugins/host/Makefile | 2 +- + plugins/syslog/Makefile | 16 ++++++++++++---- + 3 files changed, 14 insertions(+), 6 deletions(-) + +diff --git a/plugins/Makefile b/plugins/Makefile +index 2372b38..ea472b4 100644 +--- a/plugins/Makefile ++++ b/plugins/Makefile +@@ -8,7 +8,7 @@ TA_CROSS_COMPILE ?= $(CROSS_COMPILE) + all: + $(MAKE) -C host CROSS_COMPILE="$(HOST_CROSS_COMPILE)" --no-builtin-variables + $(MAKE) -C ta CROSS_COMPILE="$(TA_CROSS_COMPILE)" LDFLAGS="" +- $(MAKE) -C syslog CROSS_COMPILE="$(HOST_CROSS_COMPILE)" ++ $(MAKE) -C syslog CROSS_COMPILE="$(HOST_CROSS_COMPILE)" --no-builtin-variables + + .PHONY: clean + clean: +diff --git a/plugins/host/Makefile b/plugins/host/Makefile +index 7285104..76244c7 100644 +--- a/plugins/host/Makefile ++++ b/plugins/host/Makefile +@@ -20,7 +20,7 @@ BINARY = optee_example_plugins + all: $(BINARY) + + $(BINARY): $(OBJS) +- $(CC) -o $@ $< $(LDADD) ++ $(CC) $(LDFLAGS) -o $@ $< $(LDADD) + + .PHONY: clean + clean: +diff --git a/plugins/syslog/Makefile b/plugins/syslog/Makefile +index 62d916a..71f5f92 100644 +--- a/plugins/syslog/Makefile ++++ b/plugins/syslog/Makefile +@@ -1,3 +1,11 @@ ++CC ?= $(CROSS_COMPILE)gcc ++LD ?= $(CROSS_COMPILE)ld ++AR ?= $(CROSS_COMPILE)ar ++NM ?= $(CROSS_COMPILE)nm ++OBJCOPY ?= $(CROSS_COMPILE)objcopy ++OBJDUMP ?= $(CROSS_COMPILE)objdump ++READELF ?= $(CROSS_COMPILE)readelf ++ + PLUGIN_UUID = 96bcf744-4f72-4866-bf1d-8634fd9c65e5 + + PLUGIN = $(PLUGIN_UUID).plugin +@@ -6,17 +14,17 @@ PLUGIN_OBJ = $(patsubst %.c, %.o, $(PLUGIN_SRS)) + PLUGIN_INCLUDES_DIR = $(CURDIR) $(TEEC_EXPORT)/include + + PLUGIN_INCLUDES = $(addprefix -I, $(PLUGIN_INCLUDES_DIR)) +-PLUGIN_CCFLAGS = -Wall -fPIC +-PLUGIN_LDFLAGS = -shared ++PLUGIN_CCFLAGS = $(CFLAGS) -Wall -fPIC ++PLUGIN_LDFLAGS = $(LDFLAGS) -shared + + .PHONY: all + all: $(PLUGIN) + + $(PLUGIN): $(PLUGIN_OBJ) +- $(CROSS_COMPILE)gcc $(PLUGIN_LDFLAGS) $(PLUGIN_OBJ) -o $@ ++ $(CC) $(PLUGIN_LDFLAGS) $(PLUGIN_OBJ) -o $@ + + %.o: %.c +- $(CROSS_COMPILE)gcc $(PLUGIN_CCFLAGS) $(PLUGIN_INCLUDES) -c $*.c -o $*.o ++ $(CC) $(PLUGIN_CCFLAGS) $(PLUGIN_INCLUDES) -c $*.c -o $*.o + + .PHONY: clean + clean: +-- +2.25.1 +meta-arm/recipes-security/optee/optee-examples/0002-Makefile-Enable-plugins-installation-in-rootfs.patch new file +39
-0@@ -0,0 +1,39 @@ +From a865f2e25e178fc2c4617eb1faf79ac922d02ffd Mon Sep 17 00:00:00 2001 +From: Sumit Garg <[email protected]> +Date: Tue, 20 Jul 2021 14:20:10 +0530 +Subject: [PATCH 2/2] Makefile: Enable plugins installation in rootfs + +Upstream-Status: Submitted [https://github.com/linaro-swg/optee_examples/pull/87] + +Signed-off-by: Sumit Garg <[email protected]> +--- + Makefile | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/Makefile b/Makefile +index a275842..b3f16aa 100644 +--- a/Makefile ++++ b/Makefile +@@ -25,14 +25,19 @@ prepare-for-rootfs: examples + @mkdir -p $(OUTPUT_DIR) + @mkdir -p $(OUTPUT_DIR)/ta + @mkdir -p $(OUTPUT_DIR)/ca ++ @mkdir -p $(OUTPUT_DIR)/plugins + @for example in $(EXAMPLE_LIST); do \ + if [ -e $$example/host/optee_example_$$example ]; then \ + cp -p $$example/host/optee_example_$$example $(OUTPUT_DIR)/ca/; \ + fi; \ + cp -pr $$example/ta/*.ta $(OUTPUT_DIR)/ta/; \ ++ if [ $$example == plugins ]; then \ ++ cp -p plugins/syslog/*.plugin $(OUTPUT_DIR)/plugins/; \ ++ fi; \ + done + + prepare-for-rootfs-clean: + @rm -rf $(OUTPUT_DIR)/ta + @rm -rf $(OUTPUT_DIR)/ca ++ @rm -rf $(OUTPUT_DIR)/plugins + @rmdir --ignore-fail-on-non-empty $(OUTPUT_DIR) || test ! -e $(OUTPUT_DIR) +-- +2.25.1 +meta-arm/recipes-security/optee/optee-examples_3.11.0.bb deleted +0
-4@@ -1,4 +0,0 @@ -require optee-examples.inc - -SRCREV = "9a7dc598591990349d88b4dba3a37aadd6851295" -meta-arm/recipes-security/optee/optee-examples_3.14.0.bb new file +4
-0@@ -0,0 +1,4 @@ +require optee-examples.inc + +SRCREV = "e9c870525af8f7e7fccf575a0ca5394ce55adcec" +meta-arm/recipes-security/optee/optee-os/0001-libutils-provide-empty-__getauxval-implementation.patch deleted +0
-62@@ -1,62 +0,0 @@ -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 deleted +0
-55@@ -1,55 +0,0 @@ -Upstream-Status: Backport -Signed-off-by: Ross Burton <[email protected]> - -From 73196b58ea6978ffa5e581738030f51c5789ef73 Mon Sep 17 00:00:00 2001 -From: Volodymyr Babchuk <[email protected]> -Date: Tue, 13 Oct 2020 22:54:13 +0300 -Subject: [PATCH 2/3] link.mk: implement support for libnames-after-libgcc - variable - -Newer versions of libgcc depend on external __getauxval() symbol, which is -now provided by libutils. But libgcc is linked after libutils, so linker -can't resolve that symbol. We can't include libgcc into linking group with -libtutils, because libgcc provides symbols that conflict with libutil's -ones, like __aeabi_idiv with friends for instance. - -So, to resolve libgcc dependency on libutils we need to link with libutils -second time. To make things more generic, we will introduce -$(libnames-after-libgcc) variable for libraries that should be linked after -libgcc. - -Signed-off-by: Volodymyr Babchuk <[email protected]> -Reviewed-by: Jens Wiklander <[email protected]> -Reviewed-by: Jerome Forissier <[email protected]> ---- - ta/arch/arm/link.mk | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/ta/arch/arm/link.mk b/ta/arch/arm/link.mk -index 445c285d..3025acb1 100644 ---- a/ta/arch/arm/link.mk -+++ b/ta/arch/arm/link.mk -@@ -55,8 +55,11 @@ link-ldflags += --eh-frame-hdr - link-ldadd += $(libstdc++$(sm)) $(libgcc_eh$(sm)) - endif - link-ldadd += --end-group --ldargs-$(user-ta-uuid).elf := $(link-ldflags) $(objs) $(link-ldadd) $(libgcc$(sm)) - -+link-ldadd-after-libgcc += $(addprefix -l,$(libnames-after-libgcc)) -+ -+ldargs-$(user-ta-uuid).elf := $(link-ldflags) $(objs) $(link-ldadd) \ -+ $(libgcc$(sm)) $(link-ldadd-after-libgcc) - - link-script-cppflags-$(sm) := \ - $(filter-out $(CPPFLAGS_REMOVE) $(cppflags-remove), \ -@@ -76,6 +79,7 @@ $(link-script-pp$(sm)): $(link-script$(sm)) $(conf-file) $(link-script-pp-makefi - $(link-script-cppflags-$(sm)) $$< -o $$@ - - $(link-out-dir$(sm))/$(user-ta-uuid).elf: $(objs) $(libdeps) \ -+ $(libdeps-after-libgcc) \ - $(link-script-pp$(sm)) \ - $(dynlistdep) \ - $(additional-link-deps) --- -2.25.1 -meta-arm/recipes-security/optee/optee-os/0003-ta_dev_kit.mk-make-sure-that-libutils-is-linked-seco.patch deleted +0
-44@@ -1,44 +0,0 @@ -Upstream-Status: Backport -Signed-off-by: Ross Burton <[email protected]> - -From f50962e3f56f0932662b2ffa10afe53339a335dd Mon Sep 17 00:00:00 2001 -From: Volodymyr Babchuk <[email protected]> -Date: Fri, 16 Oct 2020 16:36:08 +0300 -Subject: [PATCH 3/3] ta_dev_kit.mk: make sure that libutils is linked second - time - -libgcc depends on __getauxval symbol from libuils. As, generally libutils -is linked before libgcc, we will get "unresolved symbol" error. To resolve -this dependency we need to link libutils second time - after libgcc. - -Signed-off-by: Volodymyr Babchuk <[email protected]> -Reviewed-by: Jens Wiklander <[email protected]> -Reviewed-by: Jerome Forissier <[email protected]> ---- - ta/mk/ta_dev_kit.mk | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/ta/mk/ta_dev_kit.mk b/ta/mk/ta_dev_kit.mk -index e28be677..d0e66317 100644 ---- a/ta/mk/ta_dev_kit.mk -+++ b/ta/mk/ta_dev_kit.mk -@@ -78,6 +78,16 @@ endif - libnames += dl - libdeps += $(ta-dev-kit-dir$(sm))/lib/libdl.a - -+# libutils provides __getauxval symbol which is needed by libgcc 10.x. We can't -+# link libutils after libgcc, because libgcc will replace some symbols provided -+# by libutils, which will cause further linking issues. -+# -+# But if we place libutils before libgcc, linker will not be able to resolve -+# __getauxval. So we need to link with libutils twice: before and after libgcc. -+# Hence it included both in $(libnames) and in $(libnames-after-libgcc) -+libnames-after-libgcc += utils -+libdeps-after-libgcc += $(ta-dev-kit-dir$(sm))/lib/libutils.a -+ - # Pass config variable (CFG_) from conf.mk on the command line - cppflags$(sm) += $(strip \ - $(foreach var, $(filter CFG_%,$(.VARIABLES)), \ --- -2.25.1 -meta-arm/recipes-security/optee/optee-os_3.11.0.bb deleted +0
-11@@ -1,11 +0,0 @@ -require optee-os.inc - -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 \ -"meta-arm/recipes-security/optee/optee-os_3.14.0.bb new file +8
-0@@ -0,0 +1,8 @@ +require optee-os.inc + +SRCREV = "d21befa5e53eae9db469eba1685f5aa5c6f92c2f" + +SRC_URI_append = " \ + file://0006-allow-setting-sysroot-for-libgcc-lookup.patch \ + file://0007-allow-setting-sysroot-for-clang.patch \ +"meta-arm/recipes-security/optee/optee-test.inc +6
-9@@ -8,17 +8,9 @@ LIC_FILES_CHKSUM = "file://${S}/LICENSE.md;md5=daa2bcccc666345ab8940aab1315a4fa" inherit python3native ptest require optee.inc -# Linking fails on musl due to C++/threads -# https://github.com/OP-TEE/optee_test/issues/458#issuecomment-720540834 -# When upgraded we should be able to remove this limitation -COMPATIBLE_HOST_libc-musl = 'null' - DEPENDS = "optee-client optee-os python3-pycryptodome-native" SRC_URI = "git://github.com/OP-TEE/optee_test.git \ - file://0001-host-xtest-Adjust-order-of-including-compiler.h.patch \ - file://0002-make-remove-Wno-unsafe-loop-for-clang.patch \ - file://0003-make-remove-Wmissing-noreturn-for-clang.patch \ file://run-ptest \ "@@ -36,6 +28,7 @@ do_compile() { # Top level makefile doesn't seem to handle parallel make gracefully oe_runmake xtest oe_runmake ta + oe_runmake test_plugin } do_compile[cleandirs] = "${B}"@@ -46,9 +39,13 @@ do_install () { # default TEEC_LOAD_PATH is /lib mkdir -p ${D}${nonarch_base_libdir}/optee_armtz/ install -D -p -m0444 ${B}/ta/*/*.ta ${D}${nonarch_base_libdir}/optee_armtz/ + mkdir -p ${D}${libdir}/tee-supplicant/plugins + install -D -p -m0444 ${B}/supp_plugin/*.plugin ${D}${libdir}/tee-supplicant/plugins/ } -FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/" +FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/ \ + ${libdir}/tee-supplicant/plugins/ \ + " # Imports machine specific configs from staging to build PACKAGE_ARCH = "${MACHINE_ARCH}"meta-arm/recipes-security/optee/optee-test/0001-host-xtest-Adjust-order-of-including-compiler.h.patch deleted +0
-64@@ -1,64 +0,0 @@ -From fc95b3ccbbfd336797ae2cfd6dd4dc58644e146f Mon Sep 17 00:00:00 2001 -From: Khem Raj <[email protected]> -Date: Sat, 30 May 2020 17:52:18 -0700 -Subject: [PATCH] host/xtest: Adjust order of including compiler.h - -compiler.h defines some defines which violate libc namespace e.g. -__unused, this works ok with glibc but fails in awkward ways with musl -the reason is musl uses __unused in its internal structures and this -define in compiler.h conflicts with system headers causing errors like - -recipe-sysroot/usr/include/bits/stat.h:17:19: error: expected identifier or '(' before '[' token unsigned __unused[2]; - ^ -including compiler.h afer sys/stat.h fixes the problem. - -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 +- - host/xtest/stats.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/host/xtest/install_ta.c b/host/xtest/install_ta.c -index 09a4c6d..6f7bb5c 100644 ---- a/host/xtest/install_ta.c -+++ b/host/xtest/install_ta.c -@@ -4,7 +4,6 @@ - * SPDX-License-Identifier: BSD-2-Clause - */ - --#include <compiler.h> - #include <dirent.h> - #include <err.h> - #include <errno.h> -@@ -20,6 +19,7 @@ - #include <sys/types.h> - #include <tee_client_api.h> - #include <unistd.h> -+#include <compiler.h> - - #include "install_ta.h" - #include "xtest_helpers.h" -diff --git a/host/xtest/stats.c b/host/xtest/stats.c -index 96b0b5f..db9bf25 100644 ---- a/host/xtest/stats.c -+++ b/host/xtest/stats.c -@@ -3,7 +3,6 @@ - * Copyright (c) 2019, Linaro Limited - */ - --#include <compiler.h> - #include <dirent.h> - #include <err.h> - #include <errno.h> -@@ -18,6 +17,7 @@ - #include <sys/types.h> - #include <tee_client_api.h> - #include <unistd.h> -+#include <compiler.h> - #include "xtest_test.h" - #include "stats.h" - --- -2.26.2 -meta-arm/recipes-security/optee/optee-test/0002-make-remove-Wno-unsafe-loop-for-clang.patch deleted +0
-31@@ -1,31 +0,0 @@ -From 438533ce9da1df0b7c7914e64b39ffdc1da1ab79 Mon Sep 17 00:00:00 2001 -From: Brett Warren <[email protected]> -Date: Thu, 8 Oct 2020 10:03:25 +0100 -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 [https://github.com/OP-TEE/optee_test/issues/452] -Changed-Id: 71cb511904547d790d1ea98f93bf8e5a6afcb36d -Signed-off-by: Brett Warren <[email protected]> ---- - host/xtest/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/host/xtest/Makefile b/host/xtest/Makefile -index 3c206b0..96746de 100644 ---- a/host/xtest/Makefile -+++ b/host/xtest/Makefile -@@ -169,7 +169,7 @@ CFLAGS += -Wall -Wcast-align -Werror \ - -Werror-implicit-function-declaration -Wextra -Wfloat-equal \ - -Wformat-nonliteral -Wformat-security -Wformat=2 -Winit-self \ - -Wmissing-declarations -Wmissing-format-attribute \ -- -Wmissing-include-dirs -Wmissing-noreturn \ -+ -Wmissing-include-dirs \ - -Wmissing-prototypes -Wnested-externs -Wpointer-arith \ - -Wshadow -Wstrict-prototypes -Wswitch-default \ - -Wwrite-strings \ --- -2.17.1 -meta-arm/recipes-security/optee/optee-test/0003-make-remove-Wmissing-noreturn-for-clang.patch deleted +0
-31@@ -1,31 +0,0 @@ -From ed5a9d9f7a3e9e14ca0e8aea59008124ee0e5f96 Mon Sep 17 00:00:00 2001 -From: Brett Warren <[email protected]> -Date: Thu, 8 Oct 2020 10:20:52 +0100 -Subject: [PATCH] make: remove -Wno-unsafe-loop for clang - -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 [https://github.com/OP-TEE/optee_test/issues/452] -Change-Id: 5fe0892c73208aaffac8c9995cb3275936fb1ba6 -Signed-off-by: Brett Warren <[email protected]> ---- - host/xtest/Makefile | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/host/xtest/Makefile b/host/xtest/Makefile -index 96746de..73731d0 100644 ---- a/host/xtest/Makefile -+++ b/host/xtest/Makefile -@@ -174,7 +174,6 @@ CFLAGS += -Wall -Wcast-align -Werror \ - -Wshadow -Wstrict-prototypes -Wswitch-default \ - -Wwrite-strings \ - -Wno-declaration-after-statement \ -- -Wno-unsafe-loop-optimizations \ - -Wno-missing-field-initializers -Wno-format-zero-length - endif - --- -2.17.1 -meta-arm/recipes-security/optee/optee-test_3.11.0.bb deleted +0
-3@@ -1,3 +0,0 @@ -require optee-test.inc - -SRCREV = "159e295d5cc3ad2275ab15fe544620f6604d4ba4"meta-arm/recipes-security/optee/optee-test_3.14.0.bb new file +3
-0@@ -0,0 +1,3 @@ +require optee-test.inc + +SRCREV = "f2eb88affbb7f028561b4fd5cbd049d5d704f741"Signature · 1 line
2.25.1
+ TC0 platform maintainer in OP-TEE
Hi Jon,
Quoted 7 lines · Jon Mason
Quoted 5 lines · Sumit Garg
Brief description of changes:
- Version uplift 3.11.0 -> 3.14.0.
- Removed OP-TEE patches that has already been accepted upstream.
- Added support for tee-supplicant plugin framework testing.
Quoted 7 lines
Quoted 3 lines
Tested on
qemuarm64_secureboot:$ xtest -l 15 $ optee-examples_*Unfortunately, TC0 is using the 3.11 version. So, it breaks when applying this patch.
The TC0 platform support was recently merged in OP-TEE upstream [1]. So I took the liberty to migrate corresponding recipes as well [2] which is build tested only as I don't possess access to the platform itself.
[1] https://github.com/OP-TEE/optee_os/pull/4736
[2] https://lists.yoctoproject.org/g/meta-arm/message/2091
Quoted 3 lines
Can you rework this patch to keep the old
version around?
With TC0 support for 3.14.0, I think we should be able to drop support for the old version.
-Sumit
Quoted 782 lines
Thanks,
JonQuoted 778 lines
Signed-off-by Sumit Garg <[email protected]>--- .../optee/optee-client_3.11.0.bb | 3 - .../optee/optee-client_3.14.0.bb | 3 + .../recipes-security/optee/optee-examples.inc | 9 +- .../0001-make-Pass-ldflags-during-link.patch | 103 ------------------ ...efault-cross-compiler-environment-se.patch | 84 ++++++++++++++ ...nable-plugins-installation-in-rootfs.patch | 39 +++++++ .../optee/optee-examples_3.11.0.bb | 4 - .../optee/optee-examples_3.14.0.bb | 4 + ...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 | 11 -- .../recipes-security/optee/optee-os_3.14.0.bb | 8 ++ .../recipes-security/optee/optee-test.inc | 15 +-- ...Adjust-order-of-including-compiler.h.patch | 64 ----------- ...ake-remove-Wno-unsafe-loop-for-clang.patch | 31 ------ ...e-remove-Wmissing-noreturn-for-clang.patch | 31 ------ .../optee/optee-test_3.11.0.bb | 3 - .../optee/optee-test_3.14.0.bb | 3 + 19 files changed, 154 insertions(+), 422 deletions(-) delete mode 100644 meta-arm/recipes-security/optee/optee-client_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-client_3.14.0.bb delete mode 100644 meta-arm/recipes-security/optee/optee-examples/0001-make-Pass-ldflags-during-link.patch create mode 100644 meta-arm/recipes-security/optee/optee-examples/0001-plugins-Honour-default-cross-compiler-environment-se.patch create mode 100644 meta-arm/recipes-security/optee/optee-examples/0002-Makefile-Enable-plugins-installation-in-rootfs.patch delete mode 100644 meta-arm/recipes-security/optee/optee-examples_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-examples_3.14.0.bb delete mode 100644 meta-arm/recipes-security/optee/optee-os/0001-libutils-provide-empty-__getauxval-implementation.patch delete mode 100644 meta-arm/recipes-security/optee/optee-os/0002-link.mk-implement-support-for-libnames-after-libgcc-.patch delete mode 100644 meta-arm/recipes-security/optee/optee-os/0003-ta_dev_kit.mk-make-sure-that-libutils-is-linked-seco.patch delete mode 100644 meta-arm/recipes-security/optee/optee-os_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-os_3.14.0.bb delete mode 100644 meta-arm/recipes-security/optee/optee-test/0001-host-xtest-Adjust-order-of-including-compiler.h.patch delete mode 100644 meta-arm/recipes-security/optee/optee-test/0002-make-remove-Wno-unsafe-loop-for-clang.patch delete mode 100644 meta-arm/recipes-security/optee/optee-test/0003-make-remove-Wmissing-noreturn-for-clang.patch delete mode 100644 meta-arm/recipes-security/optee/optee-test_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-test_3.14.0.bbmeta-arm/recipes-security/optee/optee-client_3.11.0.bb deleted +0
-3@@ -1,3 +0,0 @@ -require optee-client.inc - -SRCREV = "c0c925384c1d7e3558d27d2708857482952d7907"meta-arm/recipes-security/optee/optee-client_3.14.0.bb new file +3
-0@@ -0,0 +1,3 @@ +require optee-client.inc + +SRCREV = "06e1b32f6a7028e039c625b07cfc25fda0c17d53"meta-arm/recipes-security/optee/optee-examples.inc +7
-2@@ -12,7 +12,8 @@ inherit python3native require optee.inc SRC_URI = "git://github.com/linaro-swg/optee_examples.git \ - file://0001-make-Pass-ldflags-during-link.patch \ + file://0001-plugins-Honour-default-cross-compiler-environment-se.patch \ + file://0002-Makefile-Enable-plugins-installation-in-rootfs.patch \ " EXTRA_OEMAKE += "TA_DEV_KIT_DIR=${TA_DEV_KIT_DIR} \@@ -32,11 +33,15 @@ do_compile[cleandirs] = "${B}" do_install () { mkdir -p ${D}${nonarch_base_libdir}/optee_armtz mkdir -p ${D}${bindir} + mkdir -p ${D}${libdir}/tee-supplicant/plugins install -D -p -m0755 ${B}/ca/* ${D}${bindir} install -D -p -m0444 ${B}/ta/* ${D}${nonarch_base_libdir}/optee_armtz + install -D -p -m0444 ${B}/plugins/* ${D}${libdir}/tee-supplicant/plugins } -FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/" +FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/ \ + ${libdir}/tee-supplicant/plugins/ \ + " # Imports machine specific configs from staging to build PACKAGE_ARCH = "${MACHINE_ARCH}"meta-arm/recipes-security/optee/optee-examples/0001-make-Pass-ldflags-during-link.patch deleted +0
-103@@ -1,103 +0,0 @@ -From 29ae21de41f2fbab6dbecbbf408826b28de82df1 Mon Sep 17 00:00:00 2001 -From: Khem Raj <[email protected]> -Date: Tue, 1 Sep 2020 21:09:56 -0700 -Subject: [PATCH] make: Pass ldflags during link - -OpenEmbeeded needs to pass essential linker flags to set correct flags -for gnu_hash among others which sets the linking straight -using LDFLAGS varible here means, we can affect the linker flags -from build environment - -Upstream-Status: Submitted [https://github.com/linaro-swg/optee_examples/pull/85] - -Signed-off-by: Khem Raj <[email protected]> ---- - acipher/host/Makefile | 2 +- - aes/host/Makefile | 2 +- - hello_world/host/Makefile | 2 +- - hotp/host/Makefile | 2 +- - random/host/Makefile | 2 +- - secure_storage/host/Makefile | 2 +- - 6 files changed, 6 insertions(+), 6 deletions(-) - -diff --git a/acipher/host/Makefile b/acipher/host/Makefile -index 8f4bc8a..c2cabef 100644 ---- a/acipher/host/Makefile -+++ b/acipher/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_acipher - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/aes/host/Makefile b/aes/host/Makefile -index dfeb4e8..f61c71b 100644 ---- a/aes/host/Makefile -+++ b/aes/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_aes - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/hello_world/host/Makefile b/hello_world/host/Makefile -index c4c8239..69cf42c 100644 ---- a/hello_world/host/Makefile -+++ b/hello_world/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_hello_world - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/hotp/host/Makefile b/hotp/host/Makefile -index cb7fd19..e7f013f 100644 ---- a/hotp/host/Makefile -+++ b/hotp/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_hotp - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/random/host/Makefile b/random/host/Makefile -index fd407d9..9377f7a 100644 ---- a/random/host/Makefile -+++ b/random/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_random - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/secure_storage/host/Makefile b/secure_storage/host/Makefile -index 29bfb87..b3265ae 100644 ---- a/secure_storage/host/Makefile -+++ b/secure_storage/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_secure_storage - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: --- -2.28.0 -meta-arm/recipes-security/optee/optee-examples/0001-plugins-Honour-default-cross-compiler-environment-se.patch new file +84
-0@@ -0,0 +1,84 @@ +From 79c826c249001700007a6dffe80c3d61ff4428ef Mon Sep 17 00:00:00 2001 +From: Sumit Garg <[email protected]> +Date: Tue, 20 Jul 2021 13:54:30 +0530 +Subject: [PATCH 1/2] plugins: Honour default cross compiler environment setup + +Honour default $(CC), $(CFLAGS) and $(LDFLAGS) variables. Without this +plugins example fails to build for OE/Yocto. + +Upstream-Status: Submitted [https://github.com/linaro-swg/optee_examples/pull/87] + +Signed-off-by: Sumit Garg <[email protected]> +--- + plugins/Makefile | 2 +- + plugins/host/Makefile | 2 +- + plugins/syslog/Makefile | 16 ++++++++++++---- + 3 files changed, 14 insertions(+), 6 deletions(-) + +diff --git a/plugins/Makefile b/plugins/Makefile +index 2372b38..ea472b4 100644 +--- a/plugins/Makefile ++++ b/plugins/Makefile +@@ -8,7 +8,7 @@ TA_CROSS_COMPILE ?= $(CROSS_COMPILE) + all: + $(MAKE) -C host CROSS_COMPILE="$(HOST_CROSS_COMPILE)" --no-builtin-variables + $(MAKE) -C ta CROSS_COMPILE="$(TA_CROSS_COMPILE)" LDFLAGS="" +- $(MAKE) -C syslog CROSS_COMPILE="$(HOST_CROSS_COMPILE)" ++ $(MAKE) -C syslog CROSS_COMPILE="$(HOST_CROSS_COMPILE)" --no-builtin-variables + + .PHONY: clean + clean: +diff --git a/plugins/host/Makefile b/plugins/host/Makefile +index 7285104..76244c7 100644 +--- a/plugins/host/Makefile ++++ b/plugins/host/Makefile +@@ -20,7 +20,7 @@ BINARY = optee_example_plugins + all: $(BINARY) + + $(BINARY): $(OBJS) +- $(CC) -o $@ $< $(LDADD) ++ $(CC) $(LDFLAGS) -o $@ $< $(LDADD) + + .PHONY: clean + clean: +diff --git a/plugins/syslog/Makefile b/plugins/syslog/Makefile +index 62d916a..71f5f92 100644 +--- a/plugins/syslog/Makefile ++++ b/plugins/syslog/Makefile +@@ -1,3 +1,11 @@ ++CC ?= $(CROSS_COMPILE)gcc ++LD ?= $(CROSS_COMPILE)ld ++AR ?= $(CROSS_COMPILE)ar ++NM ?= $(CROSS_COMPILE)nm ++OBJCOPY ?= $(CROSS_COMPILE)objcopy ++OBJDUMP ?= $(CROSS_COMPILE)objdump ++READELF ?= $(CROSS_COMPILE)readelf ++ + PLUGIN_UUID = 96bcf744-4f72-4866-bf1d-8634fd9c65e5 + + PLUGIN = $(PLUGIN_UUID).plugin +@@ -6,17 +14,17 @@ PLUGIN_OBJ = $(patsubst %.c, %.o, $(PLUGIN_SRS)) + PLUGIN_INCLUDES_DIR = $(CURDIR) $(TEEC_EXPORT)/include + + PLUGIN_INCLUDES = $(addprefix -I, $(PLUGIN_INCLUDES_DIR)) +-PLUGIN_CCFLAGS = -Wall -fPIC +-PLUGIN_LDFLAGS = -shared ++PLUGIN_CCFLAGS = $(CFLAGS) -Wall -fPIC ++PLUGIN_LDFLAGS = $(LDFLAGS) -shared + + .PHONY: all + all: $(PLUGIN) + + $(PLUGIN): $(PLUGIN_OBJ) +- $(CROSS_COMPILE)gcc $(PLUGIN_LDFLAGS) $(PLUGIN_OBJ) -o $@ ++ $(CC) $(PLUGIN_LDFLAGS) $(PLUGIN_OBJ) -o $@ + + %.o: %.c +- $(CROSS_COMPILE)gcc $(PLUGIN_CCFLAGS) $(PLUGIN_INCLUDES) -c $*.c -o $*.o ++ $(CC) $(PLUGIN_CCFLAGS) $(PLUGIN_INCLUDES) -c $*.c -o $*.o + + .PHONY: clean + clean: +-- +2.25.1 +meta-arm/recipes-security/optee/optee-examples/0002-Makefile-Enable-plugins-installation-in-rootfs.patch new file +39
-0@@ -0,0 +1,39 @@ +From a865f2e25e178fc2c4617eb1faf79ac922d02ffd Mon Sep 17 00:00:00 2001 +From: Sumit Garg <[email protected]> +Date: Tue, 20 Jul 2021 14:20:10 +0530 +Subject: [PATCH 2/2] Makefile: Enable plugins installation in rootfs + +Upstream-Status: Submitted [https://github.com/linaro-swg/optee_examples/pull/87] + +Signed-off-by: Sumit Garg <[email protected]> +--- + Makefile | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/Makefile b/Makefile +index a275842..b3f16aa 100644 +--- a/Makefile ++++ b/Makefile +@@ -25,14 +25,19 @@ prepare-for-rootfs: examples + @mkdir -p $(OUTPUT_DIR) + @mkdir -p $(OUTPUT_DIR)/ta + @mkdir -p $(OUTPUT_DIR)/ca ++ @mkdir -p $(OUTPUT_DIR)/plugins + @for example in $(EXAMPLE_LIST); do \ + if [ -e $$example/host/optee_example_$$example ]; then \ + cp -p $$example/host/optee_example_$$example $(OUTPUT_DIR)/ca/; \ + fi; \ + cp -pr $$example/ta/*.ta $(OUTPUT_DIR)/ta/; \ ++ if [ $$example == plugins ]; then \ ++ cp -p plugins/syslog/*.plugin $(OUTPUT_DIR)/plugins/; \ ++ fi; \ + done + + prepare-for-rootfs-clean: + @rm -rf $(OUTPUT_DIR)/ta + @rm -rf $(OUTPUT_DIR)/ca ++ @rm -rf $(OUTPUT_DIR)/plugins + @rmdir --ignore-fail-on-non-empty $(OUTPUT_DIR) || test ! -e $(OUTPUT_DIR) +-- +2.25.1 +meta-arm/recipes-security/optee/optee-examples_3.11.0.bb deleted +0
-4@@ -1,4 +0,0 @@ -require optee-examples.inc - -SRCREV = "9a7dc598591990349d88b4dba3a37aadd6851295" -meta-arm/recipes-security/optee/optee-examples_3.14.0.bb new file +4
-0@@ -0,0 +1,4 @@ +require optee-examples.inc + +SRCREV = "e9c870525af8f7e7fccf575a0ca5394ce55adcec" +meta-arm/recipes-security/optee/optee-os/0001-libutils-provide-empty-__getauxval-implementation.patch deleted +0
-62@@ -1,62 +0,0 @@ -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 deleted +0
-55@@ -1,55 +0,0 @@ -Upstream-Status: Backport -Signed-off-by: Ross Burton <[email protected]> - -From 73196b58ea6978ffa5e581738030f51c5789ef73 Mon Sep 17 00:00:00 2001 -From: Volodymyr Babchuk <[email protected]> -Date: Tue, 13 Oct 2020 22:54:13 +0300 -Subject: [PATCH 2/3] link.mk: implement support for libnames-after-libgcc - variable - -Newer versions of libgcc depend on external __getauxval() symbol, which is -now provided by libutils. But libgcc is linked after libutils, so linker -can't resolve that symbol. We can't include libgcc into linking group with -libtutils, because libgcc provides symbols that conflict with libutil's -ones, like __aeabi_idiv with friends for instance. - -So, to resolve libgcc dependency on libutils we need to link with libutils -second time. To make things more generic, we will introduce -$(libnames-after-libgcc) variable for libraries that should be linked after -libgcc. - -Signed-off-by: Volodymyr Babchuk <[email protected]> -Reviewed-by: Jens Wiklander <[email protected]> -Reviewed-by: Jerome Forissier <[email protected]> ---- - ta/arch/arm/link.mk | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/ta/arch/arm/link.mk b/ta/arch/arm/link.mk -index 445c285d..3025acb1 100644 ---- a/ta/arch/arm/link.mk -+++ b/ta/arch/arm/link.mk -@@ -55,8 +55,11 @@ link-ldflags += --eh-frame-hdr - link-ldadd += $(libstdc++$(sm)) $(libgcc_eh$(sm)) - endif - link-ldadd += --end-group --ldargs-$(user-ta-uuid).elf := $(link-ldflags) $(objs) $(link-ldadd) $(libgcc$(sm)) - -+link-ldadd-after-libgcc += $(addprefix -l,$(libnames-after-libgcc)) -+ -+ldargs-$(user-ta-uuid).elf := $(link-ldflags) $(objs) $(link-ldadd) \ -+ $(libgcc$(sm)) $(link-ldadd-after-libgcc) - - link-script-cppflags-$(sm) := \ - $(filter-out $(CPPFLAGS_REMOVE) $(cppflags-remove), \ -@@ -76,6 +79,7 @@ $(link-script-pp$(sm)): $(link-script$(sm)) $(conf-file) $(link-script-pp-makefi - $(link-script-cppflags-$(sm)) $$< -o $$@ - - $(link-out-dir$(sm))/$(user-ta-uuid).elf: $(objs) $(libdeps) \ -+ $(libdeps-after-libgcc) \ - $(link-script-pp$(sm)) \ - $(dynlistdep) \ - $(additional-link-deps) --- -2.25.1 -meta-arm/recipes-security/optee/optee-os/0003-ta_dev_kit.mk-make-sure-that-libutils-is-linked-seco.patch deleted +0
-44@@ -1,44 +0,0 @@ -Upstream-Status: Backport -Signed-off-by: Ross Burton <[email protected]> - -From f50962e3f56f0932662b2ffa10afe53339a335dd Mon Sep 17 00:00:00 2001 -From: Volodymyr Babchuk <[email protected]> -Date: Fri, 16 Oct 2020 16:36:08 +0300 -Subject: [PATCH 3/3] ta_dev_kit.mk: make sure that libutils is linked second - time - -libgcc depends on __getauxval symbol from libuils. As, generally libutils -is linked before libgcc, we will get "unresolved symbol" error. To resolve -this dependency we need to link libutils second time - after libgcc. - -Signed-off-by: Volodymyr Babchuk <[email protected]> -Reviewed-by: Jens Wiklander <[email protected]> -Reviewed-by: Jerome Forissier <[email protected]> ---- - ta/mk/ta_dev_kit.mk | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/ta/mk/ta_dev_kit.mk b/ta/mk/ta_dev_kit.mk -index e28be677..d0e66317 100644 ---- a/ta/mk/ta_dev_kit.mk -+++ b/ta/mk/ta_dev_kit.mk -@@ -78,6 +78,16 @@ endif - libnames += dl - libdeps += $(ta-dev-kit-dir$(sm))/lib/libdl.a - -+# libutils provides __getauxval symbol which is needed by libgcc 10.x. We can't -+# link libutils after libgcc, because libgcc will replace some symbols provided -+# by libutils, which will cause further linking issues. -+# -+# But if we place libutils before libgcc, linker will not be able to resolve -+# __getauxval. So we need to link with libutils twice: before and after libgcc. -+# Hence it included both in $(libnames) and in $(libnames-after-libgcc) -+libnames-after-libgcc += utils -+libdeps-after-libgcc += $(ta-dev-kit-dir$(sm))/lib/libutils.a -+ - # Pass config variable (CFG_) from conf.mk on the command line - cppflags$(sm) += $(strip \ - $(foreach var, $(filter CFG_%,$(.VARIABLES)), \ --- -2.25.1 -meta-arm/recipes-security/optee/optee-os_3.11.0.bb deleted +0
-11@@ -1,11 +0,0 @@ -require optee-os.inc - -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 \ -"meta-arm/recipes-security/optee/optee-os_3.14.0.bb new file +8
-0@@ -0,0 +1,8 @@ +require optee-os.inc + +SRCREV = "d21befa5e53eae9db469eba1685f5aa5c6f92c2f" + +SRC_URI_append = " \ + file://0006-allow-setting-sysroot-for-libgcc-lookup.patch \ + file://0007-allow-setting-sysroot-for-clang.patch \ +"meta-arm/recipes-security/optee/optee-test.inc +6
-9@@ -8,17 +8,9 @@ LIC_FILES_CHKSUM = "file://${S}/LICENSE.md;md5=daa2bcccc666345ab8940aab1315a4fa" inherit python3native ptest require optee.inc -# Linking fails on musl due to C++/threads -# https://github.com/OP-TEE/optee_test/issues/458#issuecomment-720540834 -# When upgraded we should be able to remove this limitation -COMPATIBLE_HOST_libc-musl = 'null' - DEPENDS = "optee-client optee-os python3-pycryptodome-native" SRC_URI = "git://github.com/OP-TEE/optee_test.git \ - file://0001-host-xtest-Adjust-order-of-including-compiler.h.patch \ - file://0002-make-remove-Wno-unsafe-loop-for-clang.patch \ - file://0003-make-remove-Wmissing-noreturn-for-clang.patch \ file://run-ptest \ "@@ -36,6 +28,7 @@ do_compile() { # Top level makefile doesn't seem to handle parallel make gracefully oe_runmake xtest oe_runmake ta + oe_runmake test_plugin } do_compile[cleandirs] = "${B}"@@ -46,9 +39,13 @@ do_install () { # default TEEC_LOAD_PATH is /lib mkdir -p ${D}${nonarch_base_libdir}/optee_armtz/ install -D -p -m0444 ${B}/ta/*/*.ta ${D}${nonarch_base_libdir}/optee_armtz/ + mkdir -p ${D}${libdir}/tee-supplicant/plugins + install -D -p -m0444 ${B}/supp_plugin/*.plugin ${D}${libdir}/tee-supplicant/plugins/ } -FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/" +FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/ \ + ${libdir}/tee-supplicant/plugins/ \ + " # Imports machine specific configs from staging to build PACKAGE_ARCH = "${MACHINE_ARCH}"meta-arm/recipes-security/optee/optee-test/0001-host-xtest-Adjust-order-of-including-compiler.h.patch deleted +0
-64@@ -1,64 +0,0 @@ -From fc95b3ccbbfd336797ae2cfd6dd4dc58644e146f Mon Sep 17 00:00:00 2001 -From: Khem Raj <[email protected]> -Date: Sat, 30 May 2020 17:52:18 -0700 -Subject: [PATCH] host/xtest: Adjust order of including compiler.h - -compiler.h defines some defines which violate libc namespace e.g. -__unused, this works ok with glibc but fails in awkward ways with musl -the reason is musl uses __unused in its internal structures and this -define in compiler.h conflicts with system headers causing errors like - -recipe-sysroot/usr/include/bits/stat.h:17:19: error: expected identifier or '(' before '[' token unsigned __unused[2]; - ^ -including compiler.h afer sys/stat.h fixes the problem. - -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 +- - host/xtest/stats.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/host/xtest/install_ta.c b/host/xtest/install_ta.c -index 09a4c6d..6f7bb5c 100644 ---- a/host/xtest/install_ta.c -+++ b/host/xtest/install_ta.c -@@ -4,7 +4,6 @@ - * SPDX-License-Identifier: BSD-2-Clause - */ - --#include <compiler.h> - #include <dirent.h> - #include <err.h> - #include <errno.h> -@@ -20,6 +19,7 @@ - #include <sys/types.h> - #include <tee_client_api.h> - #include <unistd.h> -+#include <compiler.h> - - #include "install_ta.h" - #include "xtest_helpers.h" -diff --git a/host/xtest/stats.c b/host/xtest/stats.c -index 96b0b5f..db9bf25 100644 ---- a/host/xtest/stats.c -+++ b/host/xtest/stats.c -@@ -3,7 +3,6 @@ - * Copyright (c) 2019, Linaro Limited - */ - --#include <compiler.h> - #include <dirent.h> - #include <err.h> - #include <errno.h> -@@ -18,6 +17,7 @@ - #include <sys/types.h> - #include <tee_client_api.h> - #include <unistd.h> -+#include <compiler.h> - #include "xtest_test.h" - #include "stats.h" - --- -2.26.2 -meta-arm/recipes-security/optee/optee-test/0002-make-remove-Wno-unsafe-loop-for-clang.patch deleted +0
-31@@ -1,31 +0,0 @@ -From 438533ce9da1df0b7c7914e64b39ffdc1da1ab79 Mon Sep 17 00:00:00 2001 -From: Brett Warren <[email protected]> -Date: Thu, 8 Oct 2020 10:03:25 +0100 -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 [https://github.com/OP-TEE/optee_test/issues/452] -Changed-Id: 71cb511904547d790d1ea98f93bf8e5a6afcb36d -Signed-off-by: Brett Warren <[email protected]> ---- - host/xtest/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/host/xtest/Makefile b/host/xtest/Makefile -index 3c206b0..96746de 100644 ---- a/host/xtest/Makefile -+++ b/host/xtest/Makefile -@@ -169,7 +169,7 @@ CFLAGS += -Wall -Wcast-align -Werror \ - -Werror-implicit-function-declaration -Wextra -Wfloat-equal \ - -Wformat-nonliteral -Wformat-security -Wformat=2 -Winit-self \ - -Wmissing-declarations -Wmissing-format-attribute \ -- -Wmissing-include-dirs -Wmissing-noreturn \ -+ -Wmissing-include-dirs \ - -Wmissing-prototypes -Wnested-externs -Wpointer-arith \ - -Wshadow -Wstrict-prototypes -Wswitch-default \ - -Wwrite-strings \ --- -2.17.1 -meta-arm/recipes-security/optee/optee-test/0003-make-remove-Wmissing-noreturn-for-clang.patch deleted +0
-31@@ -1,31 +0,0 @@ -From ed5a9d9f7a3e9e14ca0e8aea59008124ee0e5f96 Mon Sep 17 00:00:00 2001 -From: Brett Warren <[email protected]> -Date: Thu, 8 Oct 2020 10:20:52 +0100 -Subject: [PATCH] make: remove -Wno-unsafe-loop for clang - -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 [https://github.com/OP-TEE/optee_test/issues/452] -Change-Id: 5fe0892c73208aaffac8c9995cb3275936fb1ba6 -Signed-off-by: Brett Warren <[email protected]> ---- - host/xtest/Makefile | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/host/xtest/Makefile b/host/xtest/Makefile -index 96746de..73731d0 100644 ---- a/host/xtest/Makefile -+++ b/host/xtest/Makefile -@@ -174,7 +174,6 @@ CFLAGS += -Wall -Wcast-align -Werror \ - -Wshadow -Wstrict-prototypes -Wswitch-default \ - -Wwrite-strings \ - -Wno-declaration-after-statement \ -- -Wno-unsafe-loop-optimizations \ - -Wno-missing-field-initializers -Wno-format-zero-length - endif - --- -2.17.1 -meta-arm/recipes-security/optee/optee-test_3.11.0.bb deleted +0
-3@@ -1,3 +0,0 @@ -require optee-test.inc - -SRCREV = "159e295d5cc3ad2275ab15fe544620f6604d4ba4"meta-arm/recipes-security/optee/optee-test_3.14.0.bb new file +3
-1@@ -0,0 +1,3 @@ +require optee-test.inc + +SRCREV = "f2eb88affbb7f028561b4fd5cbd049d5d704f741" --2.25.1
Hi Sumit,
Thanks for the arm/optee upgrade to 3.14.0. I have used that base recipes and upgraded optee to 3.14.0 for TC0 platform and it works fine. The patches for TC0 OP-TEE upgrade are in internal review.
Jon / Ross,
Post internal review, I will send out the patches to mailing list, can you please merge arm/optee upgrade and TC0 OP-TEE upgrade together.
Thanks,
Arun
-----Original Message-----
From: Sumit Garg <[email protected]>
Sent: Thursday, July 22, 2021 09:00
To: Jon Mason <[email protected]>
Cc: [email protected] <[email protected]>; Jon Mason <[email protected]>; Ross Burton <[email protected]>; Arunachalam Ganapathy <[email protected]>
Subject: Re: [meta-arm] [PATCH] arm/optee: version uplift 3.11.0 -> 3.14.0
+ TC0 platform maintainer in OP-TEE
Hi Jon,
Quoted 7 lines · Jon Mason
Quoted 5 lines · Sumit Garg
Brief description of changes:
- Version uplift 3.11.0 -> 3.14.0.
- Removed OP-TEE patches that has already been accepted upstream.
- Added support for tee-supplicant plugin framework testing.
Quoted 7 lines
Quoted 3 lines
Tested on
qemuarm64_secureboot:$ xtest -l 15 $ optee-examples_*Unfortunately, TC0 is using the 3.11 version. So, it breaks when applying this patch.
The TC0 platform support was recently merged in OP-TEE upstream [1]. So I took the liberty to migrate corresponding recipes as well [2] which is build tested only as I don't possess access to the platform itself.
[1] https://github.com/OP-TEE/optee_os/pull/4736
[2] https://lists.yoctoproject.org/g/meta-arm/message/2091
Quoted 3 lines
Can you rework this patch to keep the old
version around?
With TC0 support for 3.14.0, I think we should be able to drop support for the old version.
-Sumit
Quoted 782 lines
Thanks,
JonQuoted 778 lines
Signed-off-by Sumit Garg <[email protected]>---
.../optee/optee-client_3.11.0.bb | 3 - .../optee/optee-client_3.14.0.bb | 3 + .../recipes-security/optee/optee-examples.inc | 9 +- .../0001-make-Pass-ldflags-during-link.patch | 103 ------------------ ...efault-cross-compiler-environment-se.patch | 84 ++++++++++++++ ...nable-plugins-installation-in-rootfs.patch | 39 +++++++ .../optee/optee-examples_3.11.0.bb | 4 - .../optee/optee-examples_3.14.0.bb | 4 +...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 | 11 -- .../recipes-security/optee/optee-os_3.14.0.bb | 8 ++ .../recipes-security/optee/optee-test.inc | 15 +-- ...Adjust-order-of-including-compiler.h.patch | 64 ----------- ...ake-remove-Wno-unsafe-loop-for-clang.patch | 31 ------ ...e-remove-Wmissing-noreturn-for-clang.patch | 31 ------ .../optee/optee-test_3.11.0.bb | 3 - .../optee/optee-test_3.14.0.bb | 3 + 19 files changed, 154 insertions(+), 422 deletions(-)delete mode 100644 meta-arm/recipes-security/optee/optee-client_3.11.0.bb
create mode 100644 meta-arm/recipes-security/optee/optee-client_3.14.0.bb
delete mode 100644meta-arm/recipes-security/optee/optee-examples/0001-make-Pass-ldflags-during-link.patchcreate mode 100644meta-arm/recipes-security/optee/optee-examples/0001-plugins-Honour-default-cross-compiler-environment-se.patchcreate mode 100644meta-arm/recipes-security/optee/optee-examples/0002-Makefile-Enable-plugins-installation-in-rootfs.patchdelete mode 100644 meta-arm/recipes-security/optee/optee-examples_3.11.0.bb
create mode 100644 meta-arm/recipes-security/optee/optee-examples_3.14.0.bb
delete mode 100644meta-arm/recipes-security/optee/optee-os/0001-libutils-provide-empty-__getauxval-implementation.patchdelete mode 100644meta-arm/recipes-security/optee/optee-os/0002-link.mk-implement-support-for-libnames-after-libgcc-.patchdelete mode 100644meta-arm/recipes-security/optee/optee-os/0003-ta_dev_kit.mk-make-sure-that-libutils-is-linked-seco.patchdelete mode 100644 meta-arm/recipes-security/optee/optee-os_3.11.0.bb
create mode 100644 meta-arm/recipes-security/optee/optee-os_3.14.0.bb
delete mode 100644meta-arm/recipes-security/optee/optee-test/0001-host-xtest-Adjust-order-of-including-compiler.h.patchdelete mode 100644meta-arm/recipes-security/optee/optee-test/0002-make-remove-Wno-unsafe-loop-for-clang.patchdelete mode 100644meta-arm/recipes-security/optee/optee-test/0003-make-remove-Wmissing-noreturn-for-clang.patchdelete mode 100644 meta-arm/recipes-security/optee/optee-test_3.11.0.bb
create mode 100644 meta-arm/recipes-security/optee/optee-test_3.14.0.bbmeta-arm/recipes-security/optee/optee-client_3.11.0.bb deleted +0
-3@@ -1,3 +0,0 @@ -require optee-client.inc - -SRCREV = "c0c925384c1d7e3558d27d2708857482952d7907"meta-arm/recipes-security/optee/optee-client_3.14.0.bb new file +3
-0@@ -0,0 +1,3 @@ +require optee-client.inc + +SRCREV = "06e1b32f6a7028e039c625b07cfc25fda0c17d53"meta-arm/recipes-security/optee/optee-examples.inc +0
-0@@ -12,7 +12,8 @@ inherit python3nativerequire optee.inc
SRC_URI= "git://github.com/linaro-swg/optee_examples.git\
- file://0001-make-Pass-ldflags-during-link.patch \
+ file://0001-plugins-Honour-default-cross-compiler-environment-se.patch \
+ file://0002-Makefile-Enable-plugins-installation-in-rootfs.patch \
"
EXTRA_OEMAKE+= "TA_DEV_KIT_DIR=${TA_DEV_KIT_DIR} \meta-arm/recipes-security/optee/optee-examples.inc +0
-0@@ -32,11 +33,15 @@ do_compile[cleandirs] = "${B}" do_install () {mkdir -p ${D}${nonarch_base_libdir}/optee_armtz
mkdir -p ${D}${bindir}
+ mkdir -p ${D}${libdir}/tee-supplicant/plugins
install -D -p -m0755 ${B}/ca/* ${D}${bindir}
install -D -p -m0444 ${B}/ta/* ${D}${nonarch_base_libdir}/optee_armtz + install -D -p -m0444 ${B}/plugins/* ${D}${libdir}/tee-supplicant/plugins }meta-arm/recipes-security/optee/optee-examples.inc +3
-1-FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/" +FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/ \ + ${libdir}/tee-supplicant/plugins/ \ + "# Imports machine specific configs from staging to build
PACKAGE_ARCH= "${MACHINE_ARCH}"meta-arm/recipes-security/optee/optee-examples/0001-make-Pass-ldflags-during-link.patch deleted +0
-103@@ -1,103 +0,0 @@ -From 29ae21de41f2fbab6dbecbbf408826b28de82df1 Mon Sep 17 00:00:00 2001 -From: Khem Raj <[email protected]> -Date: Tue, 1 Sep 2020 21:09:56 -0700 -Subject: [PATCH] make: Pass ldflags during link - -OpenEmbeeded needs to pass essential linker flags to set correct flags -for gnu_hash among others which sets the linking straight -using LDFLAGS varible here means, we can affect the linker flags -from build environment - -Upstream-Status: Submitted [https://github.com/linaro-swg/optee_examples/pull/85] - -Signed-off-by: Khem Raj <[email protected]> ---- - acipher/host/Makefile | 2 +- - aes/host/Makefile | 2 +- - hello_world/host/Makefile | 2 +- - hotp/host/Makefile | 2 +- - random/host/Makefile | 2 +- - secure_storage/host/Makefile | 2 +- - 6 files changed, 6 insertions(+), 6 deletions(-) - -diff --git a/acipher/host/Makefile b/acipher/host/Makefile -index 8f4bc8a..c2cabef 100644 ---- a/acipher/host/Makefile -+++ b/acipher/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_acipher - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/aes/host/Makefile b/aes/host/Makefile -index dfeb4e8..f61c71b 100644 ---- a/aes/host/Makefile -+++ b/aes/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_aes - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/hello_world/host/Makefile b/hello_world/host/Makefile -index c4c8239..69cf42c 100644 ---- a/hello_world/host/Makefile -+++ b/hello_world/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_hello_world - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/hotp/host/Makefile b/hotp/host/Makefile -index cb7fd19..e7f013f 100644 ---- a/hotp/host/Makefile -+++ b/hotp/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_hotp - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/random/host/Makefile b/random/host/Makefile -index fd407d9..9377f7a 100644 ---- a/random/host/Makefile -+++ b/random/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_random - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/secure_storage/host/Makefile b/secure_storage/host/Makefile -index 29bfb87..b3265ae 100644 ---- a/secure_storage/host/Makefile -+++ b/secure_storage/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_secure_storage - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: --- -2.28.0 -meta-arm/recipes-security/optee/optee-examples/0001-plugins-Honour-default-cross-compiler-environment-se.patch new file +84
-0@@ -0,0 +1,84 @@ +From 79c826c249001700007a6dffe80c3d61ff4428ef Mon Sep 17 00:00:00 2001 +From: Sumit Garg <[email protected]> +Date: Tue, 20 Jul 2021 13:54:30 +0530 +Subject: [PATCH 1/2] plugins: Honour default cross compiler environment setup + +Honour default $(CC), $(CFLAGS) and $(LDFLAGS) variables. Without this +plugins example fails to build for OE/Yocto. + +Upstream-Status: Submitted [https://github.com/linaro-swg/optee_examples/pull/87] + +Signed-off-by: Sumit Garg <[email protected]> +--- + plugins/Makefile | 2 +- + plugins/host/Makefile | 2 +- + plugins/syslog/Makefile | 16 ++++++++++++---- + 3 files changed, 14 insertions(+), 6 deletions(-) + +diff --git a/plugins/Makefile b/plugins/Makefile +index 2372b38..ea472b4 100644 +--- a/plugins/Makefile ++++ b/plugins/Makefile +@@ -8,7 +8,7 @@ TA_CROSS_COMPILE ?= $(CROSS_COMPILE) + all: + $(MAKE) -C host CROSS_COMPILE="$(HOST_CROSS_COMPILE)" --no-builtin-variables + $(MAKE) -C ta CROSS_COMPILE="$(TA_CROSS_COMPILE)" LDFLAGS="" +- $(MAKE) -C syslog CROSS_COMPILE="$(HOST_CROSS_COMPILE)" ++ $(MAKE) -C syslog CROSS_COMPILE="$(HOST_CROSS_COMPILE)" --no-builtin-variables + + .PHONY: clean + clean: +diff --git a/plugins/host/Makefile b/plugins/host/Makefile +index 7285104..76244c7 100644 +--- a/plugins/host/Makefile ++++ b/plugins/host/Makefile +@@ -20,7 +20,7 @@ BINARY = optee_example_plugins + all: $(BINARY) + + $(BINARY): $(OBJS) +- $(CC) -o $@ $< $(LDADD) ++ $(CC) $(LDFLAGS) -o $@ $< $(LDADD) + + .PHONY: clean + clean: +diff --git a/plugins/syslog/Makefile b/plugins/syslog/Makefile +index 62d916a..71f5f92 100644 +--- a/plugins/syslog/Makefile ++++ b/plugins/syslog/Makefile +@@ -1,3 +1,11 @@ ++CC ?= $(CROSS_COMPILE)gcc ++LD ?= $(CROSS_COMPILE)ld ++AR ?= $(CROSS_COMPILE)ar ++NM ?= $(CROSS_COMPILE)nm ++OBJCOPY ?= $(CROSS_COMPILE)objcopy ++OBJDUMP ?= $(CROSS_COMPILE)objdump ++READELF ?= $(CROSS_COMPILE)readelf ++ + PLUGIN_UUID = 96bcf744-4f72-4866-bf1d-8634fd9c65e5 + + PLUGIN = $(PLUGIN_UUID).plugin +@@ -6,17 +14,17 @@ PLUGIN_OBJ = $(patsubst %.c, %.o, $(PLUGIN_SRS)) + PLUGIN_INCLUDES_DIR = $(CURDIR) $(TEEC_EXPORT)/include + + PLUGIN_INCLUDES = $(addprefix -I, $(PLUGIN_INCLUDES_DIR)) +-PLUGIN_CCFLAGS = -Wall -fPIC +-PLUGIN_LDFLAGS = -shared ++PLUGIN_CCFLAGS = $(CFLAGS) -Wall -fPIC ++PLUGIN_LDFLAGS = $(LDFLAGS) -shared + + .PHONY: all + all: $(PLUGIN) + + $(PLUGIN): $(PLUGIN_OBJ) +- $(CROSS_COMPILE)gcc $(PLUGIN_LDFLAGS) $(PLUGIN_OBJ) -o $@ ++ $(CC) $(PLUGIN_LDFLAGS) $(PLUGIN_OBJ) -o $@ + + %.o: %.c +- $(CROSS_COMPILE)gcc $(PLUGIN_CCFLAGS) $(PLUGIN_INCLUDES) -c $*.c -o $*.o ++ $(CC) $(PLUGIN_CCFLAGS) $(PLUGIN_INCLUDES) -c $*.c -o $*.o + + .PHONY: clean + clean: +-- +2.25.1 +meta-arm/recipes-security/optee/optee-examples/0002-Makefile-Enable-plugins-installation-in-rootfs.patch new file +39
-0@@ -0,0 +1,39 @@ +From a865f2e25e178fc2c4617eb1faf79ac922d02ffd Mon Sep 17 00:00:00 2001 +From: Sumit Garg <[email protected]> +Date: Tue, 20 Jul 2021 14:20:10 +0530 +Subject: [PATCH 2/2] Makefile: Enable plugins installation in rootfs + +Upstream-Status: Submitted [https://github.com/linaro-swg/optee_examples/pull/87] + +Signed-off-by: Sumit Garg <[email protected]> +--- + Makefile | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/Makefile b/Makefile +index a275842..b3f16aa 100644 +--- a/Makefile ++++ b/Makefile +@@ -25,14 +25,19 @@ prepare-for-rootfs: examples + @mkdir -p $(OUTPUT_DIR) + @mkdir -p $(OUTPUT_DIR)/ta + @mkdir -p $(OUTPUT_DIR)/ca ++ @mkdir -p $(OUTPUT_DIR)/plugins + @for example in $(EXAMPLE_LIST); do \ + if [ -e $$example/host/optee_example_$$example ]; then \ + cp -p $$example/host/optee_example_$$example $(OUTPUT_DIR)/ca/; \ + fi; \ + cp -pr $$example/ta/*.ta $(OUTPUT_DIR)/ta/; \ ++ if [ $$example == plugins ]; then \ ++ cp -p plugins/syslog/*.plugin $(OUTPUT_DIR)/plugins/; \ ++ fi; \ + done + + prepare-for-rootfs-clean: + @rm -rf $(OUTPUT_DIR)/ta + @rm -rf $(OUTPUT_DIR)/ca ++ @rm -rf $(OUTPUT_DIR)/plugins + @rmdir --ignore-fail-on-non-empty $(OUTPUT_DIR) || test ! -e $(OUTPUT_DIR) +-- +2.25.1 +meta-arm/recipes-security/optee/optee-examples_3.11.0.bb deleted +0
-4@@ -1,4 +0,0 @@ -require optee-examples.inc - -SRCREV = "9a7dc598591990349d88b4dba3a37aadd6851295" -meta-arm/recipes-security/optee/optee-examples_3.14.0.bb new file +4
-0@@ -0,0 +1,4 @@ +require optee-examples.inc + +SRCREV = "e9c870525af8f7e7fccf575a0ca5394ce55adcec" +meta-arm/recipes-security/optee/optee-os/0001-libutils-provide-empty-__getauxval-implementation.patch deleted +0
-62@@ -1,62 +0,0 @@ -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 deleted +0
-55@@ -1,55 +0,0 @@ -Upstream-Status: Backport -Signed-off-by: Ross Burton <[email protected]> - -From 73196b58ea6978ffa5e581738030f51c5789ef73 Mon Sep 17 00:00:00 2001 -From: Volodymyr Babchuk <[email protected]> -Date: Tue, 13 Oct 2020 22:54:13 +0300 -Subject: [PATCH 2/3] link.mk: implement support for libnames-after-libgcc - variable - -Newer versions of libgcc depend on external __getauxval() symbol, which is -now provided by libutils. But libgcc is linked after libutils, so linker -can't resolve that symbol. We can't include libgcc into linking group with -libtutils, because libgcc provides symbols that conflict with libutil's -ones, like __aeabi_idiv with friends for instance. - -So, to resolve libgcc dependency on libutils we need to link with libutils -second time. To make things more generic, we will introduce -$(libnames-after-libgcc) variable for libraries that should be linked after -libgcc. - -Signed-off-by: Volodymyr Babchuk <[email protected]> -Reviewed-by: Jens Wiklander <[email protected]> -Reviewed-by: Jerome Forissier <[email protected]> ---- - ta/arch/arm/link.mk | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/ta/arch/arm/link.mk b/ta/arch/arm/link.mk -index 445c285d..3025acb1 100644 ---- a/ta/arch/arm/link.mk -+++ b/ta/arch/arm/link.mk -@@ -55,8 +55,11 @@ link-ldflags += --eh-frame-hdr - link-ldadd += $(libstdc++$(sm)) $(libgcc_eh$(sm)) - endif - link-ldadd += --end-group --ldargs-$(user-ta-uuid).elf := $(link-ldflags) $(objs) $(link-ldadd) $(libgcc$(sm)) - -+link-ldadd-after-libgcc += $(addprefix -l,$(libnames-after-libgcc)) -+ -+ldargs-$(user-ta-uuid).elf := $(link-ldflags) $(objs) $(link-ldadd) \ -+ $(libgcc$(sm)) $(link-ldadd-after-libgcc) - - link-script-cppflags-$(sm) := \ - $(filter-out $(CPPFLAGS_REMOVE) $(cppflags-remove), \ -@@ -76,6 +79,7 @@ $(link-script-pp$(sm)): $(link-script$(sm)) $(conf-file) $(link-script-pp-makefi - $(link-script-cppflags-$(sm)) $$< -o $$@ - - $(link-out-dir$(sm))/$(user-ta-uuid).elf: $(objs) $(libdeps) \ -+ $(libdeps-after-libgcc) \ - $(link-script-pp$(sm)) \ - $(dynlistdep) \ - $(additional-link-deps) --- -2.25.1 -meta-arm/recipes-security/optee/optee-os/0003-ta_dev_kit.mk-make-sure-that-libutils-is-linked-seco.patch deleted +0
-44@@ -1,44 +0,0 @@ -Upstream-Status: Backport -Signed-off-by: Ross Burton <[email protected]> - -From f50962e3f56f0932662b2ffa10afe53339a335dd Mon Sep 17 00:00:00 2001 -From: Volodymyr Babchuk <[email protected]> -Date: Fri, 16 Oct 2020 16:36:08 +0300 -Subject: [PATCH 3/3] ta_dev_kit.mk: make sure that libutils is linked second - time - -libgcc depends on __getauxval symbol from libuils. As, generally libutils -is linked before libgcc, we will get "unresolved symbol" error. To resolve -this dependency we need to link libutils second time - after libgcc. - -Signed-off-by: Volodymyr Babchuk <[email protected]> -Reviewed-by: Jens Wiklander <[email protected]> -Reviewed-by: Jerome Forissier <[email protected]> ---- - ta/mk/ta_dev_kit.mk | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/ta/mk/ta_dev_kit.mk b/ta/mk/ta_dev_kit.mk -index e28be677..d0e66317 100644 ---- a/ta/mk/ta_dev_kit.mk -+++ b/ta/mk/ta_dev_kit.mk -@@ -78,6 +78,16 @@ endif - libnames += dl - libdeps += $(ta-dev-kit-dir$(sm))/lib/libdl.a - -+# libutils provides __getauxval symbol which is needed by libgcc 10.x. We can't -+# link libutils after libgcc, because libgcc will replace some symbols provided -+# by libutils, which will cause further linking issues. -+# -+# But if we place libutils before libgcc, linker will not be able to resolve -+# __getauxval. So we need to link with libutils twice: before and after libgcc. -+# Hence it included both in $(libnames) and in $(libnames-after-libgcc) -+libnames-after-libgcc += utils -+libdeps-after-libgcc += $(ta-dev-kit-dir$(sm))/lib/libutils.a -+ - # Pass config variable (CFG_) from conf.mk on the command line - cppflags$(sm) += $(strip \ - $(foreach var, $(filter CFG_%,$(.VARIABLES)), \ --- -2.25.1 -meta-arm/recipes-security/optee/optee-os_3.11.0.bb deleted +0
-11@@ -1,11 +0,0 @@ -require optee-os.inc - -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 \ -"meta-arm/recipes-security/optee/optee-os_3.14.0.bb new file +8
-0@@ -0,0 +1,8 @@ +require optee-os.inc + +SRCREV = "d21befa5e53eae9db469eba1685f5aa5c6f92c2f" + +SRC_URI_append = " \ + file://0006-allow-setting-sysroot-for-libgcc-lookup.patch \ + file://0007-allow-setting-sysroot-for-clang.patch \ +"meta-arm/recipes-security/optee/optee-test.inc +0
-0@@ -8,17 +8,9 @@ LIC_FILES_CHKSUM = "file://${S}/LICENSE.md;md5=daa2bcccc666345ab8940aab1315a4fa"inherit python3native ptest
require optee.incmeta-arm/recipes-security/optee/optee-test.inc +0
-5-# Linking fails on musl due to C++/threads -# https://github.com/OP-TEE/optee_test/issues/458#issuecomment-720540834 -# When upgraded we should be able to remove this limitation -COMPATIBLE_HOST_libc-musl = 'null' -DEPENDS = "optee-client optee-os python3-pycryptodome-native"
SRC_URI= "git://github.com/OP-TEE/optee_test.git\
- file://0001-host-xtest-Adjust-order-of-including-compiler.h.patch \
- file://0002-make-remove-Wno-unsafe-loop-for-clang.patch \
- file://0003-make-remove-Wmissing-noreturn-for-clang.patch \
file://run-ptest \
"meta-arm/recipes-security/optee/optee-test.inc +0
-0@@ -36,6 +28,7 @@ do_compile() { # Top level makefile doesn't seem to handle parallel make gracefully
oe_runmakextest
oe_runmaketa
+oe_runmaketest_plugin
}
do_compile[cleandirs] = "${B}"meta-arm/recipes-security/optee/optee-test.inc +0
-0@@ -46,9 +39,13 @@ do_install () { # default TEEC_LOAD_PATH is /libmkdir -p ${D}${nonarch_base_libdir}/optee_armtz/
install -D -p -m0444 ${B}/ta/*/*.ta ${D}${nonarch_base_libdir}/optee_armtz/ + mkdir -p ${D}${libdir}/tee-supplicant/plugins
+ install -D -p -m0444 ${B}/supp_plugin/*.plugin ${D}${libdir}/tee-supplicant/plugins/ }meta-arm/recipes-security/optee/optee-test.inc +3
-1-FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/" +FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/ \ + ${libdir}/tee-supplicant/plugins/ \ + "# Imports machine specific configs from staging to build
PACKAGE_ARCH= "${MACHINE_ARCH}"meta-arm/recipes-security/optee/optee-test/0001-host-xtest-Adjust-order-of-including-compiler.h.patch deleted +0
-64@@ -1,64 +0,0 @@ -From fc95b3ccbbfd336797ae2cfd6dd4dc58644e146f Mon Sep 17 00:00:00 2001 -From: Khem Raj <[email protected]> -Date: Sat, 30 May 2020 17:52:18 -0700 -Subject: [PATCH] host/xtest: Adjust order of including compiler.h - -compiler.h defines some defines which violate libc namespace e.g. -__unused, this works ok with glibc but fails in awkward ways with musl -the reason is musl uses __unused in its internal structures and this -define in compiler.h conflicts with system headers causing errors like - -recipe-sysroot/usr/include/bits/stat.h:17:19: error: expected identifier or '(' before '[' token unsigned __unused[2]; - ^ -including compiler.h afer sys/stat.h fixes the problem. - -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 +- - host/xtest/stats.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/host/xtest/install_ta.c b/host/xtest/install_ta.c -index 09a4c6d..6f7bb5c 100644 ---- a/host/xtest/install_ta.c -+++ b/host/xtest/install_ta.c -@@ -4,7 +4,6 @@ - * SPDX-License-Identifier: BSD-2-Clause - */ - --#include <compiler.h> - #include <dirent.h> - #include <err.h> - #include <errno.h> -@@ -20,6 +19,7 @@ - #include <sys/types.h> - #include <tee_client_api.h> - #include <unistd.h> -+#include <compiler.h> - - #include "install_ta.h" - #include "xtest_helpers.h" -diff --git a/host/xtest/stats.c b/host/xtest/stats.c -index 96b0b5f..db9bf25 100644 ---- a/host/xtest/stats.c -+++ b/host/xtest/stats.c -@@ -3,7 +3,6 @@ - * Copyright (c) 2019, Linaro Limited - */ - --#include <compiler.h> - #include <dirent.h> - #include <err.h> - #include <errno.h> -@@ -18,6 +17,7 @@ - #include <sys/types.h> - #include <tee_client_api.h> - #include <unistd.h> -+#include <compiler.h> - #include "xtest_test.h" - #include "stats.h" - --- -2.26.2 -meta-arm/recipes-security/optee/optee-test/0002-make-remove-Wno-unsafe-loop-for-clang.patch deleted +0
-31@@ -1,31 +0,0 @@ -From 438533ce9da1df0b7c7914e64b39ffdc1da1ab79 Mon Sep 17 00:00:00 2001 -From: Brett Warren <[email protected]> -Date: Thu, 8 Oct 2020 10:03:25 +0100 -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 [https://github.com/OP-TEE/optee_test/issues/452] -Changed-Id: 71cb511904547d790d1ea98f93bf8e5a6afcb36d -Signed-off-by: Brett Warren <[email protected]> ---- - host/xtest/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/host/xtest/Makefile b/host/xtest/Makefile -index 3c206b0..96746de 100644 ---- a/host/xtest/Makefile -+++ b/host/xtest/Makefile -@@ -169,7 +169,7 @@ CFLAGS += -Wall -Wcast-align -Werror \ - -Werror-implicit-function-declaration -Wextra -Wfloat-equal \ - -Wformat-nonliteral -Wformat-security -Wformat=2 -Winit-self \ - -Wmissing-declarations -Wmissing-format-attribute \ -- -Wmissing-include-dirs -Wmissing-noreturn \ -+ -Wmissing-include-dirs \ - -Wmissing-prototypes -Wnested-externs -Wpointer-arith \ - -Wshadow -Wstrict-prototypes -Wswitch-default \ - -Wwrite-strings \ --- -2.17.1 -meta-arm/recipes-security/optee/optee-test/0003-make-remove-Wmissing-noreturn-for-clang.patch deleted +0
-31@@ -1,31 +0,0 @@ -From ed5a9d9f7a3e9e14ca0e8aea59008124ee0e5f96 Mon Sep 17 00:00:00 2001 -From: Brett Warren <[email protected]> -Date: Thu, 8 Oct 2020 10:20:52 +0100 -Subject: [PATCH] make: remove -Wno-unsafe-loop for clang - -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 [https://github.com/OP-TEE/optee_test/issues/452] -Change-Id: 5fe0892c73208aaffac8c9995cb3275936fb1ba6 -Signed-off-by: Brett Warren <[email protected]> ---- - host/xtest/Makefile | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/host/xtest/Makefile b/host/xtest/Makefile -index 96746de..73731d0 100644 ---- a/host/xtest/Makefile -+++ b/host/xtest/Makefile -@@ -174,7 +174,6 @@ CFLAGS += -Wall -Wcast-align -Werror \ - -Wshadow -Wstrict-prototypes -Wswitch-default \ - -Wwrite-strings \ - -Wno-declaration-after-statement \ -- -Wno-unsafe-loop-optimizations \ - -Wno-missing-field-initializers -Wno-format-zero-length - endif - --- -2.17.1 -meta-arm/recipes-security/optee/optee-test_3.11.0.bb deleted +0
-3@@ -1,3 +0,0 @@ -require optee-test.inc - -SRCREV = "159e295d5cc3ad2275ab15fe544620f6604d4ba4"meta-arm/recipes-security/optee/optee-test_3.14.0.bb new file +3
-1@@ -0,0 +1,3 @@ +require optee-test.inc + +SRCREV = "f2eb88affbb7f028561b4fd5cbd049d5d704f741" --2.25.1
The optee-examples recipe is broken:
install: cannot stat '/builds/engineering/yocto/meta-arm/work/build/tmp/work/qemuarm64_secureboot-poky-linux/optee-examples/3.14.0-r0/build/plugins/*':
No such file or directory
(qemuarm64-secureboot can build it)
Ross
Quoted 786 lines · Sumit Garg
Brief description of changes:
- Version uplift 3.11.0 -> 3.14.0.
- Removed OP-TEE patches that has already been accepted upstream.
- Added support for tee-supplicant plugin framework testing.Tested on
qemuarm64_secureboot:$ xtest -l 15 $ optee-examples_*Signed-off-by Sumit Garg <[email protected]>--- .../optee/optee-client_3.11.0.bb | 3 - .../optee/optee-client_3.14.0.bb | 3 + .../recipes-security/optee/optee-examples.inc | 9 +- .../0001-make-Pass-ldflags-during-link.patch | 103 ------------------ ...efault-cross-compiler-environment-se.patch | 84 ++++++++++++++ ...nable-plugins-installation-in-rootfs.patch | 39 +++++++ .../optee/optee-examples_3.11.0.bb | 4 - .../optee/optee-examples_3.14.0.bb | 4 + ...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 | 11 -- .../recipes-security/optee/optee-os_3.14.0.bb | 8 ++ .../recipes-security/optee/optee-test.inc | 15 +-- ...Adjust-order-of-including-compiler.h.patch | 64 ----------- ...ake-remove-Wno-unsafe-loop-for-clang.patch | 31 ------ ...e-remove-Wmissing-noreturn-for-clang.patch | 31 ------ .../optee/optee-test_3.11.0.bb | 3 - .../optee/optee-test_3.14.0.bb | 3 + 19 files changed, 154 insertions(+), 422 deletions(-) delete mode 100644 meta-arm/recipes-security/optee/optee-client_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-client_3.14.0.bb delete mode 100644 meta-arm/recipes-security/optee/optee-examples/0001-make-Pass-ldflags-during-link.patch create mode 100644 meta-arm/recipes-security/optee/optee-examples/0001-plugins-Honour-default-cross-compiler-environment-se.patch create mode 100644 meta-arm/recipes-security/optee/optee-examples/0002-Makefile-Enable-plugins-installation-in-rootfs.patch delete mode 100644 meta-arm/recipes-security/optee/optee-examples_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-examples_3.14.0.bb delete mode 100644 meta-arm/recipes-security/optee/optee-os/0001-libutils-provide-empty-__getauxval-implementation.patch delete mode 100644 meta-arm/recipes-security/optee/optee-os/0002-link.mk-implement-support-for-libnames-after-libgcc-.patch delete mode 100644 meta-arm/recipes-security/optee/optee-os/0003-ta_dev_kit.mk-make-sure-that-libutils-is-linked-seco.patch delete mode 100644 meta-arm/recipes-security/optee/optee-os_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-os_3.14.0.bb delete mode 100644 meta-arm/recipes-security/optee/optee-test/0001-host-xtest-Adjust-order-of-including-compiler.h.patch delete mode 100644 meta-arm/recipes-security/optee/optee-test/0002-make-remove-Wno-unsafe-loop-for-clang.patch delete mode 100644 meta-arm/recipes-security/optee/optee-test/0003-make-remove-Wmissing-noreturn-for-clang.patch delete mode 100644 meta-arm/recipes-security/optee/optee-test_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-test_3.14.0.bbmeta-arm/recipes-security/optee/optee-client_3.11.0.bb deleted +0
-3@@ -1,3 +0,0 @@ -require optee-client.inc - -SRCREV = "c0c925384c1d7e3558d27d2708857482952d7907"meta-arm/recipes-security/optee/optee-client_3.14.0.bb new file +3
-0@@ -0,0 +1,3 @@ +require optee-client.inc + +SRCREV = "06e1b32f6a7028e039c625b07cfc25fda0c17d53"meta-arm/recipes-security/optee/optee-examples.inc +7
-2@@ -12,7 +12,8 @@ inherit python3native require optee.inc SRC_URI = "git://github.com/linaro-swg/optee_examples.git \ - file://0001-make-Pass-ldflags-during-link.patch \ + file://0001-plugins-Honour-default-cross-compiler-environment-se.patch \ + file://0002-Makefile-Enable-plugins-installation-in-rootfs.patch \ " EXTRA_OEMAKE += "TA_DEV_KIT_DIR=${TA_DEV_KIT_DIR} \@@ -32,11 +33,15 @@ do_compile[cleandirs] = "${B}" do_install () { mkdir -p ${D}${nonarch_base_libdir}/optee_armtz mkdir -p ${D}${bindir} + mkdir -p ${D}${libdir}/tee-supplicant/plugins install -D -p -m0755 ${B}/ca/* ${D}${bindir} install -D -p -m0444 ${B}/ta/* ${D}${nonarch_base_libdir}/optee_armtz + install -D -p -m0444 ${B}/plugins/* ${D}${libdir}/tee-supplicant/plugins } -FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/" +FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/ \ + ${libdir}/tee-supplicant/plugins/ \ + " # Imports machine specific configs from staging to build PACKAGE_ARCH = "${MACHINE_ARCH}"meta-arm/recipes-security/optee/optee-examples/0001-make-Pass-ldflags-during-link.patch deleted +0
-103@@ -1,103 +0,0 @@ -From 29ae21de41f2fbab6dbecbbf408826b28de82df1 Mon Sep 17 00:00:00 2001 -From: Khem Raj <[email protected]> -Date: Tue, 1 Sep 2020 21:09:56 -0700 -Subject: [PATCH] make: Pass ldflags during link - -OpenEmbeeded needs to pass essential linker flags to set correct flags -for gnu_hash among others which sets the linking straight -using LDFLAGS varible here means, we can affect the linker flags -from build environment - -Upstream-Status: Submitted [https://github.com/linaro-swg/optee_examples/pull/85] - -Signed-off-by: Khem Raj <[email protected]> ---- - acipher/host/Makefile | 2 +- - aes/host/Makefile | 2 +- - hello_world/host/Makefile | 2 +- - hotp/host/Makefile | 2 +- - random/host/Makefile | 2 +- - secure_storage/host/Makefile | 2 +- - 6 files changed, 6 insertions(+), 6 deletions(-) - -diff --git a/acipher/host/Makefile b/acipher/host/Makefile -index 8f4bc8a..c2cabef 100644 ---- a/acipher/host/Makefile -+++ b/acipher/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_acipher - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/aes/host/Makefile b/aes/host/Makefile -index dfeb4e8..f61c71b 100644 ---- a/aes/host/Makefile -+++ b/aes/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_aes - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/hello_world/host/Makefile b/hello_world/host/Makefile -index c4c8239..69cf42c 100644 ---- a/hello_world/host/Makefile -+++ b/hello_world/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_hello_world - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/hotp/host/Makefile b/hotp/host/Makefile -index cb7fd19..e7f013f 100644 ---- a/hotp/host/Makefile -+++ b/hotp/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_hotp - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/random/host/Makefile b/random/host/Makefile -index fd407d9..9377f7a 100644 ---- a/random/host/Makefile -+++ b/random/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_random - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/secure_storage/host/Makefile b/secure_storage/host/Makefile -index 29bfb87..b3265ae 100644 ---- a/secure_storage/host/Makefile -+++ b/secure_storage/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_secure_storage - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: --- -2.28.0 -meta-arm/recipes-security/optee/optee-examples/0001-plugins-Honour-default-cross-compiler-environment-se.patch new file +84
-0@@ -0,0 +1,84 @@ +From 79c826c249001700007a6dffe80c3d61ff4428ef Mon Sep 17 00:00:00 2001 +From: Sumit Garg <[email protected]> +Date: Tue, 20 Jul 2021 13:54:30 +0530 +Subject: [PATCH 1/2] plugins: Honour default cross compiler environment setup + +Honour default $(CC), $(CFLAGS) and $(LDFLAGS) variables. Without this +plugins example fails to build for OE/Yocto. + +Upstream-Status: Submitted [https://github.com/linaro-swg/optee_examples/pull/87] + +Signed-off-by: Sumit Garg <[email protected]> +--- + plugins/Makefile | 2 +- + plugins/host/Makefile | 2 +- + plugins/syslog/Makefile | 16 ++++++++++++---- + 3 files changed, 14 insertions(+), 6 deletions(-) + +diff --git a/plugins/Makefile b/plugins/Makefile +index 2372b38..ea472b4 100644 +--- a/plugins/Makefile ++++ b/plugins/Makefile +@@ -8,7 +8,7 @@ TA_CROSS_COMPILE ?= $(CROSS_COMPILE) + all: + $(MAKE) -C host CROSS_COMPILE="$(HOST_CROSS_COMPILE)" --no-builtin-variables + $(MAKE) -C ta CROSS_COMPILE="$(TA_CROSS_COMPILE)" LDFLAGS="" +- $(MAKE) -C syslog CROSS_COMPILE="$(HOST_CROSS_COMPILE)" ++ $(MAKE) -C syslog CROSS_COMPILE="$(HOST_CROSS_COMPILE)" --no-builtin-variables + + .PHONY: clean + clean: +diff --git a/plugins/host/Makefile b/plugins/host/Makefile +index 7285104..76244c7 100644 +--- a/plugins/host/Makefile ++++ b/plugins/host/Makefile +@@ -20,7 +20,7 @@ BINARY = optee_example_plugins + all: $(BINARY) + + $(BINARY): $(OBJS) +- $(CC) -o $@ $< $(LDADD) ++ $(CC) $(LDFLAGS) -o $@ $< $(LDADD) + + .PHONY: clean + clean: +diff --git a/plugins/syslog/Makefile b/plugins/syslog/Makefile +index 62d916a..71f5f92 100644 +--- a/plugins/syslog/Makefile ++++ b/plugins/syslog/Makefile +@@ -1,3 +1,11 @@ ++CC ?= $(CROSS_COMPILE)gcc ++LD ?= $(CROSS_COMPILE)ld ++AR ?= $(CROSS_COMPILE)ar ++NM ?= $(CROSS_COMPILE)nm ++OBJCOPY ?= $(CROSS_COMPILE)objcopy ++OBJDUMP ?= $(CROSS_COMPILE)objdump ++READELF ?= $(CROSS_COMPILE)readelf ++ + PLUGIN_UUID = 96bcf744-4f72-4866-bf1d-8634fd9c65e5 + + PLUGIN = $(PLUGIN_UUID).plugin +@@ -6,17 +14,17 @@ PLUGIN_OBJ = $(patsubst %.c, %.o, $(PLUGIN_SRS)) + PLUGIN_INCLUDES_DIR = $(CURDIR) $(TEEC_EXPORT)/include + + PLUGIN_INCLUDES = $(addprefix -I, $(PLUGIN_INCLUDES_DIR)) +-PLUGIN_CCFLAGS = -Wall -fPIC +-PLUGIN_LDFLAGS = -shared ++PLUGIN_CCFLAGS = $(CFLAGS) -Wall -fPIC ++PLUGIN_LDFLAGS = $(LDFLAGS) -shared + + .PHONY: all + all: $(PLUGIN) + + $(PLUGIN): $(PLUGIN_OBJ) +- $(CROSS_COMPILE)gcc $(PLUGIN_LDFLAGS) $(PLUGIN_OBJ) -o $@ ++ $(CC) $(PLUGIN_LDFLAGS) $(PLUGIN_OBJ) -o $@ + + %.o: %.c +- $(CROSS_COMPILE)gcc $(PLUGIN_CCFLAGS) $(PLUGIN_INCLUDES) -c $*.c -o $*.o ++ $(CC) $(PLUGIN_CCFLAGS) $(PLUGIN_INCLUDES) -c $*.c -o $*.o + + .PHONY: clean + clean: +-- +2.25.1 +meta-arm/recipes-security/optee/optee-examples/0002-Makefile-Enable-plugins-installation-in-rootfs.patch new file +39
-0@@ -0,0 +1,39 @@ +From a865f2e25e178fc2c4617eb1faf79ac922d02ffd Mon Sep 17 00:00:00 2001 +From: Sumit Garg <[email protected]> +Date: Tue, 20 Jul 2021 14:20:10 +0530 +Subject: [PATCH 2/2] Makefile: Enable plugins installation in rootfs + +Upstream-Status: Submitted [https://github.com/linaro-swg/optee_examples/pull/87] + +Signed-off-by: Sumit Garg <[email protected]> +--- + Makefile | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/Makefile b/Makefile +index a275842..b3f16aa 100644 +--- a/Makefile ++++ b/Makefile +@@ -25,14 +25,19 @@ prepare-for-rootfs: examples + @mkdir -p $(OUTPUT_DIR) + @mkdir -p $(OUTPUT_DIR)/ta + @mkdir -p $(OUTPUT_DIR)/ca ++ @mkdir -p $(OUTPUT_DIR)/plugins + @for example in $(EXAMPLE_LIST); do \ + if [ -e $$example/host/optee_example_$$example ]; then \ + cp -p $$example/host/optee_example_$$example $(OUTPUT_DIR)/ca/; \ + fi; \ + cp -pr $$example/ta/*.ta $(OUTPUT_DIR)/ta/; \ ++ if [ $$example == plugins ]; then \ ++ cp -p plugins/syslog/*.plugin $(OUTPUT_DIR)/plugins/; \ ++ fi; \ + done + + prepare-for-rootfs-clean: + @rm -rf $(OUTPUT_DIR)/ta + @rm -rf $(OUTPUT_DIR)/ca ++ @rm -rf $(OUTPUT_DIR)/plugins + @rmdir --ignore-fail-on-non-empty $(OUTPUT_DIR) || test ! -e $(OUTPUT_DIR) +-- +2.25.1 +meta-arm/recipes-security/optee/optee-examples_3.11.0.bb deleted +0
-4@@ -1,4 +0,0 @@ -require optee-examples.inc - -SRCREV = "9a7dc598591990349d88b4dba3a37aadd6851295" -meta-arm/recipes-security/optee/optee-examples_3.14.0.bb new file +4
-0@@ -0,0 +1,4 @@ +require optee-examples.inc + +SRCREV = "e9c870525af8f7e7fccf575a0ca5394ce55adcec" +meta-arm/recipes-security/optee/optee-os/0001-libutils-provide-empty-__getauxval-implementation.patch deleted +0
-62@@ -1,62 +0,0 @@ -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 deleted +0
-55@@ -1,55 +0,0 @@ -Upstream-Status: Backport -Signed-off-by: Ross Burton <[email protected]> - -From 73196b58ea6978ffa5e581738030f51c5789ef73 Mon Sep 17 00:00:00 2001 -From: Volodymyr Babchuk <[email protected]> -Date: Tue, 13 Oct 2020 22:54:13 +0300 -Subject: [PATCH 2/3] link.mk: implement support for libnames-after-libgcc - variable - -Newer versions of libgcc depend on external __getauxval() symbol, which is -now provided by libutils. But libgcc is linked after libutils, so linker -can't resolve that symbol. We can't include libgcc into linking group with -libtutils, because libgcc provides symbols that conflict with libutil's -ones, like __aeabi_idiv with friends for instance. - -So, to resolve libgcc dependency on libutils we need to link with libutils -second time. To make things more generic, we will introduce -$(libnames-after-libgcc) variable for libraries that should be linked after -libgcc. - -Signed-off-by: Volodymyr Babchuk <[email protected]> -Reviewed-by: Jens Wiklander <[email protected]> -Reviewed-by: Jerome Forissier <[email protected]> ---- - ta/arch/arm/link.mk | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/ta/arch/arm/link.mk b/ta/arch/arm/link.mk -index 445c285d..3025acb1 100644 ---- a/ta/arch/arm/link.mk -+++ b/ta/arch/arm/link.mk -@@ -55,8 +55,11 @@ link-ldflags += --eh-frame-hdr - link-ldadd += $(libstdc++$(sm)) $(libgcc_eh$(sm)) - endif - link-ldadd += --end-group --ldargs-$(user-ta-uuid).elf := $(link-ldflags) $(objs) $(link-ldadd) $(libgcc$(sm)) - -+link-ldadd-after-libgcc += $(addprefix -l,$(libnames-after-libgcc)) -+ -+ldargs-$(user-ta-uuid).elf := $(link-ldflags) $(objs) $(link-ldadd) \ -+ $(libgcc$(sm)) $(link-ldadd-after-libgcc) - - link-script-cppflags-$(sm) := \ - $(filter-out $(CPPFLAGS_REMOVE) $(cppflags-remove), \ -@@ -76,6 +79,7 @@ $(link-script-pp$(sm)): $(link-script$(sm)) $(conf-file) $(link-script-pp-makefi - $(link-script-cppflags-$(sm)) $$< -o $$@ - - $(link-out-dir$(sm))/$(user-ta-uuid).elf: $(objs) $(libdeps) \ -+ $(libdeps-after-libgcc) \ - $(link-script-pp$(sm)) \ - $(dynlistdep) \ - $(additional-link-deps) --- -2.25.1 -meta-arm/recipes-security/optee/optee-os/0003-ta_dev_kit.mk-make-sure-that-libutils-is-linked-seco.patch deleted +0
-44@@ -1,44 +0,0 @@ -Upstream-Status: Backport -Signed-off-by: Ross Burton <[email protected]> - -From f50962e3f56f0932662b2ffa10afe53339a335dd Mon Sep 17 00:00:00 2001 -From: Volodymyr Babchuk <[email protected]> -Date: Fri, 16 Oct 2020 16:36:08 +0300 -Subject: [PATCH 3/3] ta_dev_kit.mk: make sure that libutils is linked second - time - -libgcc depends on __getauxval symbol from libuils. As, generally libutils -is linked before libgcc, we will get "unresolved symbol" error. To resolve -this dependency we need to link libutils second time - after libgcc. - -Signed-off-by: Volodymyr Babchuk <[email protected]> -Reviewed-by: Jens Wiklander <[email protected]> -Reviewed-by: Jerome Forissier <[email protected]> ---- - ta/mk/ta_dev_kit.mk | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/ta/mk/ta_dev_kit.mk b/ta/mk/ta_dev_kit.mk -index e28be677..d0e66317 100644 ---- a/ta/mk/ta_dev_kit.mk -+++ b/ta/mk/ta_dev_kit.mk -@@ -78,6 +78,16 @@ endif - libnames += dl - libdeps += $(ta-dev-kit-dir$(sm))/lib/libdl.a - -+# libutils provides __getauxval symbol which is needed by libgcc 10.x. We can't -+# link libutils after libgcc, because libgcc will replace some symbols provided -+# by libutils, which will cause further linking issues. -+# -+# But if we place libutils before libgcc, linker will not be able to resolve -+# __getauxval. So we need to link with libutils twice: before and after libgcc. -+# Hence it included both in $(libnames) and in $(libnames-after-libgcc) -+libnames-after-libgcc += utils -+libdeps-after-libgcc += $(ta-dev-kit-dir$(sm))/lib/libutils.a -+ - # Pass config variable (CFG_) from conf.mk on the command line - cppflags$(sm) += $(strip \ - $(foreach var, $(filter CFG_%,$(.VARIABLES)), \ --- -2.25.1 -meta-arm/recipes-security/optee/optee-os_3.11.0.bb deleted +0
-11@@ -1,11 +0,0 @@ -require optee-os.inc - -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 \ -"meta-arm/recipes-security/optee/optee-os_3.14.0.bb new file +8
-0@@ -0,0 +1,8 @@ +require optee-os.inc + +SRCREV = "d21befa5e53eae9db469eba1685f5aa5c6f92c2f" + +SRC_URI_append = " \ + file://0006-allow-setting-sysroot-for-libgcc-lookup.patch \ + file://0007-allow-setting-sysroot-for-clang.patch \ +"meta-arm/recipes-security/optee/optee-test.inc +6
-9@@ -8,17 +8,9 @@ LIC_FILES_CHKSUM = "file://${S}/LICENSE.md;md5=daa2bcccc666345ab8940aab1315a4fa" inherit python3native ptest require optee.inc -# Linking fails on musl due to C++/threads -# https://github.com/OP-TEE/optee_test/issues/458#issuecomment-720540834 -# When upgraded we should be able to remove this limitation -COMPATIBLE_HOST_libc-musl = 'null' - DEPENDS = "optee-client optee-os python3-pycryptodome-native" SRC_URI = "git://github.com/OP-TEE/optee_test.git \ - file://0001-host-xtest-Adjust-order-of-including-compiler.h.patch \ - file://0002-make-remove-Wno-unsafe-loop-for-clang.patch \ - file://0003-make-remove-Wmissing-noreturn-for-clang.patch \ file://run-ptest \ "@@ -36,6 +28,7 @@ do_compile() { # Top level makefile doesn't seem to handle parallel make gracefully oe_runmake xtest oe_runmake ta + oe_runmake test_plugin } do_compile[cleandirs] = "${B}"@@ -46,9 +39,13 @@ do_install () { # default TEEC_LOAD_PATH is /lib mkdir -p ${D}${nonarch_base_libdir}/optee_armtz/ install -D -p -m0444 ${B}/ta/*/*.ta ${D}${nonarch_base_libdir}/optee_armtz/ + mkdir -p ${D}${libdir}/tee-supplicant/plugins + install -D -p -m0444 ${B}/supp_plugin/*.plugin ${D}${libdir}/tee-supplicant/plugins/ } -FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/" +FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/ \ + ${libdir}/tee-supplicant/plugins/ \ + " # Imports machine specific configs from staging to build PACKAGE_ARCH = "${MACHINE_ARCH}"meta-arm/recipes-security/optee/optee-test/0001-host-xtest-Adjust-order-of-including-compiler.h.patch deleted +0
-64@@ -1,64 +0,0 @@ -From fc95b3ccbbfd336797ae2cfd6dd4dc58644e146f Mon Sep 17 00:00:00 2001 -From: Khem Raj <[email protected]> -Date: Sat, 30 May 2020 17:52:18 -0700 -Subject: [PATCH] host/xtest: Adjust order of including compiler.h - -compiler.h defines some defines which violate libc namespace e.g. -__unused, this works ok with glibc but fails in awkward ways with musl -the reason is musl uses __unused in its internal structures and this -define in compiler.h conflicts with system headers causing errors like - -recipe-sysroot/usr/include/bits/stat.h:17:19: error: expected identifier or '(' before '[' token unsigned __unused[2]; - ^ -including compiler.h afer sys/stat.h fixes the problem. - -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 +- - host/xtest/stats.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/host/xtest/install_ta.c b/host/xtest/install_ta.c -index 09a4c6d..6f7bb5c 100644 ---- a/host/xtest/install_ta.c -+++ b/host/xtest/install_ta.c -@@ -4,7 +4,6 @@ - * SPDX-License-Identifier: BSD-2-Clause - */ - --#include <compiler.h> - #include <dirent.h> - #include <err.h> - #include <errno.h> -@@ -20,6 +19,7 @@ - #include <sys/types.h> - #include <tee_client_api.h> - #include <unistd.h> -+#include <compiler.h> - - #include "install_ta.h" - #include "xtest_helpers.h" -diff --git a/host/xtest/stats.c b/host/xtest/stats.c -index 96b0b5f..db9bf25 100644 ---- a/host/xtest/stats.c -+++ b/host/xtest/stats.c -@@ -3,7 +3,6 @@ - * Copyright (c) 2019, Linaro Limited - */ - --#include <compiler.h> - #include <dirent.h> - #include <err.h> - #include <errno.h> -@@ -18,6 +17,7 @@ - #include <sys/types.h> - #include <tee_client_api.h> - #include <unistd.h> -+#include <compiler.h> - #include "xtest_test.h" - #include "stats.h" - --- -2.26.2 -meta-arm/recipes-security/optee/optee-test/0002-make-remove-Wno-unsafe-loop-for-clang.patch deleted +0
-31@@ -1,31 +0,0 @@ -From 438533ce9da1df0b7c7914e64b39ffdc1da1ab79 Mon Sep 17 00:00:00 2001 -From: Brett Warren <[email protected]> -Date: Thu, 8 Oct 2020 10:03:25 +0100 -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 [https://github.com/OP-TEE/optee_test/issues/452] -Changed-Id: 71cb511904547d790d1ea98f93bf8e5a6afcb36d -Signed-off-by: Brett Warren <[email protected]> ---- - host/xtest/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/host/xtest/Makefile b/host/xtest/Makefile -index 3c206b0..96746de 100644 ---- a/host/xtest/Makefile -+++ b/host/xtest/Makefile -@@ -169,7 +169,7 @@ CFLAGS += -Wall -Wcast-align -Werror \ - -Werror-implicit-function-declaration -Wextra -Wfloat-equal \ - -Wformat-nonliteral -Wformat-security -Wformat=2 -Winit-self \ - -Wmissing-declarations -Wmissing-format-attribute \ -- -Wmissing-include-dirs -Wmissing-noreturn \ -+ -Wmissing-include-dirs \ - -Wmissing-prototypes -Wnested-externs -Wpointer-arith \ - -Wshadow -Wstrict-prototypes -Wswitch-default \ - -Wwrite-strings \ --- -2.17.1 -meta-arm/recipes-security/optee/optee-test/0003-make-remove-Wmissing-noreturn-for-clang.patch deleted +0
-31@@ -1,31 +0,0 @@ -From ed5a9d9f7a3e9e14ca0e8aea59008124ee0e5f96 Mon Sep 17 00:00:00 2001 -From: Brett Warren <[email protected]> -Date: Thu, 8 Oct 2020 10:20:52 +0100 -Subject: [PATCH] make: remove -Wno-unsafe-loop for clang - -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 [https://github.com/OP-TEE/optee_test/issues/452] -Change-Id: 5fe0892c73208aaffac8c9995cb3275936fb1ba6 -Signed-off-by: Brett Warren <[email protected]> ---- - host/xtest/Makefile | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/host/xtest/Makefile b/host/xtest/Makefile -index 96746de..73731d0 100644 ---- a/host/xtest/Makefile -+++ b/host/xtest/Makefile -@@ -174,7 +174,6 @@ CFLAGS += -Wall -Wcast-align -Werror \ - -Wshadow -Wstrict-prototypes -Wswitch-default \ - -Wwrite-strings \ - -Wno-declaration-after-statement \ -- -Wno-unsafe-loop-optimizations \ - -Wno-missing-field-initializers -Wno-format-zero-length - endif - --- -2.17.1 -meta-arm/recipes-security/optee/optee-test_3.11.0.bb deleted +0
-3@@ -1,3 +0,0 @@ -require optee-test.inc - -SRCREV = "159e295d5cc3ad2275ab15fe544620f6604d4ba4"meta-arm/recipes-security/optee/optee-test_3.14.0.bb new file +3
-1@@ -0,0 +1,3 @@ +require optee-test.inc + +SRCREV = "f2eb88affbb7f028561b4fd5cbd049d5d704f741" --2.25.1
Hi Ross,
Quoted 9 lines · Ross Burton
The optee-examples recipe is broken:
install: cannot stat '/builds/engineering/yocto/meta-arm/work/build/tmp/work/qemuarm64_secureboot-poky-linux/optee-examples/3.14.0-r0/build/plugins/*':
No such file or directory(qemuarm64-secureboot can build it)
Strangely, it works fine for me when building for qemuarm64-secureboot. Can you check if the following patches have been correctly applied in the corresponding work directory?
file://0001-plugins-Honour-default-cross-compiler-environment-se.patch
\
file://0002-Makefile-Enable-plugins-installation-in-rootfs.patch \-Sumit
Quoted 789 lines
Ross
Quoted 786 lines · Sumit Garg
Brief description of changes:
- Version uplift 3.11.0 -> 3.14.0.
- Removed OP-TEE patches that has already been accepted upstream.
- Added support for tee-supplicant plugin framework testing.Tested on
qemuarm64_secureboot:$ xtest -l 15 $ optee-examples_*Signed-off-by Sumit Garg <[email protected]>--- .../optee/optee-client_3.11.0.bb | 3 - .../optee/optee-client_3.14.0.bb | 3 + .../recipes-security/optee/optee-examples.inc | 9 +- .../0001-make-Pass-ldflags-during-link.patch | 103 ------------------ ...efault-cross-compiler-environment-se.patch | 84 ++++++++++++++ ...nable-plugins-installation-in-rootfs.patch | 39 +++++++ .../optee/optee-examples_3.11.0.bb | 4 - .../optee/optee-examples_3.14.0.bb | 4 + ...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 | 11 -- .../recipes-security/optee/optee-os_3.14.0.bb | 8 ++ .../recipes-security/optee/optee-test.inc | 15 +-- ...Adjust-order-of-including-compiler.h.patch | 64 ----------- ...ake-remove-Wno-unsafe-loop-for-clang.patch | 31 ------ ...e-remove-Wmissing-noreturn-for-clang.patch | 31 ------ .../optee/optee-test_3.11.0.bb | 3 - .../optee/optee-test_3.14.0.bb | 3 + 19 files changed, 154 insertions(+), 422 deletions(-) delete mode 100644 meta-arm/recipes-security/optee/optee-client_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-client_3.14.0.bb delete mode 100644 meta-arm/recipes-security/optee/optee-examples/0001-make-Pass-ldflags-during-link.patch create mode 100644 meta-arm/recipes-security/optee/optee-examples/0001-plugins-Honour-default-cross-compiler-environment-se.patch create mode 100644 meta-arm/recipes-security/optee/optee-examples/0002-Makefile-Enable-plugins-installation-in-rootfs.patch delete mode 100644 meta-arm/recipes-security/optee/optee-examples_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-examples_3.14.0.bb delete mode 100644 meta-arm/recipes-security/optee/optee-os/0001-libutils-provide-empty-__getauxval-implementation.patch delete mode 100644 meta-arm/recipes-security/optee/optee-os/0002-link.mk-implement-support-for-libnames-after-libgcc-.patch delete mode 100644 meta-arm/recipes-security/optee/optee-os/0003-ta_dev_kit.mk-make-sure-that-libutils-is-linked-seco.patch delete mode 100644 meta-arm/recipes-security/optee/optee-os_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-os_3.14.0.bb delete mode 100644 meta-arm/recipes-security/optee/optee-test/0001-host-xtest-Adjust-order-of-including-compiler.h.patch delete mode 100644 meta-arm/recipes-security/optee/optee-test/0002-make-remove-Wno-unsafe-loop-for-clang.patch delete mode 100644 meta-arm/recipes-security/optee/optee-test/0003-make-remove-Wmissing-noreturn-for-clang.patch delete mode 100644 meta-arm/recipes-security/optee/optee-test_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-test_3.14.0.bbmeta-arm/recipes-security/optee/optee-client_3.11.0.bb deleted +0
-3@@ -1,3 +0,0 @@ -require optee-client.inc - -SRCREV = "c0c925384c1d7e3558d27d2708857482952d7907"meta-arm/recipes-security/optee/optee-client_3.14.0.bb new file +3
-0@@ -0,0 +1,3 @@ +require optee-client.inc + +SRCREV = "06e1b32f6a7028e039c625b07cfc25fda0c17d53"meta-arm/recipes-security/optee/optee-examples.inc +7
-2@@ -12,7 +12,8 @@ inherit python3native require optee.inc SRC_URI = "git://github.com/linaro-swg/optee_examples.git \ - file://0001-make-Pass-ldflags-during-link.patch \ + file://0001-plugins-Honour-default-cross-compiler-environment-se.patch \ + file://0002-Makefile-Enable-plugins-installation-in-rootfs.patch \ " EXTRA_OEMAKE += "TA_DEV_KIT_DIR=${TA_DEV_KIT_DIR} \@@ -32,11 +33,15 @@ do_compile[cleandirs] = "${B}" do_install () { mkdir -p ${D}${nonarch_base_libdir}/optee_armtz mkdir -p ${D}${bindir} + mkdir -p ${D}${libdir}/tee-supplicant/plugins install -D -p -m0755 ${B}/ca/* ${D}${bindir} install -D -p -m0444 ${B}/ta/* ${D}${nonarch_base_libdir}/optee_armtz + install -D -p -m0444 ${B}/plugins/* ${D}${libdir}/tee-supplicant/plugins } -FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/" +FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/ \ + ${libdir}/tee-supplicant/plugins/ \ + " # Imports machine specific configs from staging to build PACKAGE_ARCH = "${MACHINE_ARCH}"meta-arm/recipes-security/optee/optee-examples/0001-make-Pass-ldflags-during-link.patch deleted +0
-103@@ -1,103 +0,0 @@ -From 29ae21de41f2fbab6dbecbbf408826b28de82df1 Mon Sep 17 00:00:00 2001 -From: Khem Raj <[email protected]> -Date: Tue, 1 Sep 2020 21:09:56 -0700 -Subject: [PATCH] make: Pass ldflags during link - -OpenEmbeeded needs to pass essential linker flags to set correct flags -for gnu_hash among others which sets the linking straight -using LDFLAGS varible here means, we can affect the linker flags -from build environment - -Upstream-Status: Submitted [https://github.com/linaro-swg/optee_examples/pull/85] - -Signed-off-by: Khem Raj <[email protected]> ---- - acipher/host/Makefile | 2 +- - aes/host/Makefile | 2 +- - hello_world/host/Makefile | 2 +- - hotp/host/Makefile | 2 +- - random/host/Makefile | 2 +- - secure_storage/host/Makefile | 2 +- - 6 files changed, 6 insertions(+), 6 deletions(-) - -diff --git a/acipher/host/Makefile b/acipher/host/Makefile -index 8f4bc8a..c2cabef 100644 ---- a/acipher/host/Makefile -+++ b/acipher/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_acipher - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/aes/host/Makefile b/aes/host/Makefile -index dfeb4e8..f61c71b 100644 ---- a/aes/host/Makefile -+++ b/aes/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_aes - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/hello_world/host/Makefile b/hello_world/host/Makefile -index c4c8239..69cf42c 100644 ---- a/hello_world/host/Makefile -+++ b/hello_world/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_hello_world - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/hotp/host/Makefile b/hotp/host/Makefile -index cb7fd19..e7f013f 100644 ---- a/hotp/host/Makefile -+++ b/hotp/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_hotp - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/random/host/Makefile b/random/host/Makefile -index fd407d9..9377f7a 100644 ---- a/random/host/Makefile -+++ b/random/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_random - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/secure_storage/host/Makefile b/secure_storage/host/Makefile -index 29bfb87..b3265ae 100644 ---- a/secure_storage/host/Makefile -+++ b/secure_storage/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_secure_storage - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: --- -2.28.0 -meta-arm/recipes-security/optee/optee-examples/0001-plugins-Honour-default-cross-compiler-environment-se.patch new file +84
-0@@ -0,0 +1,84 @@ +From 79c826c249001700007a6dffe80c3d61ff4428ef Mon Sep 17 00:00:00 2001 +From: Sumit Garg <[email protected]> +Date: Tue, 20 Jul 2021 13:54:30 +0530 +Subject: [PATCH 1/2] plugins: Honour default cross compiler environment setup + +Honour default $(CC), $(CFLAGS) and $(LDFLAGS) variables. Without this +plugins example fails to build for OE/Yocto. + +Upstream-Status: Submitted [https://github.com/linaro-swg/optee_examples/pull/87] + +Signed-off-by: Sumit Garg <[email protected]> +--- + plugins/Makefile | 2 +- + plugins/host/Makefile | 2 +- + plugins/syslog/Makefile | 16 ++++++++++++---- + 3 files changed, 14 insertions(+), 6 deletions(-) + +diff --git a/plugins/Makefile b/plugins/Makefile +index 2372b38..ea472b4 100644 +--- a/plugins/Makefile ++++ b/plugins/Makefile +@@ -8,7 +8,7 @@ TA_CROSS_COMPILE ?= $(CROSS_COMPILE) + all: + $(MAKE) -C host CROSS_COMPILE="$(HOST_CROSS_COMPILE)" --no-builtin-variables + $(MAKE) -C ta CROSS_COMPILE="$(TA_CROSS_COMPILE)" LDFLAGS="" +- $(MAKE) -C syslog CROSS_COMPILE="$(HOST_CROSS_COMPILE)" ++ $(MAKE) -C syslog CROSS_COMPILE="$(HOST_CROSS_COMPILE)" --no-builtin-variables + + .PHONY: clean + clean: +diff --git a/plugins/host/Makefile b/plugins/host/Makefile +index 7285104..76244c7 100644 +--- a/plugins/host/Makefile ++++ b/plugins/host/Makefile +@@ -20,7 +20,7 @@ BINARY = optee_example_plugins + all: $(BINARY) + + $(BINARY): $(OBJS) +- $(CC) -o $@ $< $(LDADD) ++ $(CC) $(LDFLAGS) -o $@ $< $(LDADD) + + .PHONY: clean + clean: +diff --git a/plugins/syslog/Makefile b/plugins/syslog/Makefile +index 62d916a..71f5f92 100644 +--- a/plugins/syslog/Makefile ++++ b/plugins/syslog/Makefile +@@ -1,3 +1,11 @@ ++CC ?= $(CROSS_COMPILE)gcc ++LD ?= $(CROSS_COMPILE)ld ++AR ?= $(CROSS_COMPILE)ar ++NM ?= $(CROSS_COMPILE)nm ++OBJCOPY ?= $(CROSS_COMPILE)objcopy ++OBJDUMP ?= $(CROSS_COMPILE)objdump ++READELF ?= $(CROSS_COMPILE)readelf ++ + PLUGIN_UUID = 96bcf744-4f72-4866-bf1d-8634fd9c65e5 + + PLUGIN = $(PLUGIN_UUID).plugin +@@ -6,17 +14,17 @@ PLUGIN_OBJ = $(patsubst %.c, %.o, $(PLUGIN_SRS)) + PLUGIN_INCLUDES_DIR = $(CURDIR) $(TEEC_EXPORT)/include + + PLUGIN_INCLUDES = $(addprefix -I, $(PLUGIN_INCLUDES_DIR)) +-PLUGIN_CCFLAGS = -Wall -fPIC +-PLUGIN_LDFLAGS = -shared ++PLUGIN_CCFLAGS = $(CFLAGS) -Wall -fPIC ++PLUGIN_LDFLAGS = $(LDFLAGS) -shared + + .PHONY: all + all: $(PLUGIN) + + $(PLUGIN): $(PLUGIN_OBJ) +- $(CROSS_COMPILE)gcc $(PLUGIN_LDFLAGS) $(PLUGIN_OBJ) -o $@ ++ $(CC) $(PLUGIN_LDFLAGS) $(PLUGIN_OBJ) -o $@ + + %.o: %.c +- $(CROSS_COMPILE)gcc $(PLUGIN_CCFLAGS) $(PLUGIN_INCLUDES) -c $*.c -o $*.o ++ $(CC) $(PLUGIN_CCFLAGS) $(PLUGIN_INCLUDES) -c $*.c -o $*.o + + .PHONY: clean + clean: +-- +2.25.1 +meta-arm/recipes-security/optee/optee-examples/0002-Makefile-Enable-plugins-installation-in-rootfs.patch new file +39
-0@@ -0,0 +1,39 @@ +From a865f2e25e178fc2c4617eb1faf79ac922d02ffd Mon Sep 17 00:00:00 2001 +From: Sumit Garg <[email protected]> +Date: Tue, 20 Jul 2021 14:20:10 +0530 +Subject: [PATCH 2/2] Makefile: Enable plugins installation in rootfs + +Upstream-Status: Submitted [https://github.com/linaro-swg/optee_examples/pull/87] + +Signed-off-by: Sumit Garg <[email protected]> +--- + Makefile | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/Makefile b/Makefile +index a275842..b3f16aa 100644 +--- a/Makefile ++++ b/Makefile +@@ -25,14 +25,19 @@ prepare-for-rootfs: examples + @mkdir -p $(OUTPUT_DIR) + @mkdir -p $(OUTPUT_DIR)/ta + @mkdir -p $(OUTPUT_DIR)/ca ++ @mkdir -p $(OUTPUT_DIR)/plugins + @for example in $(EXAMPLE_LIST); do \ + if [ -e $$example/host/optee_example_$$example ]; then \ + cp -p $$example/host/optee_example_$$example $(OUTPUT_DIR)/ca/; \ + fi; \ + cp -pr $$example/ta/*.ta $(OUTPUT_DIR)/ta/; \ ++ if [ $$example == plugins ]; then \ ++ cp -p plugins/syslog/*.plugin $(OUTPUT_DIR)/plugins/; \ ++ fi; \ + done + + prepare-for-rootfs-clean: + @rm -rf $(OUTPUT_DIR)/ta + @rm -rf $(OUTPUT_DIR)/ca ++ @rm -rf $(OUTPUT_DIR)/plugins + @rmdir --ignore-fail-on-non-empty $(OUTPUT_DIR) || test ! -e $(OUTPUT_DIR) +-- +2.25.1 +meta-arm/recipes-security/optee/optee-examples_3.11.0.bb deleted +0
-4@@ -1,4 +0,0 @@ -require optee-examples.inc - -SRCREV = "9a7dc598591990349d88b4dba3a37aadd6851295" -meta-arm/recipes-security/optee/optee-examples_3.14.0.bb new file +4
-0@@ -0,0 +1,4 @@ +require optee-examples.inc + +SRCREV = "e9c870525af8f7e7fccf575a0ca5394ce55adcec" +meta-arm/recipes-security/optee/optee-os/0001-libutils-provide-empty-__getauxval-implementation.patch deleted +0
-62@@ -1,62 +0,0 @@ -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 deleted +0
-55@@ -1,55 +0,0 @@ -Upstream-Status: Backport -Signed-off-by: Ross Burton <[email protected]> - -From 73196b58ea6978ffa5e581738030f51c5789ef73 Mon Sep 17 00:00:00 2001 -From: Volodymyr Babchuk <[email protected]> -Date: Tue, 13 Oct 2020 22:54:13 +0300 -Subject: [PATCH 2/3] link.mk: implement support for libnames-after-libgcc - variable - -Newer versions of libgcc depend on external __getauxval() symbol, which is -now provided by libutils. But libgcc is linked after libutils, so linker -can't resolve that symbol. We can't include libgcc into linking group with -libtutils, because libgcc provides symbols that conflict with libutil's -ones, like __aeabi_idiv with friends for instance. - -So, to resolve libgcc dependency on libutils we need to link with libutils -second time. To make things more generic, we will introduce -$(libnames-after-libgcc) variable for libraries that should be linked after -libgcc. - -Signed-off-by: Volodymyr Babchuk <[email protected]> -Reviewed-by: Jens Wiklander <[email protected]> -Reviewed-by: Jerome Forissier <[email protected]> ---- - ta/arch/arm/link.mk | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/ta/arch/arm/link.mk b/ta/arch/arm/link.mk -index 445c285d..3025acb1 100644 ---- a/ta/arch/arm/link.mk -+++ b/ta/arch/arm/link.mk -@@ -55,8 +55,11 @@ link-ldflags += --eh-frame-hdr - link-ldadd += $(libstdc++$(sm)) $(libgcc_eh$(sm)) - endif - link-ldadd += --end-group --ldargs-$(user-ta-uuid).elf := $(link-ldflags) $(objs) $(link-ldadd) $(libgcc$(sm)) - -+link-ldadd-after-libgcc += $(addprefix -l,$(libnames-after-libgcc)) -+ -+ldargs-$(user-ta-uuid).elf := $(link-ldflags) $(objs) $(link-ldadd) \ -+ $(libgcc$(sm)) $(link-ldadd-after-libgcc) - - link-script-cppflags-$(sm) := \ - $(filter-out $(CPPFLAGS_REMOVE) $(cppflags-remove), \ -@@ -76,6 +79,7 @@ $(link-script-pp$(sm)): $(link-script$(sm)) $(conf-file) $(link-script-pp-makefi - $(link-script-cppflags-$(sm)) $$< -o $$@ - - $(link-out-dir$(sm))/$(user-ta-uuid).elf: $(objs) $(libdeps) \ -+ $(libdeps-after-libgcc) \ - $(link-script-pp$(sm)) \ - $(dynlistdep) \ - $(additional-link-deps) --- -2.25.1 -meta-arm/recipes-security/optee/optee-os/0003-ta_dev_kit.mk-make-sure-that-libutils-is-linked-seco.patch deleted +0
-44@@ -1,44 +0,0 @@ -Upstream-Status: Backport -Signed-off-by: Ross Burton <[email protected]> - -From f50962e3f56f0932662b2ffa10afe53339a335dd Mon Sep 17 00:00:00 2001 -From: Volodymyr Babchuk <[email protected]> -Date: Fri, 16 Oct 2020 16:36:08 +0300 -Subject: [PATCH 3/3] ta_dev_kit.mk: make sure that libutils is linked second - time - -libgcc depends on __getauxval symbol from libuils. As, generally libutils -is linked before libgcc, we will get "unresolved symbol" error. To resolve -this dependency we need to link libutils second time - after libgcc. - -Signed-off-by: Volodymyr Babchuk <[email protected]> -Reviewed-by: Jens Wiklander <[email protected]> -Reviewed-by: Jerome Forissier <[email protected]> ---- - ta/mk/ta_dev_kit.mk | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/ta/mk/ta_dev_kit.mk b/ta/mk/ta_dev_kit.mk -index e28be677..d0e66317 100644 ---- a/ta/mk/ta_dev_kit.mk -+++ b/ta/mk/ta_dev_kit.mk -@@ -78,6 +78,16 @@ endif - libnames += dl - libdeps += $(ta-dev-kit-dir$(sm))/lib/libdl.a - -+# libutils provides __getauxval symbol which is needed by libgcc 10.x. We can't -+# link libutils after libgcc, because libgcc will replace some symbols provided -+# by libutils, which will cause further linking issues. -+# -+# But if we place libutils before libgcc, linker will not be able to resolve -+# __getauxval. So we need to link with libutils twice: before and after libgcc. -+# Hence it included both in $(libnames) and in $(libnames-after-libgcc) -+libnames-after-libgcc += utils -+libdeps-after-libgcc += $(ta-dev-kit-dir$(sm))/lib/libutils.a -+ - # Pass config variable (CFG_) from conf.mk on the command line - cppflags$(sm) += $(strip \ - $(foreach var, $(filter CFG_%,$(.VARIABLES)), \ --- -2.25.1 -meta-arm/recipes-security/optee/optee-os_3.11.0.bb deleted +0
-11@@ -1,11 +0,0 @@ -require optee-os.inc - -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 \ -"meta-arm/recipes-security/optee/optee-os_3.14.0.bb new file +8
-0@@ -0,0 +1,8 @@ +require optee-os.inc + +SRCREV = "d21befa5e53eae9db469eba1685f5aa5c6f92c2f" + +SRC_URI_append = " \ + file://0006-allow-setting-sysroot-for-libgcc-lookup.patch \ + file://0007-allow-setting-sysroot-for-clang.patch \ +"meta-arm/recipes-security/optee/optee-test.inc +6
-9@@ -8,17 +8,9 @@ LIC_FILES_CHKSUM = "file://${S}/LICENSE.md;md5=daa2bcccc666345ab8940aab1315a4fa" inherit python3native ptest require optee.inc -# Linking fails on musl due to C++/threads -# https://github.com/OP-TEE/optee_test/issues/458#issuecomment-720540834 -# When upgraded we should be able to remove this limitation -COMPATIBLE_HOST_libc-musl = 'null' - DEPENDS = "optee-client optee-os python3-pycryptodome-native" SRC_URI = "git://github.com/OP-TEE/optee_test.git \ - file://0001-host-xtest-Adjust-order-of-including-compiler.h.patch \ - file://0002-make-remove-Wno-unsafe-loop-for-clang.patch \ - file://0003-make-remove-Wmissing-noreturn-for-clang.patch \ file://run-ptest \ "@@ -36,6 +28,7 @@ do_compile() { # Top level makefile doesn't seem to handle parallel make gracefully oe_runmake xtest oe_runmake ta + oe_runmake test_plugin } do_compile[cleandirs] = "${B}"@@ -46,9 +39,13 @@ do_install () { # default TEEC_LOAD_PATH is /lib mkdir -p ${D}${nonarch_base_libdir}/optee_armtz/ install -D -p -m0444 ${B}/ta/*/*.ta ${D}${nonarch_base_libdir}/optee_armtz/ + mkdir -p ${D}${libdir}/tee-supplicant/plugins + install -D -p -m0444 ${B}/supp_plugin/*.plugin ${D}${libdir}/tee-supplicant/plugins/ } -FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/" +FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/ \ + ${libdir}/tee-supplicant/plugins/ \ + " # Imports machine specific configs from staging to build PACKAGE_ARCH = "${MACHINE_ARCH}"meta-arm/recipes-security/optee/optee-test/0001-host-xtest-Adjust-order-of-including-compiler.h.patch deleted +0
-64@@ -1,64 +0,0 @@ -From fc95b3ccbbfd336797ae2cfd6dd4dc58644e146f Mon Sep 17 00:00:00 2001 -From: Khem Raj <[email protected]> -Date: Sat, 30 May 2020 17:52:18 -0700 -Subject: [PATCH] host/xtest: Adjust order of including compiler.h - -compiler.h defines some defines which violate libc namespace e.g. -__unused, this works ok with glibc but fails in awkward ways with musl -the reason is musl uses __unused in its internal structures and this -define in compiler.h conflicts with system headers causing errors like - -recipe-sysroot/usr/include/bits/stat.h:17:19: error: expected identifier or '(' before '[' token unsigned __unused[2]; - ^ -including compiler.h afer sys/stat.h fixes the problem. - -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 +- - host/xtest/stats.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/host/xtest/install_ta.c b/host/xtest/install_ta.c -index 09a4c6d..6f7bb5c 100644 ---- a/host/xtest/install_ta.c -+++ b/host/xtest/install_ta.c -@@ -4,7 +4,6 @@ - * SPDX-License-Identifier: BSD-2-Clause - */ - --#include <compiler.h> - #include <dirent.h> - #include <err.h> - #include <errno.h> -@@ -20,6 +19,7 @@ - #include <sys/types.h> - #include <tee_client_api.h> - #include <unistd.h> -+#include <compiler.h> - - #include "install_ta.h" - #include "xtest_helpers.h" -diff --git a/host/xtest/stats.c b/host/xtest/stats.c -index 96b0b5f..db9bf25 100644 ---- a/host/xtest/stats.c -+++ b/host/xtest/stats.c -@@ -3,7 +3,6 @@ - * Copyright (c) 2019, Linaro Limited - */ - --#include <compiler.h> - #include <dirent.h> - #include <err.h> - #include <errno.h> -@@ -18,6 +17,7 @@ - #include <sys/types.h> - #include <tee_client_api.h> - #include <unistd.h> -+#include <compiler.h> - #include "xtest_test.h" - #include "stats.h" - --- -2.26.2 -meta-arm/recipes-security/optee/optee-test/0002-make-remove-Wno-unsafe-loop-for-clang.patch deleted +0
-31@@ -1,31 +0,0 @@ -From 438533ce9da1df0b7c7914e64b39ffdc1da1ab79 Mon Sep 17 00:00:00 2001 -From: Brett Warren <[email protected]> -Date: Thu, 8 Oct 2020 10:03:25 +0100 -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 [https://github.com/OP-TEE/optee_test/issues/452] -Changed-Id: 71cb511904547d790d1ea98f93bf8e5a6afcb36d -Signed-off-by: Brett Warren <[email protected]> ---- - host/xtest/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/host/xtest/Makefile b/host/xtest/Makefile -index 3c206b0..96746de 100644 ---- a/host/xtest/Makefile -+++ b/host/xtest/Makefile -@@ -169,7 +169,7 @@ CFLAGS += -Wall -Wcast-align -Werror \ - -Werror-implicit-function-declaration -Wextra -Wfloat-equal \ - -Wformat-nonliteral -Wformat-security -Wformat=2 -Winit-self \ - -Wmissing-declarations -Wmissing-format-attribute \ -- -Wmissing-include-dirs -Wmissing-noreturn \ -+ -Wmissing-include-dirs \ - -Wmissing-prototypes -Wnested-externs -Wpointer-arith \ - -Wshadow -Wstrict-prototypes -Wswitch-default \ - -Wwrite-strings \ --- -2.17.1 -meta-arm/recipes-security/optee/optee-test/0003-make-remove-Wmissing-noreturn-for-clang.patch deleted +0
-31@@ -1,31 +0,0 @@ -From ed5a9d9f7a3e9e14ca0e8aea59008124ee0e5f96 Mon Sep 17 00:00:00 2001 -From: Brett Warren <[email protected]> -Date: Thu, 8 Oct 2020 10:20:52 +0100 -Subject: [PATCH] make: remove -Wno-unsafe-loop for clang - -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 [https://github.com/OP-TEE/optee_test/issues/452] -Change-Id: 5fe0892c73208aaffac8c9995cb3275936fb1ba6 -Signed-off-by: Brett Warren <[email protected]> ---- - host/xtest/Makefile | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/host/xtest/Makefile b/host/xtest/Makefile -index 96746de..73731d0 100644 ---- a/host/xtest/Makefile -+++ b/host/xtest/Makefile -@@ -174,7 +174,6 @@ CFLAGS += -Wall -Wcast-align -Werror \ - -Wshadow -Wstrict-prototypes -Wswitch-default \ - -Wwrite-strings \ - -Wno-declaration-after-statement \ -- -Wno-unsafe-loop-optimizations \ - -Wno-missing-field-initializers -Wno-format-zero-length - endif - --- -2.17.1 -meta-arm/recipes-security/optee/optee-test_3.11.0.bb deleted +0
-3@@ -1,3 +0,0 @@ -require optee-test.inc - -SRCREV = "159e295d5cc3ad2275ab15fe544620f6604d4ba4"meta-arm/recipes-security/optee/optee-test_3.14.0.bb new file +3
-1@@ -0,0 +1,3 @@ +require optee-test.inc + +SRCREV = "f2eb88affbb7f028561b4fd5cbd049d5d704f741" --2.25.1
Quoted 14 lines · Sumit Garg
Hi Ross,
Quoted 9 lines · Ross Burton
The optee-examples recipe is broken:
install: cannot stat '/builds/engineering/yocto/meta-arm/work/build/tmp/work/qemuarm64_secureboot-poky-linux/optee-examples/3.14.0-r0/build/plugins/*':
No such file or directory(qemuarm64-secureboot can build it)
Quoted 7 lines
Strangely, it works fine for me when building for qemuarm64-secureboot. Can you check if the following patches have been correctly applied in the corresponding work directory?
file://0001-plugins-Honour-default-cross-compiler-environment-se.patch
\ file://0002-Makefile-Enable-plugins-installation-in-rootfs.patch \
I'm seeing the same issue Ross is describing. I would expect a warning or error if it couldn't find the patches while building, not when installing. Can you confirm you are building optee-examples, in addition to core-image-minimal/base?
See https://gitlab.com/jonmason00/meta-arm/-/jobs/1444856281#L3594
Looks to me like the issue is with newly added line
https://gitlab.com/jonmason00/meta-arm/-/blob/master-next/meta-arm/recipes-security/optee/optee-examples.inc#L39
Thanks,
Jon
Quoted 795 lines
-Sumit
Quoted 789 lines
Ross
Quoted 786 lines · Sumit Garg
Brief description of changes:
- Version uplift 3.11.0 -> 3.14.0.
- Removed OP-TEE patches that has already been accepted upstream.
- Added support for tee-supplicant plugin framework testing.Tested on
qemuarm64_secureboot:$ xtest -l 15 $ optee-examples_*Signed-off-by Sumit Garg <[email protected]>--- .../optee/optee-client_3.11.0.bb | 3 - .../optee/optee-client_3.14.0.bb | 3 + .../recipes-security/optee/optee-examples.inc | 9 +- .../0001-make-Pass-ldflags-during-link.patch | 103 ------------------ ...efault-cross-compiler-environment-se.patch | 84 ++++++++++++++ ...nable-plugins-installation-in-rootfs.patch | 39 +++++++ .../optee/optee-examples_3.11.0.bb | 4 - .../optee/optee-examples_3.14.0.bb | 4 + ...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 | 11 -- .../recipes-security/optee/optee-os_3.14.0.bb | 8 ++ .../recipes-security/optee/optee-test.inc | 15 +-- ...Adjust-order-of-including-compiler.h.patch | 64 ----------- ...ake-remove-Wno-unsafe-loop-for-clang.patch | 31 ------ ...e-remove-Wmissing-noreturn-for-clang.patch | 31 ------ .../optee/optee-test_3.11.0.bb | 3 - .../optee/optee-test_3.14.0.bb | 3 + 19 files changed, 154 insertions(+), 422 deletions(-) delete mode 100644 meta-arm/recipes-security/optee/optee-client_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-client_3.14.0.bb delete mode 100644 meta-arm/recipes-security/optee/optee-examples/0001-make-Pass-ldflags-during-link.patch create mode 100644 meta-arm/recipes-security/optee/optee-examples/0001-plugins-Honour-default-cross-compiler-environment-se.patch create mode 100644 meta-arm/recipes-security/optee/optee-examples/0002-Makefile-Enable-plugins-installation-in-rootfs.patch delete mode 100644 meta-arm/recipes-security/optee/optee-examples_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-examples_3.14.0.bb delete mode 100644 meta-arm/recipes-security/optee/optee-os/0001-libutils-provide-empty-__getauxval-implementation.patch delete mode 100644 meta-arm/recipes-security/optee/optee-os/0002-link.mk-implement-support-for-libnames-after-libgcc-.patch delete mode 100644 meta-arm/recipes-security/optee/optee-os/0003-ta_dev_kit.mk-make-sure-that-libutils-is-linked-seco.patch delete mode 100644 meta-arm/recipes-security/optee/optee-os_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-os_3.14.0.bb delete mode 100644 meta-arm/recipes-security/optee/optee-test/0001-host-xtest-Adjust-order-of-including-compiler.h.patch delete mode 100644 meta-arm/recipes-security/optee/optee-test/0002-make-remove-Wno-unsafe-loop-for-clang.patch delete mode 100644 meta-arm/recipes-security/optee/optee-test/0003-make-remove-Wmissing-noreturn-for-clang.patch delete mode 100644 meta-arm/recipes-security/optee/optee-test_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-test_3.14.0.bbmeta-arm/recipes-security/optee/optee-client_3.11.0.bb deleted +0
-3@@ -1,3 +0,0 @@ -require optee-client.inc - -SRCREV = "c0c925384c1d7e3558d27d2708857482952d7907"meta-arm/recipes-security/optee/optee-client_3.14.0.bb new file +3
-0@@ -0,0 +1,3 @@ +require optee-client.inc + +SRCREV = "06e1b32f6a7028e039c625b07cfc25fda0c17d53"meta-arm/recipes-security/optee/optee-examples.inc +7
-2@@ -12,7 +12,8 @@ inherit python3native require optee.inc SRC_URI = "git://github.com/linaro-swg/optee_examples.git \ - file://0001-make-Pass-ldflags-during-link.patch \ + file://0001-plugins-Honour-default-cross-compiler-environment-se.patch \ + file://0002-Makefile-Enable-plugins-installation-in-rootfs.patch \ " EXTRA_OEMAKE += "TA_DEV_KIT_DIR=${TA_DEV_KIT_DIR} \@@ -32,11 +33,15 @@ do_compile[cleandirs] = "${B}" do_install () { mkdir -p ${D}${nonarch_base_libdir}/optee_armtz mkdir -p ${D}${bindir} + mkdir -p ${D}${libdir}/tee-supplicant/plugins install -D -p -m0755 ${B}/ca/* ${D}${bindir} install -D -p -m0444 ${B}/ta/* ${D}${nonarch_base_libdir}/optee_armtz + install -D -p -m0444 ${B}/plugins/* ${D}${libdir}/tee-supplicant/plugins } -FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/" +FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/ \ + ${libdir}/tee-supplicant/plugins/ \ + " # Imports machine specific configs from staging to build PACKAGE_ARCH = "${MACHINE_ARCH}"meta-arm/recipes-security/optee/optee-examples/0001-make-Pass-ldflags-during-link.patch deleted +0
-103@@ -1,103 +0,0 @@ -From 29ae21de41f2fbab6dbecbbf408826b28de82df1 Mon Sep 17 00:00:00 2001 -From: Khem Raj <[email protected]> -Date: Tue, 1 Sep 2020 21:09:56 -0700 -Subject: [PATCH] make: Pass ldflags during link - -OpenEmbeeded needs to pass essential linker flags to set correct flags -for gnu_hash among others which sets the linking straight -using LDFLAGS varible here means, we can affect the linker flags -from build environment - -Upstream-Status: Submitted [https://github.com/linaro-swg/optee_examples/pull/85] - -Signed-off-by: Khem Raj <[email protected]> ---- - acipher/host/Makefile | 2 +- - aes/host/Makefile | 2 +- - hello_world/host/Makefile | 2 +- - hotp/host/Makefile | 2 +- - random/host/Makefile | 2 +- - secure_storage/host/Makefile | 2 +- - 6 files changed, 6 insertions(+), 6 deletions(-) - -diff --git a/acipher/host/Makefile b/acipher/host/Makefile -index 8f4bc8a..c2cabef 100644 ---- a/acipher/host/Makefile -+++ b/acipher/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_acipher - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/aes/host/Makefile b/aes/host/Makefile -index dfeb4e8..f61c71b 100644 ---- a/aes/host/Makefile -+++ b/aes/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_aes - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/hello_world/host/Makefile b/hello_world/host/Makefile -index c4c8239..69cf42c 100644 ---- a/hello_world/host/Makefile -+++ b/hello_world/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_hello_world - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/hotp/host/Makefile b/hotp/host/Makefile -index cb7fd19..e7f013f 100644 ---- a/hotp/host/Makefile -+++ b/hotp/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_hotp - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/random/host/Makefile b/random/host/Makefile -index fd407d9..9377f7a 100644 ---- a/random/host/Makefile -+++ b/random/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_random - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/secure_storage/host/Makefile b/secure_storage/host/Makefile -index 29bfb87..b3265ae 100644 ---- a/secure_storage/host/Makefile -+++ b/secure_storage/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_secure_storage - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: --- -2.28.0 -meta-arm/recipes-security/optee/optee-examples/0001-plugins-Honour-default-cross-compiler-environment-se.patch new file +84
-0@@ -0,0 +1,84 @@ +From 79c826c249001700007a6dffe80c3d61ff4428ef Mon Sep 17 00:00:00 2001 +From: Sumit Garg <[email protected]> +Date: Tue, 20 Jul 2021 13:54:30 +0530 +Subject: [PATCH 1/2] plugins: Honour default cross compiler environment setup + +Honour default $(CC), $(CFLAGS) and $(LDFLAGS) variables. Without this +plugins example fails to build for OE/Yocto. + +Upstream-Status: Submitted [https://github.com/linaro-swg/optee_examples/pull/87] + +Signed-off-by: Sumit Garg <[email protected]> +--- + plugins/Makefile | 2 +- + plugins/host/Makefile | 2 +- + plugins/syslog/Makefile | 16 ++++++++++++---- + 3 files changed, 14 insertions(+), 6 deletions(-) + +diff --git a/plugins/Makefile b/plugins/Makefile +index 2372b38..ea472b4 100644 +--- a/plugins/Makefile ++++ b/plugins/Makefile +@@ -8,7 +8,7 @@ TA_CROSS_COMPILE ?= $(CROSS_COMPILE) + all: + $(MAKE) -C host CROSS_COMPILE="$(HOST_CROSS_COMPILE)" --no-builtin-variables + $(MAKE) -C ta CROSS_COMPILE="$(TA_CROSS_COMPILE)" LDFLAGS="" +- $(MAKE) -C syslog CROSS_COMPILE="$(HOST_CROSS_COMPILE)" ++ $(MAKE) -C syslog CROSS_COMPILE="$(HOST_CROSS_COMPILE)" --no-builtin-variables + + .PHONY: clean + clean: +diff --git a/plugins/host/Makefile b/plugins/host/Makefile +index 7285104..76244c7 100644 +--- a/plugins/host/Makefile ++++ b/plugins/host/Makefile +@@ -20,7 +20,7 @@ BINARY = optee_example_plugins + all: $(BINARY) + + $(BINARY): $(OBJS) +- $(CC) -o $@ $< $(LDADD) ++ $(CC) $(LDFLAGS) -o $@ $< $(LDADD) + + .PHONY: clean + clean: +diff --git a/plugins/syslog/Makefile b/plugins/syslog/Makefile +index 62d916a..71f5f92 100644 +--- a/plugins/syslog/Makefile ++++ b/plugins/syslog/Makefile +@@ -1,3 +1,11 @@ ++CC ?= $(CROSS_COMPILE)gcc ++LD ?= $(CROSS_COMPILE)ld ++AR ?= $(CROSS_COMPILE)ar ++NM ?= $(CROSS_COMPILE)nm ++OBJCOPY ?= $(CROSS_COMPILE)objcopy ++OBJDUMP ?= $(CROSS_COMPILE)objdump ++READELF ?= $(CROSS_COMPILE)readelf ++ + PLUGIN_UUID = 96bcf744-4f72-4866-bf1d-8634fd9c65e5 + + PLUGIN = $(PLUGIN_UUID).plugin +@@ -6,17 +14,17 @@ PLUGIN_OBJ = $(patsubst %.c, %.o, $(PLUGIN_SRS)) + PLUGIN_INCLUDES_DIR = $(CURDIR) $(TEEC_EXPORT)/include + + PLUGIN_INCLUDES = $(addprefix -I, $(PLUGIN_INCLUDES_DIR)) +-PLUGIN_CCFLAGS = -Wall -fPIC +-PLUGIN_LDFLAGS = -shared ++PLUGIN_CCFLAGS = $(CFLAGS) -Wall -fPIC ++PLUGIN_LDFLAGS = $(LDFLAGS) -shared + + .PHONY: all + all: $(PLUGIN) + + $(PLUGIN): $(PLUGIN_OBJ) +- $(CROSS_COMPILE)gcc $(PLUGIN_LDFLAGS) $(PLUGIN_OBJ) -o $@ ++ $(CC) $(PLUGIN_LDFLAGS) $(PLUGIN_OBJ) -o $@ + + %.o: %.c +- $(CROSS_COMPILE)gcc $(PLUGIN_CCFLAGS) $(PLUGIN_INCLUDES) -c $*.c -o $*.o ++ $(CC) $(PLUGIN_CCFLAGS) $(PLUGIN_INCLUDES) -c $*.c -o $*.o + + .PHONY: clean + clean: +-- +2.25.1 +meta-arm/recipes-security/optee/optee-examples/0002-Makefile-Enable-plugins-installation-in-rootfs.patch new file +39
-0@@ -0,0 +1,39 @@ +From a865f2e25e178fc2c4617eb1faf79ac922d02ffd Mon Sep 17 00:00:00 2001 +From: Sumit Garg <[email protected]> +Date: Tue, 20 Jul 2021 14:20:10 +0530 +Subject: [PATCH 2/2] Makefile: Enable plugins installation in rootfs + +Upstream-Status: Submitted [https://github.com/linaro-swg/optee_examples/pull/87] + +Signed-off-by: Sumit Garg <[email protected]> +--- + Makefile | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/Makefile b/Makefile +index a275842..b3f16aa 100644 +--- a/Makefile ++++ b/Makefile +@@ -25,14 +25,19 @@ prepare-for-rootfs: examples + @mkdir -p $(OUTPUT_DIR) + @mkdir -p $(OUTPUT_DIR)/ta + @mkdir -p $(OUTPUT_DIR)/ca ++ @mkdir -p $(OUTPUT_DIR)/plugins + @for example in $(EXAMPLE_LIST); do \ + if [ -e $$example/host/optee_example_$$example ]; then \ + cp -p $$example/host/optee_example_$$example $(OUTPUT_DIR)/ca/; \ + fi; \ + cp -pr $$example/ta/*.ta $(OUTPUT_DIR)/ta/; \ ++ if [ $$example == plugins ]; then \ ++ cp -p plugins/syslog/*.plugin $(OUTPUT_DIR)/plugins/; \ ++ fi; \ + done + + prepare-for-rootfs-clean: + @rm -rf $(OUTPUT_DIR)/ta + @rm -rf $(OUTPUT_DIR)/ca ++ @rm -rf $(OUTPUT_DIR)/plugins + @rmdir --ignore-fail-on-non-empty $(OUTPUT_DIR) || test ! -e $(OUTPUT_DIR) +-- +2.25.1 +meta-arm/recipes-security/optee/optee-examples_3.11.0.bb deleted +0
-4@@ -1,4 +0,0 @@ -require optee-examples.inc - -SRCREV = "9a7dc598591990349d88b4dba3a37aadd6851295" -meta-arm/recipes-security/optee/optee-examples_3.14.0.bb new file +4
-0@@ -0,0 +1,4 @@ +require optee-examples.inc + +SRCREV = "e9c870525af8f7e7fccf575a0ca5394ce55adcec" +meta-arm/recipes-security/optee/optee-os/0001-libutils-provide-empty-__getauxval-implementation.patch deleted +0
-62@@ -1,62 +0,0 @@ -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 deleted +0
-55@@ -1,55 +0,0 @@ -Upstream-Status: Backport -Signed-off-by: Ross Burton <[email protected]> - -From 73196b58ea6978ffa5e581738030f51c5789ef73 Mon Sep 17 00:00:00 2001 -From: Volodymyr Babchuk <[email protected]> -Date: Tue, 13 Oct 2020 22:54:13 +0300 -Subject: [PATCH 2/3] link.mk: implement support for libnames-after-libgcc - variable - -Newer versions of libgcc depend on external __getauxval() symbol, which is -now provided by libutils. But libgcc is linked after libutils, so linker -can't resolve that symbol. We can't include libgcc into linking group with -libtutils, because libgcc provides symbols that conflict with libutil's -ones, like __aeabi_idiv with friends for instance. - -So, to resolve libgcc dependency on libutils we need to link with libutils -second time. To make things more generic, we will introduce -$(libnames-after-libgcc) variable for libraries that should be linked after -libgcc. - -Signed-off-by: Volodymyr Babchuk <[email protected]> -Reviewed-by: Jens Wiklander <[email protected]> -Reviewed-by: Jerome Forissier <[email protected]> ---- - ta/arch/arm/link.mk | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/ta/arch/arm/link.mk b/ta/arch/arm/link.mk -index 445c285d..3025acb1 100644 ---- a/ta/arch/arm/link.mk -+++ b/ta/arch/arm/link.mk -@@ -55,8 +55,11 @@ link-ldflags += --eh-frame-hdr - link-ldadd += $(libstdc++$(sm)) $(libgcc_eh$(sm)) - endif - link-ldadd += --end-group --ldargs-$(user-ta-uuid).elf := $(link-ldflags) $(objs) $(link-ldadd) $(libgcc$(sm)) - -+link-ldadd-after-libgcc += $(addprefix -l,$(libnames-after-libgcc)) -+ -+ldargs-$(user-ta-uuid).elf := $(link-ldflags) $(objs) $(link-ldadd) \ -+ $(libgcc$(sm)) $(link-ldadd-after-libgcc) - - link-script-cppflags-$(sm) := \ - $(filter-out $(CPPFLAGS_REMOVE) $(cppflags-remove), \ -@@ -76,6 +79,7 @@ $(link-script-pp$(sm)): $(link-script$(sm)) $(conf-file) $(link-script-pp-makefi - $(link-script-cppflags-$(sm)) $$< -o $$@ - - $(link-out-dir$(sm))/$(user-ta-uuid).elf: $(objs) $(libdeps) \ -+ $(libdeps-after-libgcc) \ - $(link-script-pp$(sm)) \ - $(dynlistdep) \ - $(additional-link-deps) --- -2.25.1 -meta-arm/recipes-security/optee/optee-os/0003-ta_dev_kit.mk-make-sure-that-libutils-is-linked-seco.patch deleted +0
-44@@ -1,44 +0,0 @@ -Upstream-Status: Backport -Signed-off-by: Ross Burton <[email protected]> - -From f50962e3f56f0932662b2ffa10afe53339a335dd Mon Sep 17 00:00:00 2001 -From: Volodymyr Babchuk <[email protected]> -Date: Fri, 16 Oct 2020 16:36:08 +0300 -Subject: [PATCH 3/3] ta_dev_kit.mk: make sure that libutils is linked second - time - -libgcc depends on __getauxval symbol from libuils. As, generally libutils -is linked before libgcc, we will get "unresolved symbol" error. To resolve -this dependency we need to link libutils second time - after libgcc. - -Signed-off-by: Volodymyr Babchuk <[email protected]> -Reviewed-by: Jens Wiklander <[email protected]> -Reviewed-by: Jerome Forissier <[email protected]> ---- - ta/mk/ta_dev_kit.mk | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/ta/mk/ta_dev_kit.mk b/ta/mk/ta_dev_kit.mk -index e28be677..d0e66317 100644 ---- a/ta/mk/ta_dev_kit.mk -+++ b/ta/mk/ta_dev_kit.mk -@@ -78,6 +78,16 @@ endif - libnames += dl - libdeps += $(ta-dev-kit-dir$(sm))/lib/libdl.a - -+# libutils provides __getauxval symbol which is needed by libgcc 10.x. We can't -+# link libutils after libgcc, because libgcc will replace some symbols provided -+# by libutils, which will cause further linking issues. -+# -+# But if we place libutils before libgcc, linker will not be able to resolve -+# __getauxval. So we need to link with libutils twice: before and after libgcc. -+# Hence it included both in $(libnames) and in $(libnames-after-libgcc) -+libnames-after-libgcc += utils -+libdeps-after-libgcc += $(ta-dev-kit-dir$(sm))/lib/libutils.a -+ - # Pass config variable (CFG_) from conf.mk on the command line - cppflags$(sm) += $(strip \ - $(foreach var, $(filter CFG_%,$(.VARIABLES)), \ --- -2.25.1 -meta-arm/recipes-security/optee/optee-os_3.11.0.bb deleted +0
-11@@ -1,11 +0,0 @@ -require optee-os.inc - -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 \ -"meta-arm/recipes-security/optee/optee-os_3.14.0.bb new file +8
-0@@ -0,0 +1,8 @@ +require optee-os.inc + +SRCREV = "d21befa5e53eae9db469eba1685f5aa5c6f92c2f" + +SRC_URI_append = " \ + file://0006-allow-setting-sysroot-for-libgcc-lookup.patch \ + file://0007-allow-setting-sysroot-for-clang.patch \ +"meta-arm/recipes-security/optee/optee-test.inc +6
-9@@ -8,17 +8,9 @@ LIC_FILES_CHKSUM = "file://${S}/LICENSE.md;md5=daa2bcccc666345ab8940aab1315a4fa" inherit python3native ptest require optee.inc -# Linking fails on musl due to C++/threads -# https://github.com/OP-TEE/optee_test/issues/458#issuecomment-720540834 -# When upgraded we should be able to remove this limitation -COMPATIBLE_HOST_libc-musl = 'null' - DEPENDS = "optee-client optee-os python3-pycryptodome-native" SRC_URI = "git://github.com/OP-TEE/optee_test.git \ - file://0001-host-xtest-Adjust-order-of-including-compiler.h.patch \ - file://0002-make-remove-Wno-unsafe-loop-for-clang.patch \ - file://0003-make-remove-Wmissing-noreturn-for-clang.patch \ file://run-ptest \ "@@ -36,6 +28,7 @@ do_compile() { # Top level makefile doesn't seem to handle parallel make gracefully oe_runmake xtest oe_runmake ta + oe_runmake test_plugin } do_compile[cleandirs] = "${B}"@@ -46,9 +39,13 @@ do_install () { # default TEEC_LOAD_PATH is /lib mkdir -p ${D}${nonarch_base_libdir}/optee_armtz/ install -D -p -m0444 ${B}/ta/*/*.ta ${D}${nonarch_base_libdir}/optee_armtz/ + mkdir -p ${D}${libdir}/tee-supplicant/plugins + install -D -p -m0444 ${B}/supp_plugin/*.plugin ${D}${libdir}/tee-supplicant/plugins/ } -FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/" +FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/ \ + ${libdir}/tee-supplicant/plugins/ \ + " # Imports machine specific configs from staging to build PACKAGE_ARCH = "${MACHINE_ARCH}"meta-arm/recipes-security/optee/optee-test/0001-host-xtest-Adjust-order-of-including-compiler.h.patch deleted +0
-64@@ -1,64 +0,0 @@ -From fc95b3ccbbfd336797ae2cfd6dd4dc58644e146f Mon Sep 17 00:00:00 2001 -From: Khem Raj <[email protected]> -Date: Sat, 30 May 2020 17:52:18 -0700 -Subject: [PATCH] host/xtest: Adjust order of including compiler.h - -compiler.h defines some defines which violate libc namespace e.g. -__unused, this works ok with glibc but fails in awkward ways with musl -the reason is musl uses __unused in its internal structures and this -define in compiler.h conflicts with system headers causing errors like - -recipe-sysroot/usr/include/bits/stat.h:17:19: error: expected identifier or '(' before '[' token unsigned __unused[2]; - ^ -including compiler.h afer sys/stat.h fixes the problem. - -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 +- - host/xtest/stats.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/host/xtest/install_ta.c b/host/xtest/install_ta.c -index 09a4c6d..6f7bb5c 100644 ---- a/host/xtest/install_ta.c -+++ b/host/xtest/install_ta.c -@@ -4,7 +4,6 @@ - * SPDX-License-Identifier: BSD-2-Clause - */ - --#include <compiler.h> - #include <dirent.h> - #include <err.h> - #include <errno.h> -@@ -20,6 +19,7 @@ - #include <sys/types.h> - #include <tee_client_api.h> - #include <unistd.h> -+#include <compiler.h> - - #include "install_ta.h" - #include "xtest_helpers.h" -diff --git a/host/xtest/stats.c b/host/xtest/stats.c -index 96b0b5f..db9bf25 100644 ---- a/host/xtest/stats.c -+++ b/host/xtest/stats.c -@@ -3,7 +3,6 @@ - * Copyright (c) 2019, Linaro Limited - */ - --#include <compiler.h> - #include <dirent.h> - #include <err.h> - #include <errno.h> -@@ -18,6 +17,7 @@ - #include <sys/types.h> - #include <tee_client_api.h> - #include <unistd.h> -+#include <compiler.h> - #include "xtest_test.h" - #include "stats.h" - --- -2.26.2 -meta-arm/recipes-security/optee/optee-test/0002-make-remove-Wno-unsafe-loop-for-clang.patch deleted +0
-31@@ -1,31 +0,0 @@ -From 438533ce9da1df0b7c7914e64b39ffdc1da1ab79 Mon Sep 17 00:00:00 2001 -From: Brett Warren <[email protected]> -Date: Thu, 8 Oct 2020 10:03:25 +0100 -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 [https://github.com/OP-TEE/optee_test/issues/452] -Changed-Id: 71cb511904547d790d1ea98f93bf8e5a6afcb36d -Signed-off-by: Brett Warren <[email protected]> ---- - host/xtest/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/host/xtest/Makefile b/host/xtest/Makefile -index 3c206b0..96746de 100644 ---- a/host/xtest/Makefile -+++ b/host/xtest/Makefile -@@ -169,7 +169,7 @@ CFLAGS += -Wall -Wcast-align -Werror \ - -Werror-implicit-function-declaration -Wextra -Wfloat-equal \ - -Wformat-nonliteral -Wformat-security -Wformat=2 -Winit-self \ - -Wmissing-declarations -Wmissing-format-attribute \ -- -Wmissing-include-dirs -Wmissing-noreturn \ -+ -Wmissing-include-dirs \ - -Wmissing-prototypes -Wnested-externs -Wpointer-arith \ - -Wshadow -Wstrict-prototypes -Wswitch-default \ - -Wwrite-strings \ --- -2.17.1 -meta-arm/recipes-security/optee/optee-test/0003-make-remove-Wmissing-noreturn-for-clang.patch deleted +0
-31@@ -1,31 +0,0 @@ -From ed5a9d9f7a3e9e14ca0e8aea59008124ee0e5f96 Mon Sep 17 00:00:00 2001 -From: Brett Warren <[email protected]> -Date: Thu, 8 Oct 2020 10:20:52 +0100 -Subject: [PATCH] make: remove -Wno-unsafe-loop for clang - -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 [https://github.com/OP-TEE/optee_test/issues/452] -Change-Id: 5fe0892c73208aaffac8c9995cb3275936fb1ba6 -Signed-off-by: Brett Warren <[email protected]> ---- - host/xtest/Makefile | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/host/xtest/Makefile b/host/xtest/Makefile -index 96746de..73731d0 100644 ---- a/host/xtest/Makefile -+++ b/host/xtest/Makefile -@@ -174,7 +174,6 @@ CFLAGS += -Wall -Wcast-align -Werror \ - -Wshadow -Wstrict-prototypes -Wswitch-default \ - -Wwrite-strings \ - -Wno-declaration-after-statement \ -- -Wno-unsafe-loop-optimizations \ - -Wno-missing-field-initializers -Wno-format-zero-length - endif - --- -2.17.1 -meta-arm/recipes-security/optee/optee-test_3.11.0.bb deleted +0
-3@@ -1,3 +0,0 @@ -require optee-test.inc - -SRCREV = "159e295d5cc3ad2275ab15fe544620f6604d4ba4"meta-arm/recipes-security/optee/optee-test_3.14.0.bb new file +3
-1@@ -0,0 +1,3 @@ +require optee-test.inc + +SRCREV = "f2eb88affbb7f028561b4fd5cbd049d5d704f741" --2.25.1
Hi Jon,
Quoted 20 lines · Jon Mason
Quoted 18 lines · Sumit Garg
Hi Ross,
Quoted 9 lines · Ross Burton
The optee-examples recipe is broken:
install: cannot stat '/builds/engineering/yocto/meta-arm/work/build/tmp/work/qemuarm64_secureboot-poky-linux/optee-examples/3.14.0-r0/build/plugins/*':
No such file or directory(qemuarm64-secureboot can build it)
Strangely, it works fine for me when building for qemuarm64-secureboot. Can you check if the following patches have been correctly applied in the corresponding work directory?
Quoted 7 lines
Quoted 3 lines
file://0001-plugins-Honour-default-cross-compiler-environment-se.patch
\ file://0002-Makefile-Enable-plugins-installation-in-rootfs.patch \I'm seeing the same issue Ross is describing. I would expect a warning or error if it couldn't find the patches while building, not when installing.
Yeah you are correct but I am not able to figure the reason for this behaviour.
Quoted 4 lines
Can you confirm you are building optee-examples, in addition to core-image-minimal/base?
See https://gitlab.com/jonmason00/meta-arm/-/jobs/1444856281#L3594
Yeah I am building optee-examples in addition to core-image-minimal/base.
- Changes to default poky conf/local.conf:
MACHINE = "qemuarm64-secureboot" CORE_IMAGE_EXTRA_INSTALL += "optee-examples optee-test"
- Changes to default poky conf/bblayers.conf with additional layers as:
meta-arm/meta-arm-toolchain
meta-arm/meta-arm
Here is optee-examples build folder directory structure for me:
$ tree tmp/work/qemuarm64_secureboot-poky-linux/optee-examples/3.14.0-r0/build/
tmp/work/qemuarm64_secureboot-poky-linux/optee-examples/3.14.0-r0/build/
├── ca
│ ├── optee_example_acipher
│ ├── optee_example_aes
│ ├── optee_example_hello_world
│ ├── optee_example_hotp
│ ├── optee_example_plugins
│ ├── optee_example_random
│ └── optee_example_secure_storage
├── plugins
│ └── 96bcf744-4f72-4866-bf1d-8634fd9c65e5.plugin
└── ta
├── 2a287631-de1b-4fdd-a55c-b9312e40769a.ta
├── 484d4143-2d53-4841-3120-4a6f636b6542.ta
├── 5dbac793-f574-4871-8ad3-04331ec17f24.ta
├── 8aaaf200-2450-11e4-abe2-0002a5d5c51b.ta
├── a734eed9-d6a1-4244-aa50-7c99719e7b7b.ta
├── b6c53aba-9669-4668-a7f2-205629d00f86.ta
└── f4e750bb-1437-4fbf-8785-8d3580c34994.ta3 directories, 15 files
Quoted 3 lines
Looks to me like the issue is with newly added line
https://gitlab.com/jonmason00/meta-arm/-/blob/master-next/meta-arm/recipes-security/optee/optee-examples.inc#L39
Looks like this link is pointing to a line where OP-TEE uprev patch isn't applied. Were you referring to following line?
+ install -D -p -m0444 ${B}/plugins/* ${D}${libdir}/tee-supplicant/plugins
As evident from optee-examples build folder above, the plugins directory shouldn't be empty for a successful optee-examples build.
-Sumit
Quoted 798 lines
Thanks,
JonQuoted 795 lines
-Sumit
Quoted 789 lines
Ross
Quoted 786 lines · Sumit Garg
Brief description of changes:
- Version uplift 3.11.0 -> 3.14.0.
- Removed OP-TEE patches that has already been accepted upstream.
- Added support for tee-supplicant plugin framework testing.Tested on
qemuarm64_secureboot:$ xtest -l 15 $ optee-examples_*Signed-off-by Sumit Garg <[email protected]>--- .../optee/optee-client_3.11.0.bb | 3 - .../optee/optee-client_3.14.0.bb | 3 + .../recipes-security/optee/optee-examples.inc | 9 +- .../0001-make-Pass-ldflags-during-link.patch | 103 ------------------ ...efault-cross-compiler-environment-se.patch | 84 ++++++++++++++ ...nable-plugins-installation-in-rootfs.patch | 39 +++++++ .../optee/optee-examples_3.11.0.bb | 4 - .../optee/optee-examples_3.14.0.bb | 4 + ...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 | 11 -- .../recipes-security/optee/optee-os_3.14.0.bb | 8 ++ .../recipes-security/optee/optee-test.inc | 15 +-- ...Adjust-order-of-including-compiler.h.patch | 64 ----------- ...ake-remove-Wno-unsafe-loop-for-clang.patch | 31 ------ ...e-remove-Wmissing-noreturn-for-clang.patch | 31 ------ .../optee/optee-test_3.11.0.bb | 3 - .../optee/optee-test_3.14.0.bb | 3 + 19 files changed, 154 insertions(+), 422 deletions(-) delete mode 100644 meta-arm/recipes-security/optee/optee-client_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-client_3.14.0.bb delete mode 100644 meta-arm/recipes-security/optee/optee-examples/0001-make-Pass-ldflags-during-link.patch create mode 100644 meta-arm/recipes-security/optee/optee-examples/0001-plugins-Honour-default-cross-compiler-environment-se.patch create mode 100644 meta-arm/recipes-security/optee/optee-examples/0002-Makefile-Enable-plugins-installation-in-rootfs.patch delete mode 100644 meta-arm/recipes-security/optee/optee-examples_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-examples_3.14.0.bb delete mode 100644 meta-arm/recipes-security/optee/optee-os/0001-libutils-provide-empty-__getauxval-implementation.patch delete mode 100644 meta-arm/recipes-security/optee/optee-os/0002-link.mk-implement-support-for-libnames-after-libgcc-.patch delete mode 100644 meta-arm/recipes-security/optee/optee-os/0003-ta_dev_kit.mk-make-sure-that-libutils-is-linked-seco.patch delete mode 100644 meta-arm/recipes-security/optee/optee-os_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-os_3.14.0.bb delete mode 100644 meta-arm/recipes-security/optee/optee-test/0001-host-xtest-Adjust-order-of-including-compiler.h.patch delete mode 100644 meta-arm/recipes-security/optee/optee-test/0002-make-remove-Wno-unsafe-loop-for-clang.patch delete mode 100644 meta-arm/recipes-security/optee/optee-test/0003-make-remove-Wmissing-noreturn-for-clang.patch delete mode 100644 meta-arm/recipes-security/optee/optee-test_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-test_3.14.0.bbmeta-arm/recipes-security/optee/optee-client_3.11.0.bb deleted +0
-3@@ -1,3 +0,0 @@ -require optee-client.inc - -SRCREV = "c0c925384c1d7e3558d27d2708857482952d7907"meta-arm/recipes-security/optee/optee-client_3.14.0.bb new file +3
-0@@ -0,0 +1,3 @@ +require optee-client.inc + +SRCREV = "06e1b32f6a7028e039c625b07cfc25fda0c17d53"meta-arm/recipes-security/optee/optee-examples.inc +7
-2@@ -12,7 +12,8 @@ inherit python3native require optee.inc SRC_URI = "git://github.com/linaro-swg/optee_examples.git \ - file://0001-make-Pass-ldflags-during-link.patch \ + file://0001-plugins-Honour-default-cross-compiler-environment-se.patch \ + file://0002-Makefile-Enable-plugins-installation-in-rootfs.patch \ " EXTRA_OEMAKE += "TA_DEV_KIT_DIR=${TA_DEV_KIT_DIR} \@@ -32,11 +33,15 @@ do_compile[cleandirs] = "${B}" do_install () { mkdir -p ${D}${nonarch_base_libdir}/optee_armtz mkdir -p ${D}${bindir} + mkdir -p ${D}${libdir}/tee-supplicant/plugins install -D -p -m0755 ${B}/ca/* ${D}${bindir} install -D -p -m0444 ${B}/ta/* ${D}${nonarch_base_libdir}/optee_armtz + install -D -p -m0444 ${B}/plugins/* ${D}${libdir}/tee-supplicant/plugins } -FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/" +FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/ \ + ${libdir}/tee-supplicant/plugins/ \ + " # Imports machine specific configs from staging to build PACKAGE_ARCH = "${MACHINE_ARCH}"meta-arm/recipes-security/optee/optee-examples/0001-make-Pass-ldflags-during-link.patch deleted +0
-103@@ -1,103 +0,0 @@ -From 29ae21de41f2fbab6dbecbbf408826b28de82df1 Mon Sep 17 00:00:00 2001 -From: Khem Raj <[email protected]> -Date: Tue, 1 Sep 2020 21:09:56 -0700 -Subject: [PATCH] make: Pass ldflags during link - -OpenEmbeeded needs to pass essential linker flags to set correct flags -for gnu_hash among others which sets the linking straight -using LDFLAGS varible here means, we can affect the linker flags -from build environment - -Upstream-Status: Submitted [https://github.com/linaro-swg/optee_examples/pull/85] - -Signed-off-by: Khem Raj <[email protected]> ---- - acipher/host/Makefile | 2 +- - aes/host/Makefile | 2 +- - hello_world/host/Makefile | 2 +- - hotp/host/Makefile | 2 +- - random/host/Makefile | 2 +- - secure_storage/host/Makefile | 2 +- - 6 files changed, 6 insertions(+), 6 deletions(-) - -diff --git a/acipher/host/Makefile b/acipher/host/Makefile -index 8f4bc8a..c2cabef 100644 ---- a/acipher/host/Makefile -+++ b/acipher/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_acipher - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/aes/host/Makefile b/aes/host/Makefile -index dfeb4e8..f61c71b 100644 ---- a/aes/host/Makefile -+++ b/aes/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_aes - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/hello_world/host/Makefile b/hello_world/host/Makefile -index c4c8239..69cf42c 100644 ---- a/hello_world/host/Makefile -+++ b/hello_world/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_hello_world - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/hotp/host/Makefile b/hotp/host/Makefile -index cb7fd19..e7f013f 100644 ---- a/hotp/host/Makefile -+++ b/hotp/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_hotp - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/random/host/Makefile b/random/host/Makefile -index fd407d9..9377f7a 100644 ---- a/random/host/Makefile -+++ b/random/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_random - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/secure_storage/host/Makefile b/secure_storage/host/Makefile -index 29bfb87..b3265ae 100644 ---- a/secure_storage/host/Makefile -+++ b/secure_storage/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_secure_storage - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: --- -2.28.0 -meta-arm/recipes-security/optee/optee-examples/0001-plugins-Honour-default-cross-compiler-environment-se.patch new file +84
-0@@ -0,0 +1,84 @@ +From 79c826c249001700007a6dffe80c3d61ff4428ef Mon Sep 17 00:00:00 2001 +From: Sumit Garg <[email protected]> +Date: Tue, 20 Jul 2021 13:54:30 +0530 +Subject: [PATCH 1/2] plugins: Honour default cross compiler environment setup + +Honour default $(CC), $(CFLAGS) and $(LDFLAGS) variables. Without this +plugins example fails to build for OE/Yocto. + +Upstream-Status: Submitted [https://github.com/linaro-swg/optee_examples/pull/87] + +Signed-off-by: Sumit Garg <[email protected]> +--- + plugins/Makefile | 2 +- + plugins/host/Makefile | 2 +- + plugins/syslog/Makefile | 16 ++++++++++++---- + 3 files changed, 14 insertions(+), 6 deletions(-) + +diff --git a/plugins/Makefile b/plugins/Makefile +index 2372b38..ea472b4 100644 +--- a/plugins/Makefile ++++ b/plugins/Makefile +@@ -8,7 +8,7 @@ TA_CROSS_COMPILE ?= $(CROSS_COMPILE) + all: + $(MAKE) -C host CROSS_COMPILE="$(HOST_CROSS_COMPILE)" --no-builtin-variables + $(MAKE) -C ta CROSS_COMPILE="$(TA_CROSS_COMPILE)" LDFLAGS="" +- $(MAKE) -C syslog CROSS_COMPILE="$(HOST_CROSS_COMPILE)" ++ $(MAKE) -C syslog CROSS_COMPILE="$(HOST_CROSS_COMPILE)" --no-builtin-variables + + .PHONY: clean + clean: +diff --git a/plugins/host/Makefile b/plugins/host/Makefile +index 7285104..76244c7 100644 +--- a/plugins/host/Makefile ++++ b/plugins/host/Makefile +@@ -20,7 +20,7 @@ BINARY = optee_example_plugins + all: $(BINARY) + + $(BINARY): $(OBJS) +- $(CC) -o $@ $< $(LDADD) ++ $(CC) $(LDFLAGS) -o $@ $< $(LDADD) + + .PHONY: clean + clean: +diff --git a/plugins/syslog/Makefile b/plugins/syslog/Makefile +index 62d916a..71f5f92 100644 +--- a/plugins/syslog/Makefile ++++ b/plugins/syslog/Makefile +@@ -1,3 +1,11 @@ ++CC ?= $(CROSS_COMPILE)gcc ++LD ?= $(CROSS_COMPILE)ld ++AR ?= $(CROSS_COMPILE)ar ++NM ?= $(CROSS_COMPILE)nm ++OBJCOPY ?= $(CROSS_COMPILE)objcopy ++OBJDUMP ?= $(CROSS_COMPILE)objdump ++READELF ?= $(CROSS_COMPILE)readelf ++ + PLUGIN_UUID = 96bcf744-4f72-4866-bf1d-8634fd9c65e5 + + PLUGIN = $(PLUGIN_UUID).plugin +@@ -6,17 +14,17 @@ PLUGIN_OBJ = $(patsubst %.c, %.o, $(PLUGIN_SRS)) + PLUGIN_INCLUDES_DIR = $(CURDIR) $(TEEC_EXPORT)/include + + PLUGIN_INCLUDES = $(addprefix -I, $(PLUGIN_INCLUDES_DIR)) +-PLUGIN_CCFLAGS = -Wall -fPIC +-PLUGIN_LDFLAGS = -shared ++PLUGIN_CCFLAGS = $(CFLAGS) -Wall -fPIC ++PLUGIN_LDFLAGS = $(LDFLAGS) -shared + + .PHONY: all + all: $(PLUGIN) + + $(PLUGIN): $(PLUGIN_OBJ) +- $(CROSS_COMPILE)gcc $(PLUGIN_LDFLAGS) $(PLUGIN_OBJ) -o $@ ++ $(CC) $(PLUGIN_LDFLAGS) $(PLUGIN_OBJ) -o $@ + + %.o: %.c +- $(CROSS_COMPILE)gcc $(PLUGIN_CCFLAGS) $(PLUGIN_INCLUDES) -c $*.c -o $*.o ++ $(CC) $(PLUGIN_CCFLAGS) $(PLUGIN_INCLUDES) -c $*.c -o $*.o + + .PHONY: clean + clean: +-- +2.25.1 +meta-arm/recipes-security/optee/optee-examples/0002-Makefile-Enable-plugins-installation-in-rootfs.patch new file +39
-0@@ -0,0 +1,39 @@ +From a865f2e25e178fc2c4617eb1faf79ac922d02ffd Mon Sep 17 00:00:00 2001 +From: Sumit Garg <[email protected]> +Date: Tue, 20 Jul 2021 14:20:10 +0530 +Subject: [PATCH 2/2] Makefile: Enable plugins installation in rootfs + +Upstream-Status: Submitted [https://github.com/linaro-swg/optee_examples/pull/87] + +Signed-off-by: Sumit Garg <[email protected]> +--- + Makefile | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/Makefile b/Makefile +index a275842..b3f16aa 100644 +--- a/Makefile ++++ b/Makefile +@@ -25,14 +25,19 @@ prepare-for-rootfs: examples + @mkdir -p $(OUTPUT_DIR) + @mkdir -p $(OUTPUT_DIR)/ta + @mkdir -p $(OUTPUT_DIR)/ca ++ @mkdir -p $(OUTPUT_DIR)/plugins + @for example in $(EXAMPLE_LIST); do \ + if [ -e $$example/host/optee_example_$$example ]; then \ + cp -p $$example/host/optee_example_$$example $(OUTPUT_DIR)/ca/; \ + fi; \ + cp -pr $$example/ta/*.ta $(OUTPUT_DIR)/ta/; \ ++ if [ $$example == plugins ]; then \ ++ cp -p plugins/syslog/*.plugin $(OUTPUT_DIR)/plugins/; \ ++ fi; \ + done + + prepare-for-rootfs-clean: + @rm -rf $(OUTPUT_DIR)/ta + @rm -rf $(OUTPUT_DIR)/ca ++ @rm -rf $(OUTPUT_DIR)/plugins + @rmdir --ignore-fail-on-non-empty $(OUTPUT_DIR) || test ! -e $(OUTPUT_DIR) +-- +2.25.1 +meta-arm/recipes-security/optee/optee-examples_3.11.0.bb deleted +0
-4@@ -1,4 +0,0 @@ -require optee-examples.inc - -SRCREV = "9a7dc598591990349d88b4dba3a37aadd6851295" -meta-arm/recipes-security/optee/optee-examples_3.14.0.bb new file +4
-0@@ -0,0 +1,4 @@ +require optee-examples.inc + +SRCREV = "e9c870525af8f7e7fccf575a0ca5394ce55adcec" +meta-arm/recipes-security/optee/optee-os/0001-libutils-provide-empty-__getauxval-implementation.patch deleted +0
-62@@ -1,62 +0,0 @@ -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 deleted +0
-55@@ -1,55 +0,0 @@ -Upstream-Status: Backport -Signed-off-by: Ross Burton <[email protected]> - -From 73196b58ea6978ffa5e581738030f51c5789ef73 Mon Sep 17 00:00:00 2001 -From: Volodymyr Babchuk <[email protected]> -Date: Tue, 13 Oct 2020 22:54:13 +0300 -Subject: [PATCH 2/3] link.mk: implement support for libnames-after-libgcc - variable - -Newer versions of libgcc depend on external __getauxval() symbol, which is -now provided by libutils. But libgcc is linked after libutils, so linker -can't resolve that symbol. We can't include libgcc into linking group with -libtutils, because libgcc provides symbols that conflict with libutil's -ones, like __aeabi_idiv with friends for instance. - -So, to resolve libgcc dependency on libutils we need to link with libutils -second time. To make things more generic, we will introduce -$(libnames-after-libgcc) variable for libraries that should be linked after -libgcc. - -Signed-off-by: Volodymyr Babchuk <[email protected]> -Reviewed-by: Jens Wiklander <[email protected]> -Reviewed-by: Jerome Forissier <[email protected]> ---- - ta/arch/arm/link.mk | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/ta/arch/arm/link.mk b/ta/arch/arm/link.mk -index 445c285d..3025acb1 100644 ---- a/ta/arch/arm/link.mk -+++ b/ta/arch/arm/link.mk -@@ -55,8 +55,11 @@ link-ldflags += --eh-frame-hdr - link-ldadd += $(libstdc++$(sm)) $(libgcc_eh$(sm)) - endif - link-ldadd += --end-group --ldargs-$(user-ta-uuid).elf := $(link-ldflags) $(objs) $(link-ldadd) $(libgcc$(sm)) - -+link-ldadd-after-libgcc += $(addprefix -l,$(libnames-after-libgcc)) -+ -+ldargs-$(user-ta-uuid).elf := $(link-ldflags) $(objs) $(link-ldadd) \ -+ $(libgcc$(sm)) $(link-ldadd-after-libgcc) - - link-script-cppflags-$(sm) := \ - $(filter-out $(CPPFLAGS_REMOVE) $(cppflags-remove), \ -@@ -76,6 +79,7 @@ $(link-script-pp$(sm)): $(link-script$(sm)) $(conf-file) $(link-script-pp-makefi - $(link-script-cppflags-$(sm)) $$< -o $$@ - - $(link-out-dir$(sm))/$(user-ta-uuid).elf: $(objs) $(libdeps) \ -+ $(libdeps-after-libgcc) \ - $(link-script-pp$(sm)) \ - $(dynlistdep) \ - $(additional-link-deps) --- -2.25.1 -meta-arm/recipes-security/optee/optee-os/0003-ta_dev_kit.mk-make-sure-that-libutils-is-linked-seco.patch deleted +0
-44@@ -1,44 +0,0 @@ -Upstream-Status: Backport -Signed-off-by: Ross Burton <[email protected]> - -From f50962e3f56f0932662b2ffa10afe53339a335dd Mon Sep 17 00:00:00 2001 -From: Volodymyr Babchuk <[email protected]> -Date: Fri, 16 Oct 2020 16:36:08 +0300 -Subject: [PATCH 3/3] ta_dev_kit.mk: make sure that libutils is linked second - time - -libgcc depends on __getauxval symbol from libuils. As, generally libutils -is linked before libgcc, we will get "unresolved symbol" error. To resolve -this dependency we need to link libutils second time - after libgcc. - -Signed-off-by: Volodymyr Babchuk <[email protected]> -Reviewed-by: Jens Wiklander <[email protected]> -Reviewed-by: Jerome Forissier <[email protected]> ---- - ta/mk/ta_dev_kit.mk | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/ta/mk/ta_dev_kit.mk b/ta/mk/ta_dev_kit.mk -index e28be677..d0e66317 100644 ---- a/ta/mk/ta_dev_kit.mk -+++ b/ta/mk/ta_dev_kit.mk -@@ -78,6 +78,16 @@ endif - libnames += dl - libdeps += $(ta-dev-kit-dir$(sm))/lib/libdl.a - -+# libutils provides __getauxval symbol which is needed by libgcc 10.x. We can't -+# link libutils after libgcc, because libgcc will replace some symbols provided -+# by libutils, which will cause further linking issues. -+# -+# But if we place libutils before libgcc, linker will not be able to resolve -+# __getauxval. So we need to link with libutils twice: before and after libgcc. -+# Hence it included both in $(libnames) and in $(libnames-after-libgcc) -+libnames-after-libgcc += utils -+libdeps-after-libgcc += $(ta-dev-kit-dir$(sm))/lib/libutils.a -+ - # Pass config variable (CFG_) from conf.mk on the command line - cppflags$(sm) += $(strip \ - $(foreach var, $(filter CFG_%,$(.VARIABLES)), \ --- -2.25.1 -meta-arm/recipes-security/optee/optee-os_3.11.0.bb deleted +0
-11@@ -1,11 +0,0 @@ -require optee-os.inc - -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 \ -"meta-arm/recipes-security/optee/optee-os_3.14.0.bb new file +8
-0@@ -0,0 +1,8 @@ +require optee-os.inc + +SRCREV = "d21befa5e53eae9db469eba1685f5aa5c6f92c2f" + +SRC_URI_append = " \ + file://0006-allow-setting-sysroot-for-libgcc-lookup.patch \ + file://0007-allow-setting-sysroot-for-clang.patch \ +"meta-arm/recipes-security/optee/optee-test.inc +6
-9@@ -8,17 +8,9 @@ LIC_FILES_CHKSUM = "file://${S}/LICENSE.md;md5=daa2bcccc666345ab8940aab1315a4fa" inherit python3native ptest require optee.inc -# Linking fails on musl due to C++/threads -# https://github.com/OP-TEE/optee_test/issues/458#issuecomment-720540834 -# When upgraded we should be able to remove this limitation -COMPATIBLE_HOST_libc-musl = 'null' - DEPENDS = "optee-client optee-os python3-pycryptodome-native" SRC_URI = "git://github.com/OP-TEE/optee_test.git \ - file://0001-host-xtest-Adjust-order-of-including-compiler.h.patch \ - file://0002-make-remove-Wno-unsafe-loop-for-clang.patch \ - file://0003-make-remove-Wmissing-noreturn-for-clang.patch \ file://run-ptest \ "@@ -36,6 +28,7 @@ do_compile() { # Top level makefile doesn't seem to handle parallel make gracefully oe_runmake xtest oe_runmake ta + oe_runmake test_plugin } do_compile[cleandirs] = "${B}"@@ -46,9 +39,13 @@ do_install () { # default TEEC_LOAD_PATH is /lib mkdir -p ${D}${nonarch_base_libdir}/optee_armtz/ install -D -p -m0444 ${B}/ta/*/*.ta ${D}${nonarch_base_libdir}/optee_armtz/ + mkdir -p ${D}${libdir}/tee-supplicant/plugins + install -D -p -m0444 ${B}/supp_plugin/*.plugin ${D}${libdir}/tee-supplicant/plugins/ } -FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/" +FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/ \ + ${libdir}/tee-supplicant/plugins/ \ + " # Imports machine specific configs from staging to build PACKAGE_ARCH = "${MACHINE_ARCH}"meta-arm/recipes-security/optee/optee-test/0001-host-xtest-Adjust-order-of-including-compiler.h.patch deleted +0
-64@@ -1,64 +0,0 @@ -From fc95b3ccbbfd336797ae2cfd6dd4dc58644e146f Mon Sep 17 00:00:00 2001 -From: Khem Raj <[email protected]> -Date: Sat, 30 May 2020 17:52:18 -0700 -Subject: [PATCH] host/xtest: Adjust order of including compiler.h - -compiler.h defines some defines which violate libc namespace e.g. -__unused, this works ok with glibc but fails in awkward ways with musl -the reason is musl uses __unused in its internal structures and this -define in compiler.h conflicts with system headers causing errors like - -recipe-sysroot/usr/include/bits/stat.h:17:19: error: expected identifier or '(' before '[' token unsigned __unused[2]; - ^ -including compiler.h afer sys/stat.h fixes the problem. - -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 +- - host/xtest/stats.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/host/xtest/install_ta.c b/host/xtest/install_ta.c -index 09a4c6d..6f7bb5c 100644 ---- a/host/xtest/install_ta.c -+++ b/host/xtest/install_ta.c -@@ -4,7 +4,6 @@ - * SPDX-License-Identifier: BSD-2-Clause - */ - --#include <compiler.h> - #include <dirent.h> - #include <err.h> - #include <errno.h> -@@ -20,6 +19,7 @@ - #include <sys/types.h> - #include <tee_client_api.h> - #include <unistd.h> -+#include <compiler.h> - - #include "install_ta.h" - #include "xtest_helpers.h" -diff --git a/host/xtest/stats.c b/host/xtest/stats.c -index 96b0b5f..db9bf25 100644 ---- a/host/xtest/stats.c -+++ b/host/xtest/stats.c -@@ -3,7 +3,6 @@ - * Copyright (c) 2019, Linaro Limited - */ - --#include <compiler.h> - #include <dirent.h> - #include <err.h> - #include <errno.h> -@@ -18,6 +17,7 @@ - #include <sys/types.h> - #include <tee_client_api.h> - #include <unistd.h> -+#include <compiler.h> - #include "xtest_test.h" - #include "stats.h" - --- -2.26.2 -meta-arm/recipes-security/optee/optee-test/0002-make-remove-Wno-unsafe-loop-for-clang.patch deleted +0
-31@@ -1,31 +0,0 @@ -From 438533ce9da1df0b7c7914e64b39ffdc1da1ab79 Mon Sep 17 00:00:00 2001 -From: Brett Warren <[email protected]> -Date: Thu, 8 Oct 2020 10:03:25 +0100 -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 [https://github.com/OP-TEE/optee_test/issues/452] -Changed-Id: 71cb511904547d790d1ea98f93bf8e5a6afcb36d -Signed-off-by: Brett Warren <[email protected]> ---- - host/xtest/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/host/xtest/Makefile b/host/xtest/Makefile -index 3c206b0..96746de 100644 ---- a/host/xtest/Makefile -+++ b/host/xtest/Makefile -@@ -169,7 +169,7 @@ CFLAGS += -Wall -Wcast-align -Werror \ - -Werror-implicit-function-declaration -Wextra -Wfloat-equal \ - -Wformat-nonliteral -Wformat-security -Wformat=2 -Winit-self \ - -Wmissing-declarations -Wmissing-format-attribute \ -- -Wmissing-include-dirs -Wmissing-noreturn \ -+ -Wmissing-include-dirs \ - -Wmissing-prototypes -Wnested-externs -Wpointer-arith \ - -Wshadow -Wstrict-prototypes -Wswitch-default \ - -Wwrite-strings \ --- -2.17.1 -meta-arm/recipes-security/optee/optee-test/0003-make-remove-Wmissing-noreturn-for-clang.patch deleted +0
-31@@ -1,31 +0,0 @@ -From ed5a9d9f7a3e9e14ca0e8aea59008124ee0e5f96 Mon Sep 17 00:00:00 2001 -From: Brett Warren <[email protected]> -Date: Thu, 8 Oct 2020 10:20:52 +0100 -Subject: [PATCH] make: remove -Wno-unsafe-loop for clang - -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 [https://github.com/OP-TEE/optee_test/issues/452] -Change-Id: 5fe0892c73208aaffac8c9995cb3275936fb1ba6 -Signed-off-by: Brett Warren <[email protected]> ---- - host/xtest/Makefile | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/host/xtest/Makefile b/host/xtest/Makefile -index 96746de..73731d0 100644 ---- a/host/xtest/Makefile -+++ b/host/xtest/Makefile -@@ -174,7 +174,6 @@ CFLAGS += -Wall -Wcast-align -Werror \ - -Wshadow -Wstrict-prototypes -Wswitch-default \ - -Wwrite-strings \ - -Wno-declaration-after-statement \ -- -Wno-unsafe-loop-optimizations \ - -Wno-missing-field-initializers -Wno-format-zero-length - endif - --- -2.17.1 -meta-arm/recipes-security/optee/optee-test_3.11.0.bb deleted +0
-3@@ -1,3 +0,0 @@ -require optee-test.inc - -SRCREV = "159e295d5cc3ad2275ab15fe544620f6604d4ba4"meta-arm/recipes-security/optee/optee-test_3.14.0.bb new file +3
-1@@ -0,0 +1,3 @@ +require optee-test.inc + +SRCREV = "f2eb88affbb7f028561b4fd5cbd049d5d704f741" --2.25.1
Ah, this might be the problem from log.do_compile:
Copying example CA and TA binaries to /yocto/ross/build/tmp/work/qemuarm64_secureboot-poky-linux/optee-examples/3.14.0-r0/build... /bin/sh: 6: [: acipher: unexpected operator/bin/sh: 6: [: plugins: unexpected operator/bin/sh: 6: [: hello_world: unexpected operator/bin/sh: 6: [: hotp: unexpected operator/bin/sh: 6: [: aes: unexpected operator/bin/sh: 6: [: random: unexpected operator/bin/sh: 6: [: secure_storage: unexpected operator
Ross
Quoted 888 lines · Sumit Garg
Hi Jon,
Quoted 20 lines · Jon Mason
Quoted 18 lines · Sumit Garg
Hi Ross,
Quoted 9 lines · Ross Burton
The optee-examples recipe is broken:
install: cannot stat '/builds/engineering/yocto/meta-arm/work/build/tmp/work/qemuarm64_secureboot-poky-linux/optee-examples/3.14.0-r0/build/plugins/*':
No such file or directory(qemuarm64-secureboot can build it)
Strangely, it works fine for me when building for qemuarm64-secureboot. Can you check if the following patches have been correctly applied in the corresponding work directory?
Quoted 7 lines
Quoted 3 lines
file://0001-plugins-Honour-default-cross-compiler-environment-se.patch
\ file://0002-Makefile-Enable-plugins-installation-in-rootfs.patch \I'm seeing the same issue Ross is describing. I would expect a warning or error if it couldn't find the patches while building, not when installing.
Yeah you are correct but I am not able to figure the reason for this behaviour.
Quoted 4 lines
Can you confirm you are building optee-examples, in addition to core-image-minimal/base?
See https://gitlab.com/jonmason00/meta-arm/-/jobs/1444856281#L3594Yeah I am building optee-examples in addition to core-image-minimal/base.
- Changes to default poky
conf/local.conf:MACHINE = "qemuarm64-secureboot"
CORE_IMAGE_EXTRA_INSTALL+= "optee-examples optee-test"- Changes to default poky
conf/bblayers.confwith additional layers as:meta-arm/meta-arm-toolchain
meta-arm/meta-armHere is optee-examples build folder directory structure for me:
$ tree tmp/work/qemuarm64_secureboot-poky-linux/optee-examples/3.14.0-r0/build/ tmp/work/qemuarm64_secureboot-poky-linux/optee-examples/3.14.0-r0/build/ ├── ca │ ├── optee_example_acipher │ ├── optee_example_aes │ ├── optee_example_hello_world │ ├── optee_example_hotp │ ├── optee_example_plugins │ ├── optee_example_random │ └── optee_example_secure_storage ├── plugins │ └── 96bcf744-4f72-4866-bf1d-8634fd9c65e5.plugin └── ta ├── 2a287631-de1b-4fdd-a55c-b9312e40769a.ta ├── 484d4143-2d53-4841-3120-4a6f636b6542.ta ├── 5dbac793-f574-4871-8ad3-04331ec17f24.ta ├── 8aaaf200-2450-11e4-abe2-0002a5d5c51b.ta ├── a734eed9-d6a1-4244-aa50-7c99719e7b7b.ta ├── b6c53aba-9669-4668-a7f2-205629d00f86.ta └── f4e750bb-1437-4fbf-8785-8d3580c34994.ta3 directories, 15 files
Quoted 3 lines
Looks to me like the issue is with newly added line
https://gitlab.com/jonmason00/meta-arm/-/blob/master-next/meta-arm/recipes-security/optee/optee-examples.inc#L39Looks like this link is pointing to a line where OP-TEE uprev patch isn't applied. Were you referring to following line?
+ install -D -p -m0444 ${B}/plugins/* ${D}${libdir}/tee-supplicant/plugins
As evident from optee-examples build folder above, the plugins directory shouldn't be empty for a successful optee-examples build.
-Sumit
Quoted 798 lines
Thanks,
JonQuoted 795 lines
-Sumit
Quoted 789 lines
Ross
Quoted 786 lines · Sumit Garg
Brief description of changes:
- Version uplift 3.11.0 -> 3.14.0.
- Removed OP-TEE patches that has already been accepted upstream.
- Added support for tee-supplicant plugin framework testing.Tested on
qemuarm64_secureboot:$ xtest -l 15 $ optee-examples_*Signed-off-by Sumit Garg <[email protected]>--- .../optee/optee-client_3.11.0.bb | 3 - .../optee/optee-client_3.14.0.bb | 3 + .../recipes-security/optee/optee-examples.inc | 9 +- .../0001-make-Pass-ldflags-during-link.patch | 103 ------------------ ...efault-cross-compiler-environment-se.patch | 84 ++++++++++++++ ...nable-plugins-installation-in-rootfs.patch | 39 +++++++ .../optee/optee-examples_3.11.0.bb | 4 - .../optee/optee-examples_3.14.0.bb | 4 + ...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 | 11 -- .../recipes-security/optee/optee-os_3.14.0.bb | 8 ++ .../recipes-security/optee/optee-test.inc | 15 +-- ...Adjust-order-of-including-compiler.h.patch | 64 ----------- ...ake-remove-Wno-unsafe-loop-for-clang.patch | 31 ------ ...e-remove-Wmissing-noreturn-for-clang.patch | 31 ------ .../optee/optee-test_3.11.0.bb | 3 - .../optee/optee-test_3.14.0.bb | 3 + 19 files changed, 154 insertions(+), 422 deletions(-) delete mode 100644 meta-arm/recipes-security/optee/optee-client_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-client_3.14.0.bb delete mode 100644 meta-arm/recipes-security/optee/optee-examples/0001-make-Pass-ldflags-during-link.patch create mode 100644 meta-arm/recipes-security/optee/optee-examples/0001-plugins-Honour-default-cross-compiler-environment-se.patch create mode 100644 meta-arm/recipes-security/optee/optee-examples/0002-Makefile-Enable-plugins-installation-in-rootfs.patch delete mode 100644 meta-arm/recipes-security/optee/optee-examples_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-examples_3.14.0.bb delete mode 100644 meta-arm/recipes-security/optee/optee-os/0001-libutils-provide-empty-__getauxval-implementation.patch delete mode 100644 meta-arm/recipes-security/optee/optee-os/0002-link.mk-implement-support-for-libnames-after-libgcc-.patch delete mode 100644 meta-arm/recipes-security/optee/optee-os/0003-ta_dev_kit.mk-make-sure-that-libutils-is-linked-seco.patch delete mode 100644 meta-arm/recipes-security/optee/optee-os_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-os_3.14.0.bb delete mode 100644 meta-arm/recipes-security/optee/optee-test/0001-host-xtest-Adjust-order-of-including-compiler.h.patch delete mode 100644 meta-arm/recipes-security/optee/optee-test/0002-make-remove-Wno-unsafe-loop-for-clang.patch delete mode 100644 meta-arm/recipes-security/optee/optee-test/0003-make-remove-Wmissing-noreturn-for-clang.patch delete mode 100644 meta-arm/recipes-security/optee/optee-test_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-test_3.14.0.bbmeta-arm/recipes-security/optee/optee-client_3.11.0.bb deleted +0
-3@@ -1,3 +0,0 @@ -require optee-client.inc - -SRCREV = "c0c925384c1d7e3558d27d2708857482952d7907"meta-arm/recipes-security/optee/optee-client_3.14.0.bb new file +3
-0@@ -0,0 +1,3 @@ +require optee-client.inc + +SRCREV = "06e1b32f6a7028e039c625b07cfc25fda0c17d53"meta-arm/recipes-security/optee/optee-examples.inc +7
-2@@ -12,7 +12,8 @@ inherit python3native require optee.inc SRC_URI = "git://github.com/linaro-swg/optee_examples.git \ - file://0001-make-Pass-ldflags-during-link.patch \ + file://0001-plugins-Honour-default-cross-compiler-environment-se.patch \ + file://0002-Makefile-Enable-plugins-installation-in-rootfs.patch \ " EXTRA_OEMAKE += "TA_DEV_KIT_DIR=${TA_DEV_KIT_DIR} \@@ -32,11 +33,15 @@ do_compile[cleandirs] = "${B}" do_install () { mkdir -p ${D}${nonarch_base_libdir}/optee_armtz mkdir -p ${D}${bindir} + mkdir -p ${D}${libdir}/tee-supplicant/plugins install -D -p -m0755 ${B}/ca/* ${D}${bindir} install -D -p -m0444 ${B}/ta/* ${D}${nonarch_base_libdir}/optee_armtz + install -D -p -m0444 ${B}/plugins/* ${D}${libdir}/tee-supplicant/plugins } -FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/" +FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/ \ + ${libdir}/tee-supplicant/plugins/ \ + " # Imports machine specific configs from staging to build PACKAGE_ARCH = "${MACHINE_ARCH}"meta-arm/recipes-security/optee/optee-examples/0001-make-Pass-ldflags-during-link.patch deleted +0
-103@@ -1,103 +0,0 @@ -From 29ae21de41f2fbab6dbecbbf408826b28de82df1 Mon Sep 17 00:00:00 2001 -From: Khem Raj <[email protected]> -Date: Tue, 1 Sep 2020 21:09:56 -0700 -Subject: [PATCH] make: Pass ldflags during link - -OpenEmbeeded needs to pass essential linker flags to set correct flags -for gnu_hash among others which sets the linking straight -using LDFLAGS varible here means, we can affect the linker flags -from build environment - -Upstream-Status: Submitted [https://github.com/linaro-swg/optee_examples/pull/85] - -Signed-off-by: Khem Raj <[email protected]> ---- - acipher/host/Makefile | 2 +- - aes/host/Makefile | 2 +- - hello_world/host/Makefile | 2 +- - hotp/host/Makefile | 2 +- - random/host/Makefile | 2 +- - secure_storage/host/Makefile | 2 +- - 6 files changed, 6 insertions(+), 6 deletions(-) - -diff --git a/acipher/host/Makefile b/acipher/host/Makefile -index 8f4bc8a..c2cabef 100644 ---- a/acipher/host/Makefile -+++ b/acipher/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_acipher - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/aes/host/Makefile b/aes/host/Makefile -index dfeb4e8..f61c71b 100644 ---- a/aes/host/Makefile -+++ b/aes/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_aes - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/hello_world/host/Makefile b/hello_world/host/Makefile -index c4c8239..69cf42c 100644 ---- a/hello_world/host/Makefile -+++ b/hello_world/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_hello_world - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/hotp/host/Makefile b/hotp/host/Makefile -index cb7fd19..e7f013f 100644 ---- a/hotp/host/Makefile -+++ b/hotp/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_hotp - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/random/host/Makefile b/random/host/Makefile -index fd407d9..9377f7a 100644 ---- a/random/host/Makefile -+++ b/random/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_random - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/secure_storage/host/Makefile b/secure_storage/host/Makefile -index 29bfb87..b3265ae 100644 ---- a/secure_storage/host/Makefile -+++ b/secure_storage/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_secure_storage - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: --- -2.28.0 -meta-arm/recipes-security/optee/optee-examples/0001-plugins-Honour-default-cross-compiler-environment-se.patch new file +84
-0@@ -0,0 +1,84 @@ +From 79c826c249001700007a6dffe80c3d61ff4428ef Mon Sep 17 00:00:00 2001 +From: Sumit Garg <[email protected]> +Date: Tue, 20 Jul 2021 13:54:30 +0530 +Subject: [PATCH 1/2] plugins: Honour default cross compiler environment setup + +Honour default $(CC), $(CFLAGS) and $(LDFLAGS) variables. Without this +plugins example fails to build for OE/Yocto. + +Upstream-Status: Submitted [https://github.com/linaro-swg/optee_examples/pull/87] + +Signed-off-by: Sumit Garg <[email protected]> +--- + plugins/Makefile | 2 +- + plugins/host/Makefile | 2 +- + plugins/syslog/Makefile | 16 ++++++++++++---- + 3 files changed, 14 insertions(+), 6 deletions(-) + +diff --git a/plugins/Makefile b/plugins/Makefile +index 2372b38..ea472b4 100644 +--- a/plugins/Makefile ++++ b/plugins/Makefile +@@ -8,7 +8,7 @@ TA_CROSS_COMPILE ?= $(CROSS_COMPILE) + all: + $(MAKE) -C host CROSS_COMPILE="$(HOST_CROSS_COMPILE)" --no-builtin-variables + $(MAKE) -C ta CROSS_COMPILE="$(TA_CROSS_COMPILE)" LDFLAGS="" +- $(MAKE) -C syslog CROSS_COMPILE="$(HOST_CROSS_COMPILE)" ++ $(MAKE) -C syslog CROSS_COMPILE="$(HOST_CROSS_COMPILE)" --no-builtin-variables + + .PHONY: clean + clean: +diff --git a/plugins/host/Makefile b/plugins/host/Makefile +index 7285104..76244c7 100644 +--- a/plugins/host/Makefile ++++ b/plugins/host/Makefile +@@ -20,7 +20,7 @@ BINARY = optee_example_plugins + all: $(BINARY) + + $(BINARY): $(OBJS) +- $(CC) -o $@ $< $(LDADD) ++ $(CC) $(LDFLAGS) -o $@ $< $(LDADD) + + .PHONY: clean + clean: +diff --git a/plugins/syslog/Makefile b/plugins/syslog/Makefile +index 62d916a..71f5f92 100644 +--- a/plugins/syslog/Makefile ++++ b/plugins/syslog/Makefile +@@ -1,3 +1,11 @@ ++CC ?= $(CROSS_COMPILE)gcc ++LD ?= $(CROSS_COMPILE)ld ++AR ?= $(CROSS_COMPILE)ar ++NM ?= $(CROSS_COMPILE)nm ++OBJCOPY ?= $(CROSS_COMPILE)objcopy ++OBJDUMP ?= $(CROSS_COMPILE)objdump ++READELF ?= $(CROSS_COMPILE)readelf ++ + PLUGIN_UUID = 96bcf744-4f72-4866-bf1d-8634fd9c65e5 + + PLUGIN = $(PLUGIN_UUID).plugin +@@ -6,17 +14,17 @@ PLUGIN_OBJ = $(patsubst %.c, %.o, $(PLUGIN_SRS)) + PLUGIN_INCLUDES_DIR = $(CURDIR) $(TEEC_EXPORT)/include + + PLUGIN_INCLUDES = $(addprefix -I, $(PLUGIN_INCLUDES_DIR)) +-PLUGIN_CCFLAGS = -Wall -fPIC +-PLUGIN_LDFLAGS = -shared ++PLUGIN_CCFLAGS = $(CFLAGS) -Wall -fPIC ++PLUGIN_LDFLAGS = $(LDFLAGS) -shared + + .PHONY: all + all: $(PLUGIN) + + $(PLUGIN): $(PLUGIN_OBJ) +- $(CROSS_COMPILE)gcc $(PLUGIN_LDFLAGS) $(PLUGIN_OBJ) -o $@ ++ $(CC) $(PLUGIN_LDFLAGS) $(PLUGIN_OBJ) -o $@ + + %.o: %.c +- $(CROSS_COMPILE)gcc $(PLUGIN_CCFLAGS) $(PLUGIN_INCLUDES) -c $*.c -o $*.o ++ $(CC) $(PLUGIN_CCFLAGS) $(PLUGIN_INCLUDES) -c $*.c -o $*.o + + .PHONY: clean + clean: +-- +2.25.1 +meta-arm/recipes-security/optee/optee-examples/0002-Makefile-Enable-plugins-installation-in-rootfs.patch new file +39
-0@@ -0,0 +1,39 @@ +From a865f2e25e178fc2c4617eb1faf79ac922d02ffd Mon Sep 17 00:00:00 2001 +From: Sumit Garg <[email protected]> +Date: Tue, 20 Jul 2021 14:20:10 +0530 +Subject: [PATCH 2/2] Makefile: Enable plugins installation in rootfs + +Upstream-Status: Submitted [https://github.com/linaro-swg/optee_examples/pull/87] + +Signed-off-by: Sumit Garg <[email protected]> +--- + Makefile | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/Makefile b/Makefile +index a275842..b3f16aa 100644 +--- a/Makefile ++++ b/Makefile +@@ -25,14 +25,19 @@ prepare-for-rootfs: examples + @mkdir -p $(OUTPUT_DIR) + @mkdir -p $(OUTPUT_DIR)/ta + @mkdir -p $(OUTPUT_DIR)/ca ++ @mkdir -p $(OUTPUT_DIR)/plugins + @for example in $(EXAMPLE_LIST); do \ + if [ -e $$example/host/optee_example_$$example ]; then \ + cp -p $$example/host/optee_example_$$example $(OUTPUT_DIR)/ca/; \ + fi; \ + cp -pr $$example/ta/*.ta $(OUTPUT_DIR)/ta/; \ ++ if [ $$example == plugins ]; then \ ++ cp -p plugins/syslog/*.plugin $(OUTPUT_DIR)/plugins/; \ ++ fi; \ + done + + prepare-for-rootfs-clean: + @rm -rf $(OUTPUT_DIR)/ta + @rm -rf $(OUTPUT_DIR)/ca ++ @rm -rf $(OUTPUT_DIR)/plugins + @rmdir --ignore-fail-on-non-empty $(OUTPUT_DIR) || test ! -e $(OUTPUT_DIR) +-- +2.25.1 +meta-arm/recipes-security/optee/optee-examples_3.11.0.bb deleted +0
-4@@ -1,4 +0,0 @@ -require optee-examples.inc - -SRCREV = "9a7dc598591990349d88b4dba3a37aadd6851295" -meta-arm/recipes-security/optee/optee-examples_3.14.0.bb new file +4
-0@@ -0,0 +1,4 @@ +require optee-examples.inc + +SRCREV = "e9c870525af8f7e7fccf575a0ca5394ce55adcec" +meta-arm/recipes-security/optee/optee-os/0001-libutils-provide-empty-__getauxval-implementation.patch deleted +0
-62@@ -1,62 +0,0 @@ -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 deleted +0
-55@@ -1,55 +0,0 @@ -Upstream-Status: Backport -Signed-off-by: Ross Burton <[email protected]> - -From 73196b58ea6978ffa5e581738030f51c5789ef73 Mon Sep 17 00:00:00 2001 -From: Volodymyr Babchuk <[email protected]> -Date: Tue, 13 Oct 2020 22:54:13 +0300 -Subject: [PATCH 2/3] link.mk: implement support for libnames-after-libgcc - variable - -Newer versions of libgcc depend on external __getauxval() symbol, which is -now provided by libutils. But libgcc is linked after libutils, so linker -can't resolve that symbol. We can't include libgcc into linking group with -libtutils, because libgcc provides symbols that conflict with libutil's -ones, like __aeabi_idiv with friends for instance. - -So, to resolve libgcc dependency on libutils we need to link with libutils -second time. To make things more generic, we will introduce -$(libnames-after-libgcc) variable for libraries that should be linked after -libgcc. - -Signed-off-by: Volodymyr Babchuk <[email protected]> -Reviewed-by: Jens Wiklander <[email protected]> -Reviewed-by: Jerome Forissier <[email protected]> ---- - ta/arch/arm/link.mk | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/ta/arch/arm/link.mk b/ta/arch/arm/link.mk -index 445c285d..3025acb1 100644 ---- a/ta/arch/arm/link.mk -+++ b/ta/arch/arm/link.mk -@@ -55,8 +55,11 @@ link-ldflags += --eh-frame-hdr - link-ldadd += $(libstdc++$(sm)) $(libgcc_eh$(sm)) - endif - link-ldadd += --end-group --ldargs-$(user-ta-uuid).elf := $(link-ldflags) $(objs) $(link-ldadd) $(libgcc$(sm)) - -+link-ldadd-after-libgcc += $(addprefix -l,$(libnames-after-libgcc)) -+ -+ldargs-$(user-ta-uuid).elf := $(link-ldflags) $(objs) $(link-ldadd) \ -+ $(libgcc$(sm)) $(link-ldadd-after-libgcc) - - link-script-cppflags-$(sm) := \ - $(filter-out $(CPPFLAGS_REMOVE) $(cppflags-remove), \ -@@ -76,6 +79,7 @@ $(link-script-pp$(sm)): $(link-script$(sm)) $(conf-file) $(link-script-pp-makefi - $(link-script-cppflags-$(sm)) $$< -o $$@ - - $(link-out-dir$(sm))/$(user-ta-uuid).elf: $(objs) $(libdeps) \ -+ $(libdeps-after-libgcc) \ - $(link-script-pp$(sm)) \ - $(dynlistdep) \ - $(additional-link-deps) --- -2.25.1 -meta-arm/recipes-security/optee/optee-os/0003-ta_dev_kit.mk-make-sure-that-libutils-is-linked-seco.patch deleted +0
-44@@ -1,44 +0,0 @@ -Upstream-Status: Backport -Signed-off-by: Ross Burton <[email protected]> - -From f50962e3f56f0932662b2ffa10afe53339a335dd Mon Sep 17 00:00:00 2001 -From: Volodymyr Babchuk <[email protected]> -Date: Fri, 16 Oct 2020 16:36:08 +0300 -Subject: [PATCH 3/3] ta_dev_kit.mk: make sure that libutils is linked second - time - -libgcc depends on __getauxval symbol from libuils. As, generally libutils -is linked before libgcc, we will get "unresolved symbol" error. To resolve -this dependency we need to link libutils second time - after libgcc. - -Signed-off-by: Volodymyr Babchuk <[email protected]> -Reviewed-by: Jens Wiklander <[email protected]> -Reviewed-by: Jerome Forissier <[email protected]> ---- - ta/mk/ta_dev_kit.mk | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/ta/mk/ta_dev_kit.mk b/ta/mk/ta_dev_kit.mk -index e28be677..d0e66317 100644 ---- a/ta/mk/ta_dev_kit.mk -+++ b/ta/mk/ta_dev_kit.mk -@@ -78,6 +78,16 @@ endif - libnames += dl - libdeps += $(ta-dev-kit-dir$(sm))/lib/libdl.a - -+# libutils provides __getauxval symbol which is needed by libgcc 10.x. We can't -+# link libutils after libgcc, because libgcc will replace some symbols provided -+# by libutils, which will cause further linking issues. -+# -+# But if we place libutils before libgcc, linker will not be able to resolve -+# __getauxval. So we need to link with libutils twice: before and after libgcc. -+# Hence it included both in $(libnames) and in $(libnames-after-libgcc) -+libnames-after-libgcc += utils -+libdeps-after-libgcc += $(ta-dev-kit-dir$(sm))/lib/libutils.a -+ - # Pass config variable (CFG_) from conf.mk on the command line - cppflags$(sm) += $(strip \ - $(foreach var, $(filter CFG_%,$(.VARIABLES)), \ --- -2.25.1 -meta-arm/recipes-security/optee/optee-os_3.11.0.bb deleted +0
-11@@ -1,11 +0,0 @@ -require optee-os.inc - -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 \ -"meta-arm/recipes-security/optee/optee-os_3.14.0.bb new file +8
-0@@ -0,0 +1,8 @@ +require optee-os.inc + +SRCREV = "d21befa5e53eae9db469eba1685f5aa5c6f92c2f" + +SRC_URI_append = " \ + file://0006-allow-setting-sysroot-for-libgcc-lookup.patch \ + file://0007-allow-setting-sysroot-for-clang.patch \ +"meta-arm/recipes-security/optee/optee-test.inc +6
-9@@ -8,17 +8,9 @@ LIC_FILES_CHKSUM = "file://${S}/LICENSE.md;md5=daa2bcccc666345ab8940aab1315a4fa" inherit python3native ptest require optee.inc -# Linking fails on musl due to C++/threads -# https://github.com/OP-TEE/optee_test/issues/458#issuecomment-720540834 -# When upgraded we should be able to remove this limitation -COMPATIBLE_HOST_libc-musl = 'null' - DEPENDS = "optee-client optee-os python3-pycryptodome-native" SRC_URI = "git://github.com/OP-TEE/optee_test.git \ - file://0001-host-xtest-Adjust-order-of-including-compiler.h.patch \ - file://0002-make-remove-Wno-unsafe-loop-for-clang.patch \ - file://0003-make-remove-Wmissing-noreturn-for-clang.patch \ file://run-ptest \ "@@ -36,6 +28,7 @@ do_compile() { # Top level makefile doesn't seem to handle parallel make gracefully oe_runmake xtest oe_runmake ta + oe_runmake test_plugin } do_compile[cleandirs] = "${B}"@@ -46,9 +39,13 @@ do_install () { # default TEEC_LOAD_PATH is /lib mkdir -p ${D}${nonarch_base_libdir}/optee_armtz/ install -D -p -m0444 ${B}/ta/*/*.ta ${D}${nonarch_base_libdir}/optee_armtz/ + mkdir -p ${D}${libdir}/tee-supplicant/plugins + install -D -p -m0444 ${B}/supp_plugin/*.plugin ${D}${libdir}/tee-supplicant/plugins/ } -FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/" +FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/ \ + ${libdir}/tee-supplicant/plugins/ \ + " # Imports machine specific configs from staging to build PACKAGE_ARCH = "${MACHINE_ARCH}"meta-arm/recipes-security/optee/optee-test/0001-host-xtest-Adjust-order-of-including-compiler.h.patch deleted +0
-64@@ -1,64 +0,0 @@ -From fc95b3ccbbfd336797ae2cfd6dd4dc58644e146f Mon Sep 17 00:00:00 2001 -From: Khem Raj <[email protected]> -Date: Sat, 30 May 2020 17:52:18 -0700 -Subject: [PATCH] host/xtest: Adjust order of including compiler.h - -compiler.h defines some defines which violate libc namespace e.g. -__unused, this works ok with glibc but fails in awkward ways with musl -the reason is musl uses __unused in its internal structures and this -define in compiler.h conflicts with system headers causing errors like - -recipe-sysroot/usr/include/bits/stat.h:17:19: error: expected identifier or '(' before '[' token unsigned __unused[2]; - ^ -including compiler.h afer sys/stat.h fixes the problem. - -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 +- - host/xtest/stats.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/host/xtest/install_ta.c b/host/xtest/install_ta.c -index 09a4c6d..6f7bb5c 100644 ---- a/host/xtest/install_ta.c -+++ b/host/xtest/install_ta.c -@@ -4,7 +4,6 @@ - * SPDX-License-Identifier: BSD-2-Clause - */ - --#include <compiler.h> - #include <dirent.h> - #include <err.h> - #include <errno.h> -@@ -20,6 +19,7 @@ - #include <sys/types.h> - #include <tee_client_api.h> - #include <unistd.h> -+#include <compiler.h> - - #include "install_ta.h" - #include "xtest_helpers.h" -diff --git a/host/xtest/stats.c b/host/xtest/stats.c -index 96b0b5f..db9bf25 100644 ---- a/host/xtest/stats.c -+++ b/host/xtest/stats.c -@@ -3,7 +3,6 @@ - * Copyright (c) 2019, Linaro Limited - */ - --#include <compiler.h> - #include <dirent.h> - #include <err.h> - #include <errno.h> -@@ -18,6 +17,7 @@ - #include <sys/types.h> - #include <tee_client_api.h> - #include <unistd.h> -+#include <compiler.h> - #include "xtest_test.h" - #include "stats.h" - --- -2.26.2 -meta-arm/recipes-security/optee/optee-test/0002-make-remove-Wno-unsafe-loop-for-clang.patch deleted +0
-31@@ -1,31 +0,0 @@ -From 438533ce9da1df0b7c7914e64b39ffdc1da1ab79 Mon Sep 17 00:00:00 2001 -From: Brett Warren <[email protected]> -Date: Thu, 8 Oct 2020 10:03:25 +0100 -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 [https://github.com/OP-TEE/optee_test/issues/452] -Changed-Id: 71cb511904547d790d1ea98f93bf8e5a6afcb36d -Signed-off-by: Brett Warren <[email protected]> ---- - host/xtest/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/host/xtest/Makefile b/host/xtest/Makefile -index 3c206b0..96746de 100644 ---- a/host/xtest/Makefile -+++ b/host/xtest/Makefile -@@ -169,7 +169,7 @@ CFLAGS += -Wall -Wcast-align -Werror \ - -Werror-implicit-function-declaration -Wextra -Wfloat-equal \ - -Wformat-nonliteral -Wformat-security -Wformat=2 -Winit-self \ - -Wmissing-declarations -Wmissing-format-attribute \ -- -Wmissing-include-dirs -Wmissing-noreturn \ -+ -Wmissing-include-dirs \ - -Wmissing-prototypes -Wnested-externs -Wpointer-arith \ - -Wshadow -Wstrict-prototypes -Wswitch-default \ - -Wwrite-strings \ --- -2.17.1 -meta-arm/recipes-security/optee/optee-test/0003-make-remove-Wmissing-noreturn-for-clang.patch deleted +0
-31@@ -1,31 +0,0 @@ -From ed5a9d9f7a3e9e14ca0e8aea59008124ee0e5f96 Mon Sep 17 00:00:00 2001 -From: Brett Warren <[email protected]> -Date: Thu, 8 Oct 2020 10:20:52 +0100 -Subject: [PATCH] make: remove -Wno-unsafe-loop for clang - -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 [https://github.com/OP-TEE/optee_test/issues/452] -Change-Id: 5fe0892c73208aaffac8c9995cb3275936fb1ba6 -Signed-off-by: Brett Warren <[email protected]> ---- - host/xtest/Makefile | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/host/xtest/Makefile b/host/xtest/Makefile -index 96746de..73731d0 100644 ---- a/host/xtest/Makefile -+++ b/host/xtest/Makefile -@@ -174,7 +174,6 @@ CFLAGS += -Wall -Wcast-align -Werror \ - -Wshadow -Wstrict-prototypes -Wswitch-default \ - -Wwrite-strings \ - -Wno-declaration-after-statement \ -- -Wno-unsafe-loop-optimizations \ - -Wno-missing-field-initializers -Wno-format-zero-length - endif - --- -2.17.1 -meta-arm/recipes-security/optee/optee-test_3.11.0.bb deleted +0
-3@@ -1,3 +0,0 @@ -require optee-test.inc - -SRCREV = "159e295d5cc3ad2275ab15fe544620f6604d4ba4"meta-arm/recipes-security/optee/optee-test_3.14.0.bb new file +3
-1@@ -0,0 +1,3 @@ +require optee-test.inc + +SRCREV = "f2eb88affbb7f028561b4fd5cbd049d5d704f741" --2.25.1
Yes, that was it. == is a bashism, this line should use = instead:
https://github.com/linaro-swg/optee_examples/blob/master/Makefile#L34
And a makefile that doesn't eat errors would be helpful too.
Ross
Quoted 904 lines · Ross Burton
Ah, this might be the problem from log.do_compile:
Copying example CA and TA binaries to /yocto/ross/build/tmp/work/qemuarm64_secureboot-poky-linux/optee-examples/3.14.0-r0/build...
/bin/sh: 6: [: acipher: unexpected operator/bin/sh: 6: [: plugins: unexpected operator/bin/sh: 6: [:hello_world: unexpected operator/bin/sh: 6: [: hotp: unexpected operator/bin/sh: 6: [: aes: unexpected operator/bin/sh: 6: [: random: unexpected operator/bin/sh: 6: [:secure_storage: unexpected operatorRoss
Quoted 888 lines · Sumit Garg
Hi Jon,
Quoted 20 lines · Jon Mason
Quoted 18 lines · Sumit Garg
Hi Ross,
Quoted 9 lines · Ross Burton
The optee-examples recipe is broken:
install: cannot stat '/builds/engineering/yocto/meta-arm/work/build/tmp/work/qemuarm64_secureboot-poky-linux/optee-examples/3.14.0-r0/build/plugins/*':
No such file or directory(qemuarm64-secureboot can build it)
Strangely, it works fine for me when building for qemuarm64-secureboot. Can you check if the following patches have been correctly applied in the corresponding work directory?
Quoted 7 lines
Quoted 3 lines
file://0001-plugins-Honour-default-cross-compiler-environment-se.patch
\ file://0002-Makefile-Enable-plugins-installation-in-rootfs.patch \I'm seeing the same issue Ross is describing. I would expect a warning or error if it couldn't find the patches while building, not when installing.
Yeah you are correct but I am not able to figure the reason for this behaviour.
Quoted 4 lines
Can you confirm you are building optee-examples, in addition to core-image-minimal/base?
See https://gitlab.com/jonmason00/meta-arm/-/jobs/1444856281#L3594Yeah I am building optee-examples in addition to core-image-minimal/base.
- Changes to default poky
conf/local.conf:MACHINE = "qemuarm64-secureboot"
CORE_IMAGE_EXTRA_INSTALL+= "optee-examples optee-test"- Changes to default poky
conf/bblayers.confwith additional layers as:meta-arm/meta-arm-toolchain
meta-arm/meta-armHere is optee-examples build folder directory structure for me:
$ tree tmp/work/qemuarm64_secureboot-poky-linux/optee-examples/3.14.0-r0/build/ tmp/work/qemuarm64_secureboot-poky-linux/optee-examples/3.14.0-r0/build/ ├── ca │ ├── optee_example_acipher │ ├── optee_example_aes │ ├── optee_example_hello_world │ ├── optee_example_hotp │ ├── optee_example_plugins │ ├── optee_example_random │ └── optee_example_secure_storage ├── plugins │ └── 96bcf744-4f72-4866-bf1d-8634fd9c65e5.plugin └── ta ├── 2a287631-de1b-4fdd-a55c-b9312e40769a.ta ├── 484d4143-2d53-4841-3120-4a6f636b6542.ta ├── 5dbac793-f574-4871-8ad3-04331ec17f24.ta ├── 8aaaf200-2450-11e4-abe2-0002a5d5c51b.ta ├── a734eed9-d6a1-4244-aa50-7c99719e7b7b.ta ├── b6c53aba-9669-4668-a7f2-205629d00f86.ta └── f4e750bb-1437-4fbf-8785-8d3580c34994.ta3 directories, 15 files
Quoted 3 lines
Looks to me like the issue is with newly added line
https://gitlab.com/jonmason00/meta-arm/-/blob/master-next/meta-arm/recipes-security/optee/optee-examples.inc#L39Looks like this link is pointing to a line where OP-TEE uprev patch isn't applied. Were you referring to following line?
+ install -D -p -m0444 ${B}/plugins/* ${D}${libdir}/tee-supplicant/plugins
As evident from optee-examples build folder above, the plugins directory shouldn't be empty for a successful optee-examples build.
-Sumit
Quoted 798 lines
Thanks,
JonQuoted 795 lines
-Sumit
Quoted 789 lines
Ross
Quoted 786 lines · Sumit Garg
Brief description of changes:
- Version uplift 3.11.0 -> 3.14.0.
- Removed OP-TEE patches that has already been accepted upstream.
- Added support for tee-supplicant plugin framework testing.Tested on
qemuarm64_secureboot:$ xtest -l 15 $ optee-examples_*Signed-off-by Sumit Garg <[email protected]>--- .../optee/optee-client_3.11.0.bb | 3 - .../optee/optee-client_3.14.0.bb | 3 + .../recipes-security/optee/optee-examples.inc | 9 +- .../0001-make-Pass-ldflags-during-link.patch | 103 ------------------ ...efault-cross-compiler-environment-se.patch | 84 ++++++++++++++ ...nable-plugins-installation-in-rootfs.patch | 39 +++++++ .../optee/optee-examples_3.11.0.bb | 4 - .../optee/optee-examples_3.14.0.bb | 4 + ...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 | 11 -- .../recipes-security/optee/optee-os_3.14.0.bb | 8 ++ .../recipes-security/optee/optee-test.inc | 15 +-- ...Adjust-order-of-including-compiler.h.patch | 64 ----------- ...ake-remove-Wno-unsafe-loop-for-clang.patch | 31 ------ ...e-remove-Wmissing-noreturn-for-clang.patch | 31 ------ .../optee/optee-test_3.11.0.bb | 3 - .../optee/optee-test_3.14.0.bb | 3 + 19 files changed, 154 insertions(+), 422 deletions(-) delete mode 100644 meta-arm/recipes-security/optee/optee-client_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-client_3.14.0.bb delete mode 100644 meta-arm/recipes-security/optee/optee-examples/0001-make-Pass-ldflags-during-link.patch create mode 100644 meta-arm/recipes-security/optee/optee-examples/0001-plugins-Honour-default-cross-compiler-environment-se.patch create mode 100644 meta-arm/recipes-security/optee/optee-examples/0002-Makefile-Enable-plugins-installation-in-rootfs.patch delete mode 100644 meta-arm/recipes-security/optee/optee-examples_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-examples_3.14.0.bb delete mode 100644 meta-arm/recipes-security/optee/optee-os/0001-libutils-provide-empty-__getauxval-implementation.patch delete mode 100644 meta-arm/recipes-security/optee/optee-os/0002-link.mk-implement-support-for-libnames-after-libgcc-.patch delete mode 100644 meta-arm/recipes-security/optee/optee-os/0003-ta_dev_kit.mk-make-sure-that-libutils-is-linked-seco.patch delete mode 100644 meta-arm/recipes-security/optee/optee-os_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-os_3.14.0.bb delete mode 100644 meta-arm/recipes-security/optee/optee-test/0001-host-xtest-Adjust-order-of-including-compiler.h.patch delete mode 100644 meta-arm/recipes-security/optee/optee-test/0002-make-remove-Wno-unsafe-loop-for-clang.patch delete mode 100644 meta-arm/recipes-security/optee/optee-test/0003-make-remove-Wmissing-noreturn-for-clang.patch delete mode 100644 meta-arm/recipes-security/optee/optee-test_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-test_3.14.0.bbmeta-arm/recipes-security/optee/optee-client_3.11.0.bb deleted +0
-3@@ -1,3 +0,0 @@ -require optee-client.inc - -SRCREV = "c0c925384c1d7e3558d27d2708857482952d7907"meta-arm/recipes-security/optee/optee-client_3.14.0.bb new file +3
-0@@ -0,0 +1,3 @@ +require optee-client.inc + +SRCREV = "06e1b32f6a7028e039c625b07cfc25fda0c17d53"meta-arm/recipes-security/optee/optee-examples.inc +7
-2@@ -12,7 +12,8 @@ inherit python3native require optee.inc SRC_URI = "git://github.com/linaro-swg/optee_examples.git \ - file://0001-make-Pass-ldflags-during-link.patch \ + file://0001-plugins-Honour-default-cross-compiler-environment-se.patch \ + file://0002-Makefile-Enable-plugins-installation-in-rootfs.patch \ " EXTRA_OEMAKE += "TA_DEV_KIT_DIR=${TA_DEV_KIT_DIR} \@@ -32,11 +33,15 @@ do_compile[cleandirs] = "${B}" do_install () { mkdir -p ${D}${nonarch_base_libdir}/optee_armtz mkdir -p ${D}${bindir} + mkdir -p ${D}${libdir}/tee-supplicant/plugins install -D -p -m0755 ${B}/ca/* ${D}${bindir} install -D -p -m0444 ${B}/ta/* ${D}${nonarch_base_libdir}/optee_armtz + install -D -p -m0444 ${B}/plugins/* ${D}${libdir}/tee-supplicant/plugins } -FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/" +FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/ \ + ${libdir}/tee-supplicant/plugins/ \ + " # Imports machine specific configs from staging to build PACKAGE_ARCH = "${MACHINE_ARCH}"meta-arm/recipes-security/optee/optee-examples/0001-make-Pass-ldflags-during-link.patch deleted +0
-103@@ -1,103 +0,0 @@ -From 29ae21de41f2fbab6dbecbbf408826b28de82df1 Mon Sep 17 00:00:00 2001 -From: Khem Raj <[email protected]> -Date: Tue, 1 Sep 2020 21:09:56 -0700 -Subject: [PATCH] make: Pass ldflags during link - -OpenEmbeeded needs to pass essential linker flags to set correct flags -for gnu_hash among others which sets the linking straight -using LDFLAGS varible here means, we can affect the linker flags -from build environment - -Upstream-Status: Submitted [https://github.com/linaro-swg/optee_examples/pull/85] - -Signed-off-by: Khem Raj <[email protected]> ---- - acipher/host/Makefile | 2 +- - aes/host/Makefile | 2 +- - hello_world/host/Makefile | 2 +- - hotp/host/Makefile | 2 +- - random/host/Makefile | 2 +- - secure_storage/host/Makefile | 2 +- - 6 files changed, 6 insertions(+), 6 deletions(-) - -diff --git a/acipher/host/Makefile b/acipher/host/Makefile -index 8f4bc8a..c2cabef 100644 ---- a/acipher/host/Makefile -+++ b/acipher/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_acipher - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/aes/host/Makefile b/aes/host/Makefile -index dfeb4e8..f61c71b 100644 ---- a/aes/host/Makefile -+++ b/aes/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_aes - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/hello_world/host/Makefile b/hello_world/host/Makefile -index c4c8239..69cf42c 100644 ---- a/hello_world/host/Makefile -+++ b/hello_world/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_hello_world - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/hotp/host/Makefile b/hotp/host/Makefile -index cb7fd19..e7f013f 100644 ---- a/hotp/host/Makefile -+++ b/hotp/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_hotp - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/random/host/Makefile b/random/host/Makefile -index fd407d9..9377f7a 100644 ---- a/random/host/Makefile -+++ b/random/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_random - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/secure_storage/host/Makefile b/secure_storage/host/Makefile -index 29bfb87..b3265ae 100644 ---- a/secure_storage/host/Makefile -+++ b/secure_storage/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_secure_storage - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: --- -2.28.0 -meta-arm/recipes-security/optee/optee-examples/0001-plugins-Honour-default-cross-compiler-environment-se.patch new file +84
-0@@ -0,0 +1,84 @@ +From 79c826c249001700007a6dffe80c3d61ff4428ef Mon Sep 17 00:00:00 2001 +From: Sumit Garg <[email protected]> +Date: Tue, 20 Jul 2021 13:54:30 +0530 +Subject: [PATCH 1/2] plugins: Honour default cross compiler environment setup + +Honour default $(CC), $(CFLAGS) and $(LDFLAGS) variables. Without this +plugins example fails to build for OE/Yocto. + +Upstream-Status: Submitted [https://github.com/linaro-swg/optee_examples/pull/87] + +Signed-off-by: Sumit Garg <[email protected]> +--- + plugins/Makefile | 2 +- + plugins/host/Makefile | 2 +- + plugins/syslog/Makefile | 16 ++++++++++++---- + 3 files changed, 14 insertions(+), 6 deletions(-) + +diff --git a/plugins/Makefile b/plugins/Makefile +index 2372b38..ea472b4 100644 +--- a/plugins/Makefile ++++ b/plugins/Makefile +@@ -8,7 +8,7 @@ TA_CROSS_COMPILE ?= $(CROSS_COMPILE) + all: + $(MAKE) -C host CROSS_COMPILE="$(HOST_CROSS_COMPILE)" --no-builtin-variables + $(MAKE) -C ta CROSS_COMPILE="$(TA_CROSS_COMPILE)" LDFLAGS="" +- $(MAKE) -C syslog CROSS_COMPILE="$(HOST_CROSS_COMPILE)" ++ $(MAKE) -C syslog CROSS_COMPILE="$(HOST_CROSS_COMPILE)" --no-builtin-variables + + .PHONY: clean + clean: +diff --git a/plugins/host/Makefile b/plugins/host/Makefile +index 7285104..76244c7 100644 +--- a/plugins/host/Makefile ++++ b/plugins/host/Makefile +@@ -20,7 +20,7 @@ BINARY = optee_example_plugins + all: $(BINARY) + + $(BINARY): $(OBJS) +- $(CC) -o $@ $< $(LDADD) ++ $(CC) $(LDFLAGS) -o $@ $< $(LDADD) + + .PHONY: clean + clean: +diff --git a/plugins/syslog/Makefile b/plugins/syslog/Makefile +index 62d916a..71f5f92 100644 +--- a/plugins/syslog/Makefile ++++ b/plugins/syslog/Makefile +@@ -1,3 +1,11 @@ ++CC ?= $(CROSS_COMPILE)gcc ++LD ?= $(CROSS_COMPILE)ld ++AR ?= $(CROSS_COMPILE)ar ++NM ?= $(CROSS_COMPILE)nm ++OBJCOPY ?= $(CROSS_COMPILE)objcopy ++OBJDUMP ?= $(CROSS_COMPILE)objdump ++READELF ?= $(CROSS_COMPILE)readelf ++ + PLUGIN_UUID = 96bcf744-4f72-4866-bf1d-8634fd9c65e5 + + PLUGIN = $(PLUGIN_UUID).plugin +@@ -6,17 +14,17 @@ PLUGIN_OBJ = $(patsubst %.c, %.o, $(PLUGIN_SRS)) + PLUGIN_INCLUDES_DIR = $(CURDIR) $(TEEC_EXPORT)/include + + PLUGIN_INCLUDES = $(addprefix -I, $(PLUGIN_INCLUDES_DIR)) +-PLUGIN_CCFLAGS = -Wall -fPIC +-PLUGIN_LDFLAGS = -shared ++PLUGIN_CCFLAGS = $(CFLAGS) -Wall -fPIC ++PLUGIN_LDFLAGS = $(LDFLAGS) -shared + + .PHONY: all + all: $(PLUGIN) + + $(PLUGIN): $(PLUGIN_OBJ) +- $(CROSS_COMPILE)gcc $(PLUGIN_LDFLAGS) $(PLUGIN_OBJ) -o $@ ++ $(CC) $(PLUGIN_LDFLAGS) $(PLUGIN_OBJ) -o $@ + + %.o: %.c +- $(CROSS_COMPILE)gcc $(PLUGIN_CCFLAGS) $(PLUGIN_INCLUDES) -c $*.c -o $*.o ++ $(CC) $(PLUGIN_CCFLAGS) $(PLUGIN_INCLUDES) -c $*.c -o $*.o + + .PHONY: clean + clean: +-- +2.25.1 +meta-arm/recipes-security/optee/optee-examples/0002-Makefile-Enable-plugins-installation-in-rootfs.patch new file +39
-0@@ -0,0 +1,39 @@ +From a865f2e25e178fc2c4617eb1faf79ac922d02ffd Mon Sep 17 00:00:00 2001 +From: Sumit Garg <[email protected]> +Date: Tue, 20 Jul 2021 14:20:10 +0530 +Subject: [PATCH 2/2] Makefile: Enable plugins installation in rootfs + +Upstream-Status: Submitted [https://github.com/linaro-swg/optee_examples/pull/87] + +Signed-off-by: Sumit Garg <[email protected]> +--- + Makefile | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/Makefile b/Makefile +index a275842..b3f16aa 100644 +--- a/Makefile ++++ b/Makefile +@@ -25,14 +25,19 @@ prepare-for-rootfs: examples + @mkdir -p $(OUTPUT_DIR) + @mkdir -p $(OUTPUT_DIR)/ta + @mkdir -p $(OUTPUT_DIR)/ca ++ @mkdir -p $(OUTPUT_DIR)/plugins + @for example in $(EXAMPLE_LIST); do \ + if [ -e $$example/host/optee_example_$$example ]; then \ + cp -p $$example/host/optee_example_$$example $(OUTPUT_DIR)/ca/; \ + fi; \ + cp -pr $$example/ta/*.ta $(OUTPUT_DIR)/ta/; \ ++ if [ $$example == plugins ]; then \ ++ cp -p plugins/syslog/*.plugin $(OUTPUT_DIR)/plugins/; \ ++ fi; \ + done + + prepare-for-rootfs-clean: + @rm -rf $(OUTPUT_DIR)/ta + @rm -rf $(OUTPUT_DIR)/ca ++ @rm -rf $(OUTPUT_DIR)/plugins + @rmdir --ignore-fail-on-non-empty $(OUTPUT_DIR) || test ! -e $(OUTPUT_DIR) +-- +2.25.1 +meta-arm/recipes-security/optee/optee-examples_3.11.0.bb deleted +0
-4@@ -1,4 +0,0 @@ -require optee-examples.inc - -SRCREV = "9a7dc598591990349d88b4dba3a37aadd6851295" -meta-arm/recipes-security/optee/optee-examples_3.14.0.bb new file +4
-0@@ -0,0 +1,4 @@ +require optee-examples.inc + +SRCREV = "e9c870525af8f7e7fccf575a0ca5394ce55adcec" +meta-arm/recipes-security/optee/optee-os/0001-libutils-provide-empty-__getauxval-implementation.patch deleted +0
-62@@ -1,62 +0,0 @@ -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 deleted +0
-55@@ -1,55 +0,0 @@ -Upstream-Status: Backport -Signed-off-by: Ross Burton <[email protected]> - -From 73196b58ea6978ffa5e581738030f51c5789ef73 Mon Sep 17 00:00:00 2001 -From: Volodymyr Babchuk <[email protected]> -Date: Tue, 13 Oct 2020 22:54:13 +0300 -Subject: [PATCH 2/3] link.mk: implement support for libnames-after-libgcc - variable - -Newer versions of libgcc depend on external __getauxval() symbol, which is -now provided by libutils. But libgcc is linked after libutils, so linker -can't resolve that symbol. We can't include libgcc into linking group with -libtutils, because libgcc provides symbols that conflict with libutil's -ones, like __aeabi_idiv with friends for instance. - -So, to resolve libgcc dependency on libutils we need to link with libutils -second time. To make things more generic, we will introduce -$(libnames-after-libgcc) variable for libraries that should be linked after -libgcc. - -Signed-off-by: Volodymyr Babchuk <[email protected]> -Reviewed-by: Jens Wiklander <[email protected]> -Reviewed-by: Jerome Forissier <[email protected]> ---- - ta/arch/arm/link.mk | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/ta/arch/arm/link.mk b/ta/arch/arm/link.mk -index 445c285d..3025acb1 100644 ---- a/ta/arch/arm/link.mk -+++ b/ta/arch/arm/link.mk -@@ -55,8 +55,11 @@ link-ldflags += --eh-frame-hdr - link-ldadd += $(libstdc++$(sm)) $(libgcc_eh$(sm)) - endif - link-ldadd += --end-group --ldargs-$(user-ta-uuid).elf := $(link-ldflags) $(objs) $(link-ldadd) $(libgcc$(sm)) - -+link-ldadd-after-libgcc += $(addprefix -l,$(libnames-after-libgcc)) -+ -+ldargs-$(user-ta-uuid).elf := $(link-ldflags) $(objs) $(link-ldadd) \ -+ $(libgcc$(sm)) $(link-ldadd-after-libgcc) - - link-script-cppflags-$(sm) := \ - $(filter-out $(CPPFLAGS_REMOVE) $(cppflags-remove), \ -@@ -76,6 +79,7 @@ $(link-script-pp$(sm)): $(link-script$(sm)) $(conf-file) $(link-script-pp-makefi - $(link-script-cppflags-$(sm)) $$< -o $$@ - - $(link-out-dir$(sm))/$(user-ta-uuid).elf: $(objs) $(libdeps) \ -+ $(libdeps-after-libgcc) \ - $(link-script-pp$(sm)) \ - $(dynlistdep) \ - $(additional-link-deps) --- -2.25.1 -meta-arm/recipes-security/optee/optee-os/0003-ta_dev_kit.mk-make-sure-that-libutils-is-linked-seco.patch deleted +0
-44@@ -1,44 +0,0 @@ -Upstream-Status: Backport -Signed-off-by: Ross Burton <[email protected]> - -From f50962e3f56f0932662b2ffa10afe53339a335dd Mon Sep 17 00:00:00 2001 -From: Volodymyr Babchuk <[email protected]> -Date: Fri, 16 Oct 2020 16:36:08 +0300 -Subject: [PATCH 3/3] ta_dev_kit.mk: make sure that libutils is linked second - time - -libgcc depends on __getauxval symbol from libuils. As, generally libutils -is linked before libgcc, we will get "unresolved symbol" error. To resolve -this dependency we need to link libutils second time - after libgcc. - -Signed-off-by: Volodymyr Babchuk <[email protected]> -Reviewed-by: Jens Wiklander <[email protected]> -Reviewed-by: Jerome Forissier <[email protected]> ---- - ta/mk/ta_dev_kit.mk | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/ta/mk/ta_dev_kit.mk b/ta/mk/ta_dev_kit.mk -index e28be677..d0e66317 100644 ---- a/ta/mk/ta_dev_kit.mk -+++ b/ta/mk/ta_dev_kit.mk -@@ -78,6 +78,16 @@ endif - libnames += dl - libdeps += $(ta-dev-kit-dir$(sm))/lib/libdl.a - -+# libutils provides __getauxval symbol which is needed by libgcc 10.x. We can't -+# link libutils after libgcc, because libgcc will replace some symbols provided -+# by libutils, which will cause further linking issues. -+# -+# But if we place libutils before libgcc, linker will not be able to resolve -+# __getauxval. So we need to link with libutils twice: before and after libgcc. -+# Hence it included both in $(libnames) and in $(libnames-after-libgcc) -+libnames-after-libgcc += utils -+libdeps-after-libgcc += $(ta-dev-kit-dir$(sm))/lib/libutils.a -+ - # Pass config variable (CFG_) from conf.mk on the command line - cppflags$(sm) += $(strip \ - $(foreach var, $(filter CFG_%,$(.VARIABLES)), \ --- -2.25.1 -meta-arm/recipes-security/optee/optee-os_3.11.0.bb deleted +0
-11@@ -1,11 +0,0 @@ -require optee-os.inc - -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 \ -"meta-arm/recipes-security/optee/optee-os_3.14.0.bb new file +8
-0@@ -0,0 +1,8 @@ +require optee-os.inc + +SRCREV = "d21befa5e53eae9db469eba1685f5aa5c6f92c2f" + +SRC_URI_append = " \ + file://0006-allow-setting-sysroot-for-libgcc-lookup.patch \ + file://0007-allow-setting-sysroot-for-clang.patch \ +"meta-arm/recipes-security/optee/optee-test.inc +6
-9@@ -8,17 +8,9 @@ LIC_FILES_CHKSUM = "file://${S}/LICENSE.md;md5=daa2bcccc666345ab8940aab1315a4fa" inherit python3native ptest require optee.inc -# Linking fails on musl due to C++/threads -# https://github.com/OP-TEE/optee_test/issues/458#issuecomment-720540834 -# When upgraded we should be able to remove this limitation -COMPATIBLE_HOST_libc-musl = 'null' - DEPENDS = "optee-client optee-os python3-pycryptodome-native" SRC_URI = "git://github.com/OP-TEE/optee_test.git \ - file://0001-host-xtest-Adjust-order-of-including-compiler.h.patch \ - file://0002-make-remove-Wno-unsafe-loop-for-clang.patch \ - file://0003-make-remove-Wmissing-noreturn-for-clang.patch \ file://run-ptest \ "@@ -36,6 +28,7 @@ do_compile() { # Top level makefile doesn't seem to handle parallel make gracefully oe_runmake xtest oe_runmake ta + oe_runmake test_plugin } do_compile[cleandirs] = "${B}"@@ -46,9 +39,13 @@ do_install () { # default TEEC_LOAD_PATH is /lib mkdir -p ${D}${nonarch_base_libdir}/optee_armtz/ install -D -p -m0444 ${B}/ta/*/*.ta ${D}${nonarch_base_libdir}/optee_armtz/ + mkdir -p ${D}${libdir}/tee-supplicant/plugins + install -D -p -m0444 ${B}/supp_plugin/*.plugin ${D}${libdir}/tee-supplicant/plugins/ } -FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/" +FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/ \ + ${libdir}/tee-supplicant/plugins/ \ + " # Imports machine specific configs from staging to build PACKAGE_ARCH = "${MACHINE_ARCH}"meta-arm/recipes-security/optee/optee-test/0001-host-xtest-Adjust-order-of-including-compiler.h.patch deleted +0
-64@@ -1,64 +0,0 @@ -From fc95b3ccbbfd336797ae2cfd6dd4dc58644e146f Mon Sep 17 00:00:00 2001 -From: Khem Raj <[email protected]> -Date: Sat, 30 May 2020 17:52:18 -0700 -Subject: [PATCH] host/xtest: Adjust order of including compiler.h - -compiler.h defines some defines which violate libc namespace e.g. -__unused, this works ok with glibc but fails in awkward ways with musl -the reason is musl uses __unused in its internal structures and this -define in compiler.h conflicts with system headers causing errors like - -recipe-sysroot/usr/include/bits/stat.h:17:19: error: expected identifier or '(' before '[' token unsigned __unused[2]; - ^ -including compiler.h afer sys/stat.h fixes the problem. - -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 +- - host/xtest/stats.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/host/xtest/install_ta.c b/host/xtest/install_ta.c -index 09a4c6d..6f7bb5c 100644 ---- a/host/xtest/install_ta.c -+++ b/host/xtest/install_ta.c -@@ -4,7 +4,6 @@ - * SPDX-License-Identifier: BSD-2-Clause - */ - --#include <compiler.h> - #include <dirent.h> - #include <err.h> - #include <errno.h> -@@ -20,6 +19,7 @@ - #include <sys/types.h> - #include <tee_client_api.h> - #include <unistd.h> -+#include <compiler.h> - - #include "install_ta.h" - #include "xtest_helpers.h" -diff --git a/host/xtest/stats.c b/host/xtest/stats.c -index 96b0b5f..db9bf25 100644 ---- a/host/xtest/stats.c -+++ b/host/xtest/stats.c -@@ -3,7 +3,6 @@ - * Copyright (c) 2019, Linaro Limited - */ - --#include <compiler.h> - #include <dirent.h> - #include <err.h> - #include <errno.h> -@@ -18,6 +17,7 @@ - #include <sys/types.h> - #include <tee_client_api.h> - #include <unistd.h> -+#include <compiler.h> - #include "xtest_test.h" - #include "stats.h" - --- -2.26.2 -meta-arm/recipes-security/optee/optee-test/0002-make-remove-Wno-unsafe-loop-for-clang.patch deleted +0
-31@@ -1,31 +0,0 @@ -From 438533ce9da1df0b7c7914e64b39ffdc1da1ab79 Mon Sep 17 00:00:00 2001 -From: Brett Warren <[email protected]> -Date: Thu, 8 Oct 2020 10:03:25 +0100 -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 [https://github.com/OP-TEE/optee_test/issues/452] -Changed-Id: 71cb511904547d790d1ea98f93bf8e5a6afcb36d -Signed-off-by: Brett Warren <[email protected]> ---- - host/xtest/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/host/xtest/Makefile b/host/xtest/Makefile -index 3c206b0..96746de 100644 ---- a/host/xtest/Makefile -+++ b/host/xtest/Makefile -@@ -169,7 +169,7 @@ CFLAGS += -Wall -Wcast-align -Werror \ - -Werror-implicit-function-declaration -Wextra -Wfloat-equal \ - -Wformat-nonliteral -Wformat-security -Wformat=2 -Winit-self \ - -Wmissing-declarations -Wmissing-format-attribute \ -- -Wmissing-include-dirs -Wmissing-noreturn \ -+ -Wmissing-include-dirs \ - -Wmissing-prototypes -Wnested-externs -Wpointer-arith \ - -Wshadow -Wstrict-prototypes -Wswitch-default \ - -Wwrite-strings \ --- -2.17.1 -meta-arm/recipes-security/optee/optee-test/0003-make-remove-Wmissing-noreturn-for-clang.patch deleted +0
-31@@ -1,31 +0,0 @@ -From ed5a9d9f7a3e9e14ca0e8aea59008124ee0e5f96 Mon Sep 17 00:00:00 2001 -From: Brett Warren <[email protected]> -Date: Thu, 8 Oct 2020 10:20:52 +0100 -Subject: [PATCH] make: remove -Wno-unsafe-loop for clang - -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 [https://github.com/OP-TEE/optee_test/issues/452] -Change-Id: 5fe0892c73208aaffac8c9995cb3275936fb1ba6 -Signed-off-by: Brett Warren <[email protected]> ---- - host/xtest/Makefile | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/host/xtest/Makefile b/host/xtest/Makefile -index 96746de..73731d0 100644 ---- a/host/xtest/Makefile -+++ b/host/xtest/Makefile -@@ -174,7 +174,6 @@ CFLAGS += -Wall -Wcast-align -Werror \ - -Wshadow -Wstrict-prototypes -Wswitch-default \ - -Wwrite-strings \ - -Wno-declaration-after-statement \ -- -Wno-unsafe-loop-optimizations \ - -Wno-missing-field-initializers -Wno-format-zero-length - endif - --- -2.17.1 -meta-arm/recipes-security/optee/optee-test_3.11.0.bb deleted +0
-3@@ -1,3 +0,0 @@ -require optee-test.inc - -SRCREV = "159e295d5cc3ad2275ab15fe544620f6604d4ba4"meta-arm/recipes-security/optee/optee-test_3.14.0.bb new file +3
-1@@ -0,0 +1,3 @@ +require optee-test.inc + +SRCREV = "f2eb88affbb7f028561b4fd5cbd049d5d704f741" --2.25.1
Quoted 4 lines · Ross Burton
Yes, that was it. == is a bashism, this line should use = instead:
https://github.com/linaro-swg/optee_examples/blob/master/Makefile#L34
Thanks Ross for catching it, I will fix it up in v2.
Quoted 3 lines
And a makefile that doesn't eat errors would be helpful too.
Agree, I will create a fix for upstream that should take care of this as well.
-Sumit
Quoted 907 lines
Ross
Quoted 904 lines · Ross Burton
Ah, this might be the problem from log.do_compile:
Copying example CA and TA binaries to /yocto/ross/build/tmp/work/qemuarm64_secureboot-poky-linux/optee-examples/3.14.0-r0/build...
/bin/sh: 6: [: acipher: unexpected operator/bin/sh: 6: [: plugins: unexpected operator/bin/sh: 6: [:hello_world: unexpected operator/bin/sh: 6: [: hotp: unexpected operator/bin/sh: 6: [: aes: unexpected operator/bin/sh: 6: [: random: unexpected operator/bin/sh: 6: [:secure_storage: unexpected operatorRoss
Quoted 888 lines · Sumit Garg
Hi Jon,
Quoted 20 lines · Jon Mason
Quoted 18 lines · Sumit Garg
Hi Ross,
Quoted 9 lines · Ross Burton
The optee-examples recipe is broken:
install: cannot stat '/builds/engineering/yocto/meta-arm/work/build/tmp/work/qemuarm64_secureboot-poky-linux/optee-examples/3.14.0-r0/build/plugins/*':
No such file or directory(qemuarm64-secureboot can build it)
Strangely, it works fine for me when building for qemuarm64-secureboot. Can you check if the following patches have been correctly applied in the corresponding work directory?
Quoted 7 lines
Quoted 3 lines
file://0001-plugins-Honour-default-cross-compiler-environment-se.patch
\ file://0002-Makefile-Enable-plugins-installation-in-rootfs.patch \I'm seeing the same issue Ross is describing. I would expect a warning or error if it couldn't find the patches while building, not when installing.
Yeah you are correct but I am not able to figure the reason for this behaviour.
Quoted 4 lines
Can you confirm you are building optee-examples, in addition to core-image-minimal/base?
See https://gitlab.com/jonmason00/meta-arm/-/jobs/1444856281#L3594Yeah I am building optee-examples in addition to core-image-minimal/base.
- Changes to default poky
conf/local.conf:MACHINE = "qemuarm64-secureboot"
CORE_IMAGE_EXTRA_INSTALL+= "optee-examples optee-test"- Changes to default poky
conf/bblayers.confwith additional layers as:meta-arm/meta-arm-toolchain
meta-arm/meta-armHere is optee-examples build folder directory structure for me:
$ tree tmp/work/qemuarm64_secureboot-poky-linux/optee-examples/3.14.0-r0/build/ tmp/work/qemuarm64_secureboot-poky-linux/optee-examples/3.14.0-r0/build/ ├── ca │ ├── optee_example_acipher │ ├── optee_example_aes │ ├── optee_example_hello_world │ ├── optee_example_hotp │ ├── optee_example_plugins │ ├── optee_example_random │ └── optee_example_secure_storage ├── plugins │ └── 96bcf744-4f72-4866-bf1d-8634fd9c65e5.plugin └── ta ├── 2a287631-de1b-4fdd-a55c-b9312e40769a.ta ├── 484d4143-2d53-4841-3120-4a6f636b6542.ta ├── 5dbac793-f574-4871-8ad3-04331ec17f24.ta ├── 8aaaf200-2450-11e4-abe2-0002a5d5c51b.ta ├── a734eed9-d6a1-4244-aa50-7c99719e7b7b.ta ├── b6c53aba-9669-4668-a7f2-205629d00f86.ta └── f4e750bb-1437-4fbf-8785-8d3580c34994.ta3 directories, 15 files
Quoted 3 lines
Looks to me like the issue is with newly added line
https://gitlab.com/jonmason00/meta-arm/-/blob/master-next/meta-arm/recipes-security/optee/optee-examples.inc#L39Looks like this link is pointing to a line where OP-TEE uprev patch isn't applied. Were you referring to following line?
+ install -D -p -m0444 ${B}/plugins/* ${D}${libdir}/tee-supplicant/plugins
As evident from optee-examples build folder above, the plugins directory shouldn't be empty for a successful optee-examples build.
-Sumit
Quoted 798 lines
Thanks,
JonQuoted 795 lines
-Sumit
Quoted 789 lines
Ross
Quoted 786 lines · Sumit Garg
Brief description of changes:
- Version uplift 3.11.0 -> 3.14.0.
- Removed OP-TEE patches that has already been accepted upstream.
- Added support for tee-supplicant plugin framework testing.Tested on
qemuarm64_secureboot:$ xtest -l 15 $ optee-examples_*Signed-off-by Sumit Garg <[email protected]>--- .../optee/optee-client_3.11.0.bb | 3 - .../optee/optee-client_3.14.0.bb | 3 + .../recipes-security/optee/optee-examples.inc | 9 +- .../0001-make-Pass-ldflags-during-link.patch | 103 ------------------ ...efault-cross-compiler-environment-se.patch | 84 ++++++++++++++ ...nable-plugins-installation-in-rootfs.patch | 39 +++++++ .../optee/optee-examples_3.11.0.bb | 4 - .../optee/optee-examples_3.14.0.bb | 4 + ...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 | 11 -- .../recipes-security/optee/optee-os_3.14.0.bb | 8 ++ .../recipes-security/optee/optee-test.inc | 15 +-- ...Adjust-order-of-including-compiler.h.patch | 64 ----------- ...ake-remove-Wno-unsafe-loop-for-clang.patch | 31 ------ ...e-remove-Wmissing-noreturn-for-clang.patch | 31 ------ .../optee/optee-test_3.11.0.bb | 3 - .../optee/optee-test_3.14.0.bb | 3 + 19 files changed, 154 insertions(+), 422 deletions(-) delete mode 100644 meta-arm/recipes-security/optee/optee-client_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-client_3.14.0.bb delete mode 100644 meta-arm/recipes-security/optee/optee-examples/0001-make-Pass-ldflags-during-link.patch create mode 100644 meta-arm/recipes-security/optee/optee-examples/0001-plugins-Honour-default-cross-compiler-environment-se.patch create mode 100644 meta-arm/recipes-security/optee/optee-examples/0002-Makefile-Enable-plugins-installation-in-rootfs.patch delete mode 100644 meta-arm/recipes-security/optee/optee-examples_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-examples_3.14.0.bb delete mode 100644 meta-arm/recipes-security/optee/optee-os/0001-libutils-provide-empty-__getauxval-implementation.patch delete mode 100644 meta-arm/recipes-security/optee/optee-os/0002-link.mk-implement-support-for-libnames-after-libgcc-.patch delete mode 100644 meta-arm/recipes-security/optee/optee-os/0003-ta_dev_kit.mk-make-sure-that-libutils-is-linked-seco.patch delete mode 100644 meta-arm/recipes-security/optee/optee-os_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-os_3.14.0.bb delete mode 100644 meta-arm/recipes-security/optee/optee-test/0001-host-xtest-Adjust-order-of-including-compiler.h.patch delete mode 100644 meta-arm/recipes-security/optee/optee-test/0002-make-remove-Wno-unsafe-loop-for-clang.patch delete mode 100644 meta-arm/recipes-security/optee/optee-test/0003-make-remove-Wmissing-noreturn-for-clang.patch delete mode 100644 meta-arm/recipes-security/optee/optee-test_3.11.0.bb create mode 100644 meta-arm/recipes-security/optee/optee-test_3.14.0.bbmeta-arm/recipes-security/optee/optee-client_3.11.0.bb deleted +0
-3@@ -1,3 +0,0 @@ -require optee-client.inc - -SRCREV = "c0c925384c1d7e3558d27d2708857482952d7907"meta-arm/recipes-security/optee/optee-client_3.14.0.bb new file +3
-0@@ -0,0 +1,3 @@ +require optee-client.inc + +SRCREV = "06e1b32f6a7028e039c625b07cfc25fda0c17d53"meta-arm/recipes-security/optee/optee-examples.inc +7
-2@@ -12,7 +12,8 @@ inherit python3native require optee.inc SRC_URI = "git://github.com/linaro-swg/optee_examples.git \ - file://0001-make-Pass-ldflags-during-link.patch \ + file://0001-plugins-Honour-default-cross-compiler-environment-se.patch \ + file://0002-Makefile-Enable-plugins-installation-in-rootfs.patch \ " EXTRA_OEMAKE += "TA_DEV_KIT_DIR=${TA_DEV_KIT_DIR} \@@ -32,11 +33,15 @@ do_compile[cleandirs] = "${B}" do_install () { mkdir -p ${D}${nonarch_base_libdir}/optee_armtz mkdir -p ${D}${bindir} + mkdir -p ${D}${libdir}/tee-supplicant/plugins install -D -p -m0755 ${B}/ca/* ${D}${bindir} install -D -p -m0444 ${B}/ta/* ${D}${nonarch_base_libdir}/optee_armtz + install -D -p -m0444 ${B}/plugins/* ${D}${libdir}/tee-supplicant/plugins } -FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/" +FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/ \ + ${libdir}/tee-supplicant/plugins/ \ + " # Imports machine specific configs from staging to build PACKAGE_ARCH = "${MACHINE_ARCH}"meta-arm/recipes-security/optee/optee-examples/0001-make-Pass-ldflags-during-link.patch deleted +0
-103@@ -1,103 +0,0 @@ -From 29ae21de41f2fbab6dbecbbf408826b28de82df1 Mon Sep 17 00:00:00 2001 -From: Khem Raj <[email protected]> -Date: Tue, 1 Sep 2020 21:09:56 -0700 -Subject: [PATCH] make: Pass ldflags during link - -OpenEmbeeded needs to pass essential linker flags to set correct flags -for gnu_hash among others which sets the linking straight -using LDFLAGS varible here means, we can affect the linker flags -from build environment - -Upstream-Status: Submitted [https://github.com/linaro-swg/optee_examples/pull/85] - -Signed-off-by: Khem Raj <[email protected]> ---- - acipher/host/Makefile | 2 +- - aes/host/Makefile | 2 +- - hello_world/host/Makefile | 2 +- - hotp/host/Makefile | 2 +- - random/host/Makefile | 2 +- - secure_storage/host/Makefile | 2 +- - 6 files changed, 6 insertions(+), 6 deletions(-) - -diff --git a/acipher/host/Makefile b/acipher/host/Makefile -index 8f4bc8a..c2cabef 100644 ---- a/acipher/host/Makefile -+++ b/acipher/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_acipher - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/aes/host/Makefile b/aes/host/Makefile -index dfeb4e8..f61c71b 100644 ---- a/aes/host/Makefile -+++ b/aes/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_aes - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/hello_world/host/Makefile b/hello_world/host/Makefile -index c4c8239..69cf42c 100644 ---- a/hello_world/host/Makefile -+++ b/hello_world/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_hello_world - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/hotp/host/Makefile b/hotp/host/Makefile -index cb7fd19..e7f013f 100644 ---- a/hotp/host/Makefile -+++ b/hotp/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_hotp - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/random/host/Makefile b/random/host/Makefile -index fd407d9..9377f7a 100644 ---- a/random/host/Makefile -+++ b/random/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_random - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: -diff --git a/secure_storage/host/Makefile b/secure_storage/host/Makefile -index 29bfb87..b3265ae 100644 ---- a/secure_storage/host/Makefile -+++ b/secure_storage/host/Makefile -@@ -18,7 +18,7 @@ BINARY = optee_example_secure_storage - all: $(BINARY) - - $(BINARY): $(OBJS) -- $(CC) -o $@ $< $(LDADD) -+ $(CC) -o $@ $< $(LDFLAGS) $(LDADD) - - .PHONY: clean - clean: --- -2.28.0 -meta-arm/recipes-security/optee/optee-examples/0001-plugins-Honour-default-cross-compiler-environment-se.patch new file +84
-0@@ -0,0 +1,84 @@ +From 79c826c249001700007a6dffe80c3d61ff4428ef Mon Sep 17 00:00:00 2001 +From: Sumit Garg <[email protected]> +Date: Tue, 20 Jul 2021 13:54:30 +0530 +Subject: [PATCH 1/2] plugins: Honour default cross compiler environment setup + +Honour default $(CC), $(CFLAGS) and $(LDFLAGS) variables. Without this +plugins example fails to build for OE/Yocto. + +Upstream-Status: Submitted [https://github.com/linaro-swg/optee_examples/pull/87] + +Signed-off-by: Sumit Garg <[email protected]> +--- + plugins/Makefile | 2 +- + plugins/host/Makefile | 2 +- + plugins/syslog/Makefile | 16 ++++++++++++---- + 3 files changed, 14 insertions(+), 6 deletions(-) + +diff --git a/plugins/Makefile b/plugins/Makefile +index 2372b38..ea472b4 100644 +--- a/plugins/Makefile ++++ b/plugins/Makefile +@@ -8,7 +8,7 @@ TA_CROSS_COMPILE ?= $(CROSS_COMPILE) + all: + $(MAKE) -C host CROSS_COMPILE="$(HOST_CROSS_COMPILE)" --no-builtin-variables + $(MAKE) -C ta CROSS_COMPILE="$(TA_CROSS_COMPILE)" LDFLAGS="" +- $(MAKE) -C syslog CROSS_COMPILE="$(HOST_CROSS_COMPILE)" ++ $(MAKE) -C syslog CROSS_COMPILE="$(HOST_CROSS_COMPILE)" --no-builtin-variables + + .PHONY: clean + clean: +diff --git a/plugins/host/Makefile b/plugins/host/Makefile +index 7285104..76244c7 100644 +--- a/plugins/host/Makefile ++++ b/plugins/host/Makefile +@@ -20,7 +20,7 @@ BINARY = optee_example_plugins + all: $(BINARY) + + $(BINARY): $(OBJS) +- $(CC) -o $@ $< $(LDADD) ++ $(CC) $(LDFLAGS) -o $@ $< $(LDADD) + + .PHONY: clean + clean: +diff --git a/plugins/syslog/Makefile b/plugins/syslog/Makefile +index 62d916a..71f5f92 100644 +--- a/plugins/syslog/Makefile ++++ b/plugins/syslog/Makefile +@@ -1,3 +1,11 @@ ++CC ?= $(CROSS_COMPILE)gcc ++LD ?= $(CROSS_COMPILE)ld ++AR ?= $(CROSS_COMPILE)ar ++NM ?= $(CROSS_COMPILE)nm ++OBJCOPY ?= $(CROSS_COMPILE)objcopy ++OBJDUMP ?= $(CROSS_COMPILE)objdump ++READELF ?= $(CROSS_COMPILE)readelf ++ + PLUGIN_UUID = 96bcf744-4f72-4866-bf1d-8634fd9c65e5 + + PLUGIN = $(PLUGIN_UUID).plugin +@@ -6,17 +14,17 @@ PLUGIN_OBJ = $(patsubst %.c, %.o, $(PLUGIN_SRS)) + PLUGIN_INCLUDES_DIR = $(CURDIR) $(TEEC_EXPORT)/include + + PLUGIN_INCLUDES = $(addprefix -I, $(PLUGIN_INCLUDES_DIR)) +-PLUGIN_CCFLAGS = -Wall -fPIC +-PLUGIN_LDFLAGS = -shared ++PLUGIN_CCFLAGS = $(CFLAGS) -Wall -fPIC ++PLUGIN_LDFLAGS = $(LDFLAGS) -shared + + .PHONY: all + all: $(PLUGIN) + + $(PLUGIN): $(PLUGIN_OBJ) +- $(CROSS_COMPILE)gcc $(PLUGIN_LDFLAGS) $(PLUGIN_OBJ) -o $@ ++ $(CC) $(PLUGIN_LDFLAGS) $(PLUGIN_OBJ) -o $@ + + %.o: %.c +- $(CROSS_COMPILE)gcc $(PLUGIN_CCFLAGS) $(PLUGIN_INCLUDES) -c $*.c -o $*.o ++ $(CC) $(PLUGIN_CCFLAGS) $(PLUGIN_INCLUDES) -c $*.c -o $*.o + + .PHONY: clean + clean: +-- +2.25.1 +meta-arm/recipes-security/optee/optee-examples/0002-Makefile-Enable-plugins-installation-in-rootfs.patch new file +39
-0@@ -0,0 +1,39 @@ +From a865f2e25e178fc2c4617eb1faf79ac922d02ffd Mon Sep 17 00:00:00 2001 +From: Sumit Garg <[email protected]> +Date: Tue, 20 Jul 2021 14:20:10 +0530 +Subject: [PATCH 2/2] Makefile: Enable plugins installation in rootfs + +Upstream-Status: Submitted [https://github.com/linaro-swg/optee_examples/pull/87] + +Signed-off-by: Sumit Garg <[email protected]> +--- + Makefile | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/Makefile b/Makefile +index a275842..b3f16aa 100644 +--- a/Makefile ++++ b/Makefile +@@ -25,14 +25,19 @@ prepare-for-rootfs: examples + @mkdir -p $(OUTPUT_DIR) + @mkdir -p $(OUTPUT_DIR)/ta + @mkdir -p $(OUTPUT_DIR)/ca ++ @mkdir -p $(OUTPUT_DIR)/plugins + @for example in $(EXAMPLE_LIST); do \ + if [ -e $$example/host/optee_example_$$example ]; then \ + cp -p $$example/host/optee_example_$$example $(OUTPUT_DIR)/ca/; \ + fi; \ + cp -pr $$example/ta/*.ta $(OUTPUT_DIR)/ta/; \ ++ if [ $$example == plugins ]; then \ ++ cp -p plugins/syslog/*.plugin $(OUTPUT_DIR)/plugins/; \ ++ fi; \ + done + + prepare-for-rootfs-clean: + @rm -rf $(OUTPUT_DIR)/ta + @rm -rf $(OUTPUT_DIR)/ca ++ @rm -rf $(OUTPUT_DIR)/plugins + @rmdir --ignore-fail-on-non-empty $(OUTPUT_DIR) || test ! -e $(OUTPUT_DIR) +-- +2.25.1 +meta-arm/recipes-security/optee/optee-examples_3.11.0.bb deleted +0
-4@@ -1,4 +0,0 @@ -require optee-examples.inc - -SRCREV = "9a7dc598591990349d88b4dba3a37aadd6851295" -meta-arm/recipes-security/optee/optee-examples_3.14.0.bb new file +4
-0@@ -0,0 +1,4 @@ +require optee-examples.inc + +SRCREV = "e9c870525af8f7e7fccf575a0ca5394ce55adcec" +meta-arm/recipes-security/optee/optee-os/0001-libutils-provide-empty-__getauxval-implementation.patch deleted +0
-62@@ -1,62 +0,0 @@ -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 deleted +0
-55@@ -1,55 +0,0 @@ -Upstream-Status: Backport -Signed-off-by: Ross Burton <[email protected]> - -From 73196b58ea6978ffa5e581738030f51c5789ef73 Mon Sep 17 00:00:00 2001 -From: Volodymyr Babchuk <[email protected]> -Date: Tue, 13 Oct 2020 22:54:13 +0300 -Subject: [PATCH 2/3] link.mk: implement support for libnames-after-libgcc - variable - -Newer versions of libgcc depend on external __getauxval() symbol, which is -now provided by libutils. But libgcc is linked after libutils, so linker -can't resolve that symbol. We can't include libgcc into linking group with -libtutils, because libgcc provides symbols that conflict with libutil's -ones, like __aeabi_idiv with friends for instance. - -So, to resolve libgcc dependency on libutils we need to link with libutils -second time. To make things more generic, we will introduce -$(libnames-after-libgcc) variable for libraries that should be linked after -libgcc. - -Signed-off-by: Volodymyr Babchuk <[email protected]> -Reviewed-by: Jens Wiklander <[email protected]> -Reviewed-by: Jerome Forissier <[email protected]> ---- - ta/arch/arm/link.mk | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/ta/arch/arm/link.mk b/ta/arch/arm/link.mk -index 445c285d..3025acb1 100644 ---- a/ta/arch/arm/link.mk -+++ b/ta/arch/arm/link.mk -@@ -55,8 +55,11 @@ link-ldflags += --eh-frame-hdr - link-ldadd += $(libstdc++$(sm)) $(libgcc_eh$(sm)) - endif - link-ldadd += --end-group --ldargs-$(user-ta-uuid).elf := $(link-ldflags) $(objs) $(link-ldadd) $(libgcc$(sm)) - -+link-ldadd-after-libgcc += $(addprefix -l,$(libnames-after-libgcc)) -+ -+ldargs-$(user-ta-uuid).elf := $(link-ldflags) $(objs) $(link-ldadd) \ -+ $(libgcc$(sm)) $(link-ldadd-after-libgcc) - - link-script-cppflags-$(sm) := \ - $(filter-out $(CPPFLAGS_REMOVE) $(cppflags-remove), \ -@@ -76,6 +79,7 @@ $(link-script-pp$(sm)): $(link-script$(sm)) $(conf-file) $(link-script-pp-makefi - $(link-script-cppflags-$(sm)) $$< -o $$@ - - $(link-out-dir$(sm))/$(user-ta-uuid).elf: $(objs) $(libdeps) \ -+ $(libdeps-after-libgcc) \ - $(link-script-pp$(sm)) \ - $(dynlistdep) \ - $(additional-link-deps) --- -2.25.1 -meta-arm/recipes-security/optee/optee-os/0003-ta_dev_kit.mk-make-sure-that-libutils-is-linked-seco.patch deleted +0
-44@@ -1,44 +0,0 @@ -Upstream-Status: Backport -Signed-off-by: Ross Burton <[email protected]> - -From f50962e3f56f0932662b2ffa10afe53339a335dd Mon Sep 17 00:00:00 2001 -From: Volodymyr Babchuk <[email protected]> -Date: Fri, 16 Oct 2020 16:36:08 +0300 -Subject: [PATCH 3/3] ta_dev_kit.mk: make sure that libutils is linked second - time - -libgcc depends on __getauxval symbol from libuils. As, generally libutils -is linked before libgcc, we will get "unresolved symbol" error. To resolve -this dependency we need to link libutils second time - after libgcc. - -Signed-off-by: Volodymyr Babchuk <[email protected]> -Reviewed-by: Jens Wiklander <[email protected]> -Reviewed-by: Jerome Forissier <[email protected]> ---- - ta/mk/ta_dev_kit.mk | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/ta/mk/ta_dev_kit.mk b/ta/mk/ta_dev_kit.mk -index e28be677..d0e66317 100644 ---- a/ta/mk/ta_dev_kit.mk -+++ b/ta/mk/ta_dev_kit.mk -@@ -78,6 +78,16 @@ endif - libnames += dl - libdeps += $(ta-dev-kit-dir$(sm))/lib/libdl.a - -+# libutils provides __getauxval symbol which is needed by libgcc 10.x. We can't -+# link libutils after libgcc, because libgcc will replace some symbols provided -+# by libutils, which will cause further linking issues. -+# -+# But if we place libutils before libgcc, linker will not be able to resolve -+# __getauxval. So we need to link with libutils twice: before and after libgcc. -+# Hence it included both in $(libnames) and in $(libnames-after-libgcc) -+libnames-after-libgcc += utils -+libdeps-after-libgcc += $(ta-dev-kit-dir$(sm))/lib/libutils.a -+ - # Pass config variable (CFG_) from conf.mk on the command line - cppflags$(sm) += $(strip \ - $(foreach var, $(filter CFG_%,$(.VARIABLES)), \ --- -2.25.1 -meta-arm/recipes-security/optee/optee-os_3.11.0.bb deleted +0
-11@@ -1,11 +0,0 @@ -require optee-os.inc - -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 \ -"meta-arm/recipes-security/optee/optee-os_3.14.0.bb new file +8
-0@@ -0,0 +1,8 @@ +require optee-os.inc + +SRCREV = "d21befa5e53eae9db469eba1685f5aa5c6f92c2f" + +SRC_URI_append = " \ + file://0006-allow-setting-sysroot-for-libgcc-lookup.patch \ + file://0007-allow-setting-sysroot-for-clang.patch \ +"meta-arm/recipes-security/optee/optee-test.inc +6
-9@@ -8,17 +8,9 @@ LIC_FILES_CHKSUM = "file://${S}/LICENSE.md;md5=daa2bcccc666345ab8940aab1315a4fa" inherit python3native ptest require optee.inc -# Linking fails on musl due to C++/threads -# https://github.com/OP-TEE/optee_test/issues/458#issuecomment-720540834 -# When upgraded we should be able to remove this limitation -COMPATIBLE_HOST_libc-musl = 'null' - DEPENDS = "optee-client optee-os python3-pycryptodome-native" SRC_URI = "git://github.com/OP-TEE/optee_test.git \ - file://0001-host-xtest-Adjust-order-of-including-compiler.h.patch \ - file://0002-make-remove-Wno-unsafe-loop-for-clang.patch \ - file://0003-make-remove-Wmissing-noreturn-for-clang.patch \ file://run-ptest \ "@@ -36,6 +28,7 @@ do_compile() { # Top level makefile doesn't seem to handle parallel make gracefully oe_runmake xtest oe_runmake ta + oe_runmake test_plugin } do_compile[cleandirs] = "${B}"@@ -46,9 +39,13 @@ do_install () { # default TEEC_LOAD_PATH is /lib mkdir -p ${D}${nonarch_base_libdir}/optee_armtz/ install -D -p -m0444 ${B}/ta/*/*.ta ${D}${nonarch_base_libdir}/optee_armtz/ + mkdir -p ${D}${libdir}/tee-supplicant/plugins + install -D -p -m0444 ${B}/supp_plugin/*.plugin ${D}${libdir}/tee-supplicant/plugins/ } -FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/" +FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/ \ + ${libdir}/tee-supplicant/plugins/ \ + " # Imports machine specific configs from staging to build PACKAGE_ARCH = "${MACHINE_ARCH}"meta-arm/recipes-security/optee/optee-test/0001-host-xtest-Adjust-order-of-including-compiler.h.patch deleted +0
-64@@ -1,64 +0,0 @@ -From fc95b3ccbbfd336797ae2cfd6dd4dc58644e146f Mon Sep 17 00:00:00 2001 -From: Khem Raj <[email protected]> -Date: Sat, 30 May 2020 17:52:18 -0700 -Subject: [PATCH] host/xtest: Adjust order of including compiler.h - -compiler.h defines some defines which violate libc namespace e.g. -__unused, this works ok with glibc but fails in awkward ways with musl -the reason is musl uses __unused in its internal structures and this -define in compiler.h conflicts with system headers causing errors like - -recipe-sysroot/usr/include/bits/stat.h:17:19: error: expected identifier or '(' before '[' token unsigned __unused[2]; - ^ -including compiler.h afer sys/stat.h fixes the problem. - -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 +- - host/xtest/stats.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/host/xtest/install_ta.c b/host/xtest/install_ta.c -index 09a4c6d..6f7bb5c 100644 ---- a/host/xtest/install_ta.c -+++ b/host/xtest/install_ta.c -@@ -4,7 +4,6 @@ - * SPDX-License-Identifier: BSD-2-Clause - */ - --#include <compiler.h> - #include <dirent.h> - #include <err.h> - #include <errno.h> -@@ -20,6 +19,7 @@ - #include <sys/types.h> - #include <tee_client_api.h> - #include <unistd.h> -+#include <compiler.h> - - #include "install_ta.h" - #include "xtest_helpers.h" -diff --git a/host/xtest/stats.c b/host/xtest/stats.c -index 96b0b5f..db9bf25 100644 ---- a/host/xtest/stats.c -+++ b/host/xtest/stats.c -@@ -3,7 +3,6 @@ - * Copyright (c) 2019, Linaro Limited - */ - --#include <compiler.h> - #include <dirent.h> - #include <err.h> - #include <errno.h> -@@ -18,6 +17,7 @@ - #include <sys/types.h> - #include <tee_client_api.h> - #include <unistd.h> -+#include <compiler.h> - #include "xtest_test.h" - #include "stats.h" - --- -2.26.2 -meta-arm/recipes-security/optee/optee-test/0002-make-remove-Wno-unsafe-loop-for-clang.patch deleted +0
-31@@ -1,31 +0,0 @@ -From 438533ce9da1df0b7c7914e64b39ffdc1da1ab79 Mon Sep 17 00:00:00 2001 -From: Brett Warren <[email protected]> -Date: Thu, 8 Oct 2020 10:03:25 +0100 -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 [https://github.com/OP-TEE/optee_test/issues/452] -Changed-Id: 71cb511904547d790d1ea98f93bf8e5a6afcb36d -Signed-off-by: Brett Warren <[email protected]> ---- - host/xtest/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/host/xtest/Makefile b/host/xtest/Makefile -index 3c206b0..96746de 100644 ---- a/host/xtest/Makefile -+++ b/host/xtest/Makefile -@@ -169,7 +169,7 @@ CFLAGS += -Wall -Wcast-align -Werror \ - -Werror-implicit-function-declaration -Wextra -Wfloat-equal \ - -Wformat-nonliteral -Wformat-security -Wformat=2 -Winit-self \ - -Wmissing-declarations -Wmissing-format-attribute \ -- -Wmissing-include-dirs -Wmissing-noreturn \ -+ -Wmissing-include-dirs \ - -Wmissing-prototypes -Wnested-externs -Wpointer-arith \ - -Wshadow -Wstrict-prototypes -Wswitch-default \ - -Wwrite-strings \ --- -2.17.1 -meta-arm/recipes-security/optee/optee-test/0003-make-remove-Wmissing-noreturn-for-clang.patch deleted +0
-31@@ -1,31 +0,0 @@ -From ed5a9d9f7a3e9e14ca0e8aea59008124ee0e5f96 Mon Sep 17 00:00:00 2001 -From: Brett Warren <[email protected]> -Date: Thu, 8 Oct 2020 10:20:52 +0100 -Subject: [PATCH] make: remove -Wno-unsafe-loop for clang - -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 [https://github.com/OP-TEE/optee_test/issues/452] -Change-Id: 5fe0892c73208aaffac8c9995cb3275936fb1ba6 -Signed-off-by: Brett Warren <[email protected]> ---- - host/xtest/Makefile | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/host/xtest/Makefile b/host/xtest/Makefile -index 96746de..73731d0 100644 ---- a/host/xtest/Makefile -+++ b/host/xtest/Makefile -@@ -174,7 +174,6 @@ CFLAGS += -Wall -Wcast-align -Werror \ - -Wshadow -Wstrict-prototypes -Wswitch-default \ - -Wwrite-strings \ - -Wno-declaration-after-statement \ -- -Wno-unsafe-loop-optimizations \ - -Wno-missing-field-initializers -Wno-format-zero-length - endif - --- -2.17.1 -meta-arm/recipes-security/optee/optee-test_3.11.0.bb deleted +0
-3@@ -1,3 +0,0 @@ -require optee-test.inc - -SRCREV = "159e295d5cc3ad2275ab15fe544620f6604d4ba4"meta-arm/recipes-security/optee/optee-test_3.14.0.bb new file +3
-1@@ -0,0 +1,3 @@ +require optee-test.inc + +SRCREV = "f2eb88affbb7f028561b4fd5cbd049d5d704f741" --2.25.1