[2/5] optee-os_git.bb: add optee-os recipe and patches

Message ID 1580319525-32054-3-git-send-email-peter.griffin@linaro.org
State New
Headers show
Series
  • Add OP-TEE recipes to meta-arm layer
Related show

Commit Message

Peter Griffin Jan. 29, 2020, 5:38 p.m.
This has moved from meta-linaro to meta-arm as this
is the new place for general recipes for Arm arch
and has a mailing list for external contributors.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>

---
 ...1-allow-setting-sysroot-for-libgcc-lookup.patch | 13 ++++
 meta-arm/recipes-security/optee/optee-os_git.bb    | 69 ++++++++++++++++++++++
 2 files changed, 82 insertions(+)
 create mode 100644 meta-arm/recipes-security/optee/optee-os/0001-allow-setting-sysroot-for-libgcc-lookup.patch
 create mode 100644 meta-arm/recipes-security/optee/optee-os_git.bb

-- 
2.7.4

Patch

diff --git a/meta-arm/recipes-security/optee/optee-os/0001-allow-setting-sysroot-for-libgcc-lookup.patch b/meta-arm/recipes-security/optee/optee-os/0001-allow-setting-sysroot-for-libgcc-lookup.patch
new file mode 100644
index 0000000..17127d0
--- /dev/null
+++ b/meta-arm/recipes-security/optee/optee-os/0001-allow-setting-sysroot-for-libgcc-lookup.patch
@@ -0,0 +1,13 @@ 
+diff --git a/mk/gcc.mk b/mk/gcc.mk
+index fc38c4d..77b8d74 100644
+--- a/mk/gcc.mk
++++ b/mk/gcc.mk
+@@ -12,7 +12,7 @@ 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))) $(comp-cflags$(sm)) \
++libgcc$(sm)  	:= $(shell $(CC$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CFLAGS$(arch-bits-$(sm))) $(comp-cflags$(sm)) \
+ 			-print-libgcc-file-name 2> /dev/null)
+ 
+ # Define these to something to discover accidental use
diff --git a/meta-arm/recipes-security/optee/optee-os_git.bb b/meta-arm/recipes-security/optee/optee-os_git.bb
new file mode 100644
index 0000000..872fd48
--- /dev/null
+++ b/meta-arm/recipes-security/optee/optee-os_git.bb
@@ -0,0 +1,69 @@ 
+SUMMARY = "OP-TEE Trusted OS"
+DESCRIPTION = "OPTEE OS"
+
+LICENSE = "BSD"
+LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=c1f21c4f72f372ef38a5a4aee55ec173"
+
+PV="3.7.0+git${SRCPV}"
+
+inherit deploy python3native
+
+DEPENDS = "python3-pycrypto-native python3-pyelftools-native"
+
+SRCREV = "a2fa5018cb595a9cd9ab62e82c7485ca57a62084"
+SRC_URI = "git://github.com/OP-TEE/optee_os.git \
+           file://0001-allow-setting-sysroot-for-libgcc-lookup.patch \
+          "
+
+S = "${WORKDIR}/git"
+
+OPTEEMACHINE ?= "${MACHINE}"
+OPTEEOUTPUTMACHINE ?= "${MACHINE}"
+
+EXTRA_OEMAKE = "PLATFORM=${OPTEEMACHINE} CFG_ARM64_core=y \
+                CROSS_COMPILE_core=${HOST_PREFIX} \
+                CROSS_COMPILE_ta_arm64=${HOST_PREFIX} \
+                NOWERROR=1 \
+                ta-targets=ta_arm64 \
+                LDFLAGS= \
+                LIBGCC_LOCATE_CFLAGS=--sysroot=${STAGING_DIR_HOST} \
+        "
+
+OPTEE_ARCH_armv7a = "arm32"
+OPTEE_ARCH_aarch64 = "arm64"
+
+do_compile() {
+    unset LDFLAGS
+    oe_runmake all CFG_TEE_TA_LOG_LEVEL=0
+}
+
+do_install() {
+    #install core on boot directory
+    install -d ${D}${nonarch_base_libdir}/firmware/
+
+    install -m 644 ${B}/out/arm-plat-${OPTEEOUTPUTMACHINE}/core/*.bin ${D}${nonarch_base_libdir}/firmware/
+    #install TA devkit
+    install -d ${D}/usr/include/optee/export-user_ta/
+
+    for f in  ${B}/out/arm-plat-${OPTEEOUTPUTMACHINE}/export-ta_${OPTEE_ARCH}/* ; do
+        cp -aR  $f  ${D}/usr/include/optee/export-user_ta/
+    done
+}
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+do_deploy() {
+    install -d ${DEPLOYDIR}/optee
+    for f in ${D}${nonarch_base_libdir}/firmware/*; do
+        install -m 644 $f ${DEPLOYDIR}/optee/
+    done
+}
+
+addtask deploy before do_build after do_install
+
+FILES_${PN} = "${nonarch_base_libdir}/firmware/"
+FILES_${PN}-dev = "/usr/include/optee"
+
+INSANE_SKIP_${PN}-dev = "staticdev"
+
+INHIBIT_PACKAGE_STRIP = "1"