diff mbox series

[4/5] optee-test_git.bb: add optee-test recipe & patches

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

Commit Message

Peter Griffin Jan. 29, 2020, 5:38 p.m. UTC
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>

---
 .../0001-use-python3-instead-of-python.patch       | 48 +++++++++++++++++++++
 meta-arm/recipes-security/optee/optee-test_git.bb  | 49 ++++++++++++++++++++++
 2 files changed, 97 insertions(+)
 create mode 100644 meta-arm/recipes-security/optee/optee-test/0001-use-python3-instead-of-python.patch
 create mode 100644 meta-arm/recipes-security/optee/optee-test_git.bb

-- 
2.7.4
diff mbox series

Patch

diff --git a/meta-arm/recipes-security/optee/optee-test/0001-use-python3-instead-of-python.patch b/meta-arm/recipes-security/optee/optee-test/0001-use-python3-instead-of-python.patch
new file mode 100644
index 0000000..20f190a
--- /dev/null
+++ b/meta-arm/recipes-security/optee/optee-test/0001-use-python3-instead-of-python.patch
@@ -0,0 +1,48 @@ 
+From 6271160639002a2580d80b75b5397a96d56329f2 Mon Sep 17 00:00:00 2001
+From: Scott Branden <scott.branden@broadcom.com>
+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 <scott.branden@broadcom.com>
+Reviewed-by: Jerome Forissier <jerome@forissier.org>
+Tested-by: Jerome Forissier <jerome@forissier.org> (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
+
diff --git a/meta-arm/recipes-security/optee/optee-test_git.bb b/meta-arm/recipes-security/optee/optee-test_git.bb
new file mode 100644
index 0000000..a6fae9d
--- /dev/null
+++ b/meta-arm/recipes-security/optee/optee-test_git.bb
@@ -0,0 +1,49 @@ 
+SUMMARY = "OP-TEE sanity testsuite"
+HOMEPAGE = "https://github.com/OP-TEE/optee_test"
+
+LICENSE = "BSD & GPLv2"
+LIC_FILES_CHKSUM = "file://${S}/LICENSE.md;md5=daa2bcccc666345ab8940aab1315a4fa"
+
+inherit python3native
+
+DEPENDS = "optee-client optee-os python3-pycrypto-native"
+
+PV = "3.7.0+git${SRCPV}"
+
+SRC_URI = "git://github.com/OP-TEE/optee_test.git \
+          "
+S = "${WORKDIR}/git"
+
+SRCREV = "227d6f4c40eaa6f84fe049b9e48c7b27ad7fab08"
+
+OPTEE_CLIENT_EXPORT = "${STAGING_DIR_HOST}${prefix}"
+TEEC_EXPORT         = "${STAGING_DIR_HOST}${prefix}"
+TA_DEV_KIT_DIR      = "${STAGING_INCDIR}/optee/export-user_ta"
+
+EXTRA_OEMAKE = " TA_DEV_KIT_DIR=${TA_DEV_KIT_DIR} \
+                 OPTEE_CLIENT_EXPORT=${OPTEE_CLIENT_EXPORT} \
+                 TEEC_EXPORT=${TEEC_EXPORT} \
+                 CROSS_COMPILE_HOST=${TARGET_PREFIX} \
+                 CROSS_COMPILE_TA=${TARGET_PREFIX} \
+                 V=1 \
+               "
+
+do_compile() {
+    # Top level makefile doesn't seem to handle parallel make gracefully
+    oe_runmake xtest
+    oe_runmake ta
+}
+
+do_install () {
+    install -D -p -m0755 ${S}/out/xtest/xtest ${D}${bindir}/xtest
+
+    # install path should match the value set in optee-client/tee-supplicant
+    # default TEEC_LOAD_PATH is /lib
+    mkdir -p ${D}${nonarch_base_libdir}/optee_armtz/
+    install -D -p -m0444 ${S}/out/ta/*/*.ta ${D}${nonarch_base_libdir}/optee_armtz/
+}
+
+FILES_${PN} += "${nonarch_base_libdir}/optee_armtz/"
+
+# Imports machine specific configs from staging to build
+PACKAGE_ARCH = "${MACHINE_ARCH}"