Skip to contentSkip to conversation

optee-os: update recipe to pick 3.11

PATCH In review [email protected] 2 participants 3 messages Dec 12, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 optee-os: update recipe to pick 3.11

From: Praneeth Bajjuri <[email protected]>

meta-arm where the optee-os_git.bb recipe is present, still is on 3.8 version on dunfell branch.

This patch is to upgrade SRCREV to pick 3.11 from
repo: ti-optee-os.git
branch: ti-optee-os

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

55 lines not on this page · raw message

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

44 lines not on this page · raw message

meta-arago-distro/recipes-security/optee/optee-os/0006-allow-setting-sysroot-for-libgcc-lookup.patch new file +34 -0
new file mode 100644
index 00000000..17005396
@@ -0,0 +1,34 @@
+From 0bab935695ebcf0c533b49896ab18ff33d4a47d1 Mon Sep 17 00:00:00 2001
+From: Ross Burton <[email protected]>
+Date: Tue, 26 May 2020 14:38:02 -0500
+Subject: [PATCH] allow setting sysroot for libgcc lookup
+
+Explicitly pass the new variable LIBGCC_LOCATE_CFLAGS variable when searching
+for the compiler libraries as there's no easy way to reliably pass --sysroot
+otherwise.
+
+Upstream-Status: Pending [https://github.com/OP-TEE/optee_os/issues/4188]
+Signed-off-by: Ross Burton <[email protected]>
+---
+ mk/gcc.mk | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/mk/gcc.mk b/mk/gcc.mk
+index adc77a24..81bfa78a 100644
+--- a/mk/gcc.mk
++++ b/mk/gcc.mk
+@@ -13,11 +13,11 @@ nostdinc$(sm)	:= -nostdinc -isystem $(shell $(CC$(sm)) \
+ 			-print-file-name=include 2> /dev/null)
+ 
+ # Get location of libgcc from gcc
+-libgcc$(sm)  	:= $(shell $(CC$(sm)) $(CFLAGS$(arch-bits-$(sm))) \
++libgcc$(sm)  	:= $(shell $(CC$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CFLAGS$(arch-bits-$(sm))) \
+ 			-print-libgcc-file-name 2> /dev/null)
+-libstdc++$(sm)	:= $(shell $(CXX$(sm)) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \
++libstdc++$(sm)	:= $(shell $(CXX$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \
+ 			-print-file-name=libstdc++.a 2> /dev/null)
+-libgcc_eh$(sm)	:= $(shell $(CXX$(sm)) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \
++libgcc_eh$(sm)	:= $(shell $(CXX$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \
+ 			-print-file-name=libgcc_eh.a 2> /dev/null)
+ 
+ # Define these to something to discover accidental use
meta-arago-distro/recipes-security/optee/optee-os/0007-allow-setting-sysroot-for-clang.patch new file +29 -0
new file mode 100644
index 00000000..5c0d0a56
@@ -0,0 +1,29 @@
+From 3167f2c0dba4db59d61b60a8fe66f969d20aafa9 Mon Sep 17 00:00:00 2001
+From: Brett Warren <[email protected]>
+Date: Wed, 23 Sep 2020 09:27:34 +0100
+Subject: [PATCH] optee: enable clang support
+
+When compiling with clang, the LIBGCC_LOCATE_CFLAG variable used
+to provide a sysroot wasn't included, which results in not locating
+compiler-rt. This is mitigated by including the variable as ammended.
+
+Upstream-Status: Pending
+ChangeId: 8ba69a4b2eb8ebaa047cb266c9aa6c2c3da45701
+Signed-off-by: Brett Warren <[email protected]>
+---
+ mk/clang.mk | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/mk/clang.mk b/mk/clang.mk
+index 0f48c836..47465523 100644
+--- a/mk/clang.mk
++++ b/mk/clang.mk
+@@ -27,7 +27,7 @@ comp-cflags-warns-clang := -Wno-language-extension-token \
+ 
+ # Note, use the compiler runtime library (libclang_rt.builtins.*.a) instead of
+ # libgcc for clang
+-libgcc$(sm)	:= $(shell $(CC$(sm)) $(CFLAGS$(arch-bits-$(sm))) \
++libgcc$(sm)	:= $(shell $(CC$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CFLAGS$(arch-bits-$(sm))) \
+ 			-rtlib=compiler-rt -print-libgcc-file-name 2> /dev/null)
+ 
+ # Core ASLR relies on the executable being ready to run from its preferred load
meta-arago-distro/recipes-security/optee/optee-os_git.bbappend +11 -2
index 677c6dd0..e5708f3e 100644
@@ -1,7 +1,16 @@
 PR_append = ".arago0"
 
+LICENSE = "BSD-2-Clause"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=c1f21c4f72f372ef38a5a4aee55ec173"
+
 SRC_URI = "git://git.ti.com/optee/ti-optee-os.git;branch=${BRANCH} \
-           file://0001-allow-setting-sysroot-for-libgcc-lookup.patch \
+	   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 \
 "
+
+PV = "3.11"
 BRANCH = "ti-optee-os"
-SRCREV = "199fca17b575d4c748c9c435e908a6ec9618c75a"
+SRCREV = "36905c9566936f7502e3741b48015c1f147b3bd3"
Signature · 1 line
2.17.1
#1 lore raw

Praneeth

Quoted 18 lines · On 12/11/20 10:18 PM, [email protected] wrote:

From: Praneeth Bajjuri <[email protected]>

meta-arm where the optee-os_git.bb recipe is present, still is on 3.8 version on dunfell branch.

This patch is to upgrade SRCREV to pick 3.11 from
repo: ti-optee-os.git
branch: ti-optee-os

---
  ...ide-empty-__getauxval-implementation.patch | 62 +++++++++++++++++++
  ...t-support-for-libnames-after-libgcc-.patch | 55 ++++++++++++++++
  ...ke-sure-that-libutils-is-linked-seco.patch | 44 +++++++++++++
  ...ow-setting-sysroot-for-libgcc-lookup.patch | 34 ++++++++++
  ...0007-allow-setting-sysroot-for-clang.patch | 29 +++++++++
  .../optee/optee-os_git.bbappend               | 13 +++-
  6 files changed, 235 insertions(+), 2 deletions(-)
Quoted 5 lines

create mode 100644 meta-arago-distro/recipes-security/optee/optee-os/0001-libutils-provide-empty-__getauxval-implementation.patch create mode 100644 meta-arago-distro/recipes-security/optee/optee-os/0002-link.mk-implement-support-for-libnames-after-libgcc-.patch create mode 100644 meta-arago-distro/recipes-security/optee/optee-os/0003-ta_dev_kit.mk-make-sure-that-libutils-is-linked-seco.patch create mode 100644 meta-arago-distro/recipes-security/optee/optee-os/0006-allow-setting-sysroot-for-libgcc-lookup.patch create mode 100644 meta-arago-distro/recipes-security/optee/optee-os/0007-allow-setting-sysroot-for-clang.patch

This failed to build

09:58:06 WARNING: optee-os-3.11-r0.arago0 do_fetch: Failed to fetch URL file://0006-allow-setting-sysroot-for-libgcc-lookup.patch, attempting MIRRORS if available 09:58:06 ERROR: optee-os-3.11-r0.arago0 do_fetch: Fetcher failure: Unable to find file file://0006-allow-setting-sysroot-for-libgcc-lookup.patch anywhere. The paths that were searched were:
09:58:06 /OE/arago-dunfell-next-build/sources/meta-arm/meta-arm/recipes-security/optee/optee-os-3.11/arago
09:58:06 /OE/arago-dunfell-next-build/sources/meta-arm/meta-arm/recipes-security/optee/optee-os/arago
09:58:06 /OE/arago-dunfell-next-build/sources/meta-arm/meta-arm/recipes-security/optee/files/arago
09:58:06 /OE/arago-dunfell-next-build/sources/meta-arm/meta-arm/recipes-security/optee/optee-os-3.11/am65xx-hs-evm
09:58:06 /OE/arago-dunfell-next-build/sources/meta-arm/meta-arm/recipes-security/optee/optee-os/am65xx-hs-evm
09:58:06 /OE/arago-dunfell-next-build/sources/meta-arm/meta-arm/recipes-security/optee/files/am65xx-hs-evm
09:58:06 /OE/arago-dunfell-next-build/sources/meta-arm/meta-arm/recipes-security/optee/optee-os-3.11/am65xx
09:58:06 /OE/arago-dunfell-next-build/sources/meta-arm/meta-arm/recipes-security/optee/optee-os/am65xx
09:58:06 /OE/arago-dunfell-next-build/sources/meta-arm/meta-arm/recipes-security/optee/files/am65xx
09:58:06 /OE/arago-dunfell-next-build/sources/meta-arm/meta-arm/recipes-security/optee/optee-os-3.11/k3
09:58:06 /OE/arago-dunfell-next-build/sources/meta-arm/meta-arm/recipes-security/optee/optee-os/k3
09:58:06 /OE/arago-dunfell-next-build/sources/meta-arm/meta-arm/recipes-security/optee/files/k3
09:58:06 /OE/arago-dunfell-next-build/sources/meta-arm/meta-arm/recipes-security/optee/optee-os-3.11/ti-soc
09:58:06 /OE/arago-dunfell-next-build/sources/meta-arm/meta-arm/recipes-security/optee/optee-os/ti-soc
09:58:06 /OE/arago-dunfell-next-build/sources/meta-arm/meta-arm/recipes-security/optee/files/ti-soc
09:58:06 /OE/arago-dunfell-next-build/sources/meta-arm/meta-arm/recipes-security/optee/optee-os-3.11/aarch64
09:58:06 /OE/arago-dunfell-next-build/sources/meta-arm/meta-arm/recipes-security/optee/optee-os/aarch64
09:58:06 /OE/arago-dunfell-next-build/sources/meta-arm/meta-arm/recipes-security/optee/files/aarch64
09:58:06 /OE/arago-dunfell-next-build/sources/meta-arm/meta-arm/recipes-security/optee/optee-os-3.11/aarch64
09:58:06 /OE/arago-dunfell-next-build/sources/meta-arm/meta-arm/recipes-security/optee/optee-os/aarch64
09:58:06 /OE/arago-dunfell-next-build/sources/meta-arm/meta-arm/recipes-security/optee/files/aarch64
09:58:06 /OE/arago-dunfell-next-build/sources/meta-arm/meta-arm/recipes-security/optee/optee-os-3.11/
09:58:06 /OE/arago-dunfell-next-build/sources/meta-arm/meta-arm/recipes-security/optee/optee-os/
09:58:06 /OE/arago-dunfell-next-build/sources/meta-arm/meta-arm/recipes-security/optee/files/
09:58:06     /OE/arago-dunfell-next-build/downloads
09:58:06 ERROR: optee-os-3.11-r0.arago0 do_fetch: Fetcher failure for URL: 'file://0006-allow-setting-sysroot-for-libgcc-lookup.patch'. Unable to fetch URL from any source.

#2 lore raw
Quoted 8 lines · Dan Murphy
Quoted 4 lines

  create mode 100644 meta-arago-distro/recipes-security/optee/optee-os/0006-allow-setting-sysroot-for-libgcc-lookup.patch

  create mode 100644 meta-arago-distro/recipes-security/optee/optee-os/0007-allow-setting-sysroot-for-clang.patch

This failed to build

09:58:06 WARNING: optee-os-3.11-r0.arago0 do_fetch: Failed to fetch URL file://0006-allow-setting-sysroot-for-libgcc-lookup.patch, attempting MIRRORS if available

But this file "0006-allow-setting-sysroot-for-libgcc-lookup.patch" is included right inside this patch .

Quoted 2 lines

09:58:06 ERROR: optee-os-3.11-r0.arago0 do_fetch: Fetcher failure: Unable to find file file://0006-allow-setting-sysroot-for-libgcc-lookup.patch anywhere. The paths that were searched were:
09:58:06 /OE/arago-dunfell-next-build/sources/meta-arm/meta-arm/recipes-security/

looks like we are searching in meta-arm/recipes-security/ , yes the file will not be there because they are not in meta-arm dunfell branch instead in master branch. Hence i picked them to meta-arago/* dunfell branch in this patch.

Is there a different way to fix this to find the patches ?