Skip to contentSkip to conversation

layer.conf: add meta-python to LAYERDEPENDS for optee components

PATCH In review Denys Dmytriyenko 2 participants 6 messages Apr 8, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/5 layer.conf: add meta-python to LAYERDEPENDS for optee components

From: Denys Dmytriyenko <[email protected]>

optee components use pycrypto, pycryptodomex and pyelftools from meta-python layer

---
 meta-arm/conf/layer.conf | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
meta-arm/conf/layer.conf +4 -1
index 0b93e8d..d96e9f1 100644
@@ -9,5 +9,8 @@ BBFILE_COLLECTIONS += "meta-arm"
 BBFILE_PATTERN_meta-arm = "^${LAYERDIR}/"
 BBFILE_PRIORITY_meta-arm = "6"
 
-LAYERDEPENDS_meta-arm = "core"
+LAYERDEPENDS_meta-arm = " \
+    core \
+    meta-python \
+"
 LAYERSERIES_COMPAT_meta-arm = "warrior zeus dunfell"
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 2/5 optee-os: upgrade 3.7.0 -> 3.8.0, cleanup

From: Denys Dmytriyenko <[email protected]>

* Cleanup the recipe - add HOMEPAGE, update DESCRIPTION, indentation
* Depend on PyCryptodomex, but old PyCrypto is still required
* Ensure full support for arm32 platforms - build corresponding core and TA

---
 meta-arm/recipes-security/optee/optee-os_git.bb | 63 ++++++++++++++-----------
 1 file changed, 36 insertions(+), 27 deletions(-)
meta-arm/recipes-security/optee/optee-os_git.bb +36 -27
index 872fd48..47ced12 100644
@@ -1,52 +1,63 @@
 SUMMARY = "OP-TEE Trusted OS"
-DESCRIPTION = "OPTEE OS"
+DESCRIPTION = "Open Portable Trusted Execution Environment - Trusted side of the TEE"
+HOMEPAGE = "https://www.op-tee.org/"
 
 LICENSE = "BSD"
 LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=c1f21c4f72f372ef38a5a4aee55ec173"
 
-PV="3.7.0+git${SRCPV}"
+PV = "3.8.0+git${SRCPV}"
 
 inherit deploy python3native
 
-DEPENDS = "python3-pycrypto-native python3-pyelftools-native"
+DEPENDS = "python3-pycrypto-native python3-pyelftools-native python3-pycryptodomex-native"
 
-SRCREV = "a2fa5018cb595a9cd9ab62e82c7485ca57a62084"
-SRC_URI = "git://github.com/OP-TEE/optee_os.git \
-           file://0001-allow-setting-sysroot-for-libgcc-lookup.patch \
-          "
+SRCREV = "023e33656e2c9557ce50ad63a98b2e2c9b51c118"
+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"
+OPTEE_CORE = "${@d.getVar('OPTEE_ARCH').upper()}"
+
+EXTRA_OEMAKE = " \
+    PLATFORM=${OPTEEMACHINE} \
+    CFG_${OPTEE_CORE}_core=y \
+    CROSS_COMPILE_core=${HOST_PREFIX} \
+    CROSS_COMPILE_ta_${OPTEE_ARCH}=${HOST_PREFIX} \
+    NOWERROR=1 \
+    V=1 \
+    ta-targets=ta_${OPTEE_ARCH} \
+    LIBGCC_LOCATE_CFLAGS=--sysroot=${STAGING_DIR_HOST} \
+"
+
+CFLAGS[unexport] = "1"
+LDFLAGS[unexport] = "1"
+CPPFLAGS[unexport] = "1"
+AS[unexport] = "1"
+LD[unexport] = "1"
+
+do_configure[noexec] = "1"
 
 do_compile() {
-    unset LDFLAGS
     oe_runmake all CFG_TEE_TA_LOG_LEVEL=0
 }
 
 do_install() {
-    #install core on boot directory
+    #install core in firmware
     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/
+    #install TA devkit
+    install -d ${D}${includedir}/optee/export-user_ta/
+    for f in ${B}/out/arm-plat-${OPTEEOUTPUTMACHINE}/export-ta_${OPTEE_ARCH}/* ; do
+        cp -aR $f ${D}${includedir}/optee/export-user_ta/
     done
 }
 
@@ -54,15 +65,13 @@ 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
+    install -m 644 ${D}${nonarch_base_libdir}/firmware/* ${DEPLOYDIR}/optee/
 }
 
 addtask deploy before do_build after do_install
 
 FILES_${PN} = "${nonarch_base_libdir}/firmware/"
-FILES_${PN}-dev = "/usr/include/optee"
+FILES_${PN}-dev = "${includedir}/optee/"
 
 INSANE_SKIP_${PN}-dev = "staticdev"
 
Signature · 1 line
2.7.4
#2 lore raw

PATCH v2 3/5 optee-client: upgrade 3.7.0 -> 3.8.0, cleanup

In reply to Denys Dmytriyenko

From: Denys Dmytriyenko <[email protected]>

* Rename with _git suffix to match other optee recipes
* Add DESCRIPTION
* Use common HOMEPAGE
* Use install command for header files instead of cp -a

---
 .../optee/{optee-client.bb => optee-client_git.bb}   | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
 rename meta-arm/recipes-security/optee/{optee-client.bb => optee-client_git.bb} (63%)
meta-arm/recipes-security/optee/optee-client_git.bb renamed from meta-arm/recipes-security/optee/optee-client.bb +12 -8
similarity index 63%
rename from meta-arm/recipes-security/optee/optee-client.bb
rename to meta-arm/recipes-security/optee/optee-client_git.bb
index 519683a..a25d343 100644
@@ -1,18 +1,21 @@
-SUMMARY = "OPTEE Client"
-HOMEPAGE = "https://github.com/OP-TEE/optee_client"
+SUMMARY = "OP-TEE Client API"
+DESCRIPTION = "Open Portable Trusted Execution Environment - Normal World Client side of the TEE"
+HOMEPAGE = "https://www.op-tee.org/"
 
 LICENSE = "BSD"
 LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=69663ab153298557a59c67a60a743e5b"
 
-PV = "3.7.0+git${SRCPV}"
+PV = "3.8.0+git${SRCPV}"
 
 inherit python3native systemd
 
-SRC_URI = "git://github.com/OP-TEE/optee_client.git \
-           file://tee-supplicant.service"
-S = "${WORKDIR}/git"
+SRCREV = "be4fa2e36f717f03ca46e574aa66f697a897d090"
+SRC_URI = " \
+    git://github.com/OP-TEE/optee_client.git \
+    file://tee-supplicant.service \
+"
 
-SRCREV = "bc0ec8ce1e4dc5ae23f4737ef659338b7cd408fe"
+S = "${WORKDIR}/git"
 
 SYSTEMD_SERVICE_${PN} = "tee-supplicant.service"
 
@@ -25,7 +28,8 @@ do_install() {
     ln -sf libteec.so.1.0 ${D}${libdir}/libteec.so
     ln -sf libteec.so.1.0 ${D}${libdir}/libteec.so.1
 
-    cp -a ${S}/out/export/usr/include ${D}/usr/
+    install -d ${D}${includedir}
+    install -p -m0644 ${S}/out/export/usr/include/*.h ${D}${includedir}
 
     sed -i -e s:/etc:${sysconfdir}:g \
            -e s:/usr/bin:${bindir}:g \
Signature · 1 line
2.7.4
#3 lore raw

PATCH v2 4/5 optee-test: upgrade 3.7.0 -> 3.8.0, cleanup

In reply to Denys Dmytriyenko

From: Denys Dmytriyenko <[email protected]>

* Drop previously backported patch for Python3 support
* Add DESCRIPTION
* Use common HOMEPAGE
* Depend on PyCryptodomex instead of old PyCrypto

---
 .../0001-use-python3-instead-of-python.patch       | 48 ----------------------
 meta-arm/recipes-security/optee/optee-test_git.bb  | 15 ++++---
 2 files changed, 7 insertions(+), 56 deletions(-)
 delete mode 100644 meta-arm/recipes-security/optee/optee-test/0001-use-python3-instead-of-python.patch
meta-arm/recipes-security/optee/optee-test/0001-use-python3-instead-of-python.patch deleted +0 -48
deleted file mode 100644
index 20f190a..0000000
@@ -1,48 +0,0 @@
-From 6271160639002a2580d80b75b5397a96d56329f2 Mon Sep 17 00:00:00 2001
-From: Scott Branden <[email protected]>
-Date: Fri, 27 Dec 2019 12:54:28 -0800
-Subject: [PATCH] use python3 instead of python
-
-use python3 instead of python as python2 is EOL January 2020.
-
-Signed-off-by: Scott Branden <[email protected]>
-Reviewed-by: Jerome Forissier <[email protected]>
-Tested-by: Jerome Forissier <[email protected]> (QEMU, CFG_GCM_NIST_VECTORS=y)
-Upstream-Status: Backport from v3.8.0
----
- scripts/file_to_c.py       | 4 ++--
- scripts/rsp_to_gcm_test.py | 2 +-
- 2 files changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/scripts/file_to_c.py b/scripts/file_to_c.py
-index ae16f52..b4ce2a2 100755
---- a/scripts/file_to_c.py
-+++ b/scripts/file_to_c.py
-@@ -1,4 +1,4 @@
--#!/usr/bin/env python
-+#!/usr/bin/env python3
- # SPDX-License-Identifier: BSD-2-Clause
- #
- # Copyright (c) 2018, Linaro Limited
-@@ -29,7 +29,7 @@ def main():
- 
-     f.write("const uint8_t " + args.name + "[] = {\n")
-     i = 0
--    for x in array.array("B", inf.read()):
-+    for x in array.array("B", map(ord, (inf.read()))):
-         f.write("0x" + '{0:02x}'.format(x) + ",")
-         i = i + 1
-         if i % 8 == 0:
-diff --git a/scripts/rsp_to_gcm_test.py b/scripts/rsp_to_gcm_test.py
-index 0543541..e4418be 100755
---- a/scripts/rsp_to_gcm_test.py
-+++ b/scripts/rsp_to_gcm_test.py
-@@ -1,4 +1,4 @@
--#!/usr/bin/env python
-+#!/usr/bin/env python3
- 
- modes = {'encrypt': 0, 'decrypt': 1}
- 
--- 
-2.7.4
-
meta-arm/recipes-security/optee/optee-test_git.bb +7 -8
index 3f431c3..752d75d 100644
@@ -1,21 +1,20 @@
 SUMMARY = "OP-TEE sanity testsuite"
-HOMEPAGE = "https://github.com/OP-TEE/optee_test"
+DESCRIPTION = "Open Portable Trusted Execution Environment - Test suite"
+HOMEPAGE = "https://www.op-tee.org/"
 
 LICENSE = "BSD & GPLv2"
 LIC_FILES_CHKSUM = "file://${S}/LICENSE.md;md5=daa2bcccc666345ab8940aab1315a4fa"
 
 inherit python3native
 
-DEPENDS = "optee-client optee-os python3-pycrypto-native"
+DEPENDS = "optee-client optee-os python3-pycryptodomex-native"
 
-PV = "3.7.0+git${SRCPV}"
+PV = "3.8.0+git${SRCPV}"
 
-SRC_URI = "git://github.com/OP-TEE/optee_test.git \
-          file://0001-use-python3-instead-of-python.patch \
-          "
-S = "${WORKDIR}/git"
+SRCREV = "30481e381cb4285706e7516853495a7699c93b2c"
+SRC_URI = "git://github.com/OP-TEE/optee_test.git"
 
-SRCREV = "227d6f4c40eaa6f84fe049b9e48c7b27ad7fab08"
+S = "${WORKDIR}/git"
 
 OPTEE_CLIENT_EXPORT = "${STAGING_DIR_HOST}${prefix}"
 TEEC_EXPORT         = "${STAGING_DIR_HOST}${prefix}"
Signature · 1 line
2.7.4
#4 lore raw

PATCH v2 5/5 optee-examples: cleanup

In reply to Denys Dmytriyenko

From: Denys Dmytriyenko <[email protected]>

* Rename with _git suffix to match other optee recipes
* Set PV
* Add DESCRIPTION
* Depend on Python3 version of PyCryptodomex instead of Python2 version of PyCrypto

---
 .../optee/{optee-examples.bb => optee-examples_git.bb}               | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
 rename meta-arm/recipes-security/optee/{optee-examples.bb => optee-examples_git.bb} (87%)
meta-arm/recipes-security/optee/optee-examples_git.bb renamed from meta-arm/recipes-security/optee/optee-examples.bb +4 -1
similarity index 87%
rename from meta-arm/recipes-security/optee/optee-examples.bb
rename to meta-arm/recipes-security/optee/optee-examples_git.bb
index aaec4c4..768a55b 100644
@@ -1,10 +1,13 @@
 SUMMARY = "OP-TEE examples"
+DESCRIPTION = "Open Portable Trusted Execution Environment - Sample Applications"
 HOMEPAGE = "https://github.com/linaro-swg/optee_examples"
 
 LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=cd95ab417e23b94f381dafc453d70c30"
 
-DEPENDS = "optee-client optee-os python-pycrypto-native"
+PV = "3.8.0+git${SRCPV}"
+
+DEPENDS = "optee-client optee-os python3-pycryptodomex-native"
 
 inherit python3native
 
Signature · 1 line
2.7.4
#5 lore raw
In reply to Denys Dmytriyenko
Quoted 3 lines · Denys Dmytriyenko

From: Denys Dmytriyenko <[email protected]>

optee components use pycrypto, pycryptodomex and pyelftools from meta-python layer

Thanks for the resend (and for adding the Reviewed-by's). I've pulled it in to the master branch (pushing shortly).

Thanks,
Jon

Quoted 27 lines
---
 meta-arm/conf/layer.conf | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
meta-arm/conf/layer.conf +4 -1
index 0b93e8d..d96e9f1 100644
@@ -9,5 +9,8 @@ BBFILE_COLLECTIONS += "meta-arm"
 BBFILE_PATTERN_meta-arm = "^${LAYERDIR}/"
 BBFILE_PRIORITY_meta-arm = "6"
 
-LAYERDEPENDS_meta-arm = "core"
+LAYERDEPENDS_meta-arm = " \
+    core \
+    meta-python \
+"
 LAYERSERIES_COMPAT_meta-arm = "warrior zeus dunfell"
Signature · 1 line
2.7.4