--- /dev/null
+require optee-client.nxp.inc
+
+PV:append = "+git${SRCPV}"
+
+COMPATIBLE_MACHINE = "(qoriq-arm64)"
+++ /dev/null
-SUMMARY = "OPTEE Client"
-HOMEPAGE = "https://github.com/OP-TEE/optee_client"
-
-LICENSE = "BSD"
-LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=69663ab153298557a59c67a60a743e5b"
-
-inherit python3native systemd
-
-SRC_URI = "git://github.com/OP-TEE/optee_client;nobranch=1"
-SRCREV = "be4fa2e36f717f03ca46e574aa66f697a897d090"
-
-S = "${WORKDIR}/git"
-
-EXTRA_OEMAKE = "ARCH=arm64"
-
-do_install() {
- oe_runmake install
-
- install -D -p -m0755 ${S}/out/export/usr/sbin/tee-supplicant ${D}${bindir}/tee-supplicant
- install -D -p -m0755 ${S}/out/export/usr/lib/libteec.so.1.0.0 ${D}${libdir}/libteec.so.1.0.0
- ln -sf libteec.so.1.0.0 ${D}${libdir}/libteec.so.1.0
- ln -sf libteec.so.1.0.0 ${D}${libdir}/libteec.so.1
- ln -sf libteec.so.1 ${D}${libdir}/libteec.so
-
- cp -a ${S}/out/export/usr/include ${D}/usr/
-}
-
-COMPATIBLE_MACHINE = "(qoriq-arm64)"
--- /dev/null
+# Copyright 2020-2021 NXP
+
+SUMMARY = "OPTEE Client libs"
+HOMEPAGE = "http://www.optee.org/"
+LICENSE = "BSD"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=69663ab153298557a59c67a60a743e5b"
+
+inherit python3native systemd
+
+SRC_URI = "git://source.codeaurora.org/external/qoriq/qoriq-components/optee_client.git;nobranch=1"
+SRCREV = "7c9c423d00e96bf51debd5fe10fd70dce83be5cc"
+
+FILESEXTRAPATHS:prepend := "${THISDIR}/optee-client:"
+SRC_URI += "file://tee-supplicant.service"
+
+S = "${WORKDIR}/git"
+B = "${WORKDIR}/build"
+
+OPTEE_ARCH ?= "arm32"
+OPTEE_ARCH_armv7a = "arm32"
+OPTEE_ARCH:aarch64 = "arm64"
+
+EXTRA_OEMAKE = "ARCH=${OPTEE_ARCH} O=${B}"
+
+do_install () {
+ oe_runmake -C ${S} install
+
+ install -d ${D}${libdir}/
+ install -p -m0644 ${B}/export${libdir}/libteec.so.1.0.0 ${D}${libdir}/
+ ln -sf libteec.so.1.0.0 ${D}${libdir}/libteec.so.1.0
+ ln -sf libteec.so.1.0.0 ${D}${libdir}/libteec.so.1
+ ln -sf libteec.so.1 ${D}${libdir}/libteec.so
+
+ install -D -p -m0644 ${B}/export/usr/lib/libckteec.so.0.1.0 ${D}${libdir}/libckteec.so.0.1.0
+ ln -sf libckteec.so.0.1.0 ${D}${libdir}/libckteec.so.0.1
+ ln -sf libckteec.so.0.1.0 ${D}${libdir}/libckteec.so.0
+ ln -sf libckteec.so.0.1.0 ${D}${libdir}/libckteec.so
+
+ install -D -p -m0755 ${B}/export/usr/sbin/tee-supplicant ${D}${bindir}/tee-supplicant
+
+ cp -a ${B}/export/usr/include ${D}${includedir}
+
+ install -d ${D}${systemd_system_unitdir}/
+ install -m0644 ${WORKDIR}/tee-supplicant.service ${D}${systemd_system_unitdir}/
+ sed -i -e s:/etc:${sysconfdir}:g -e s:/usr/bin:${bindir}:g ${D}${systemd_system_unitdir}/tee-supplicant.service
+}
+
+SYSTEMD_SERVICE:${PN} = "tee-supplicant.service"
+
+FILES:${PN} += "${libdir}/* ${includedir}/*"
+
+INSANE_SKIP:${PN} = "ldflags dev-elf"
+INSANE_SKIP:${PN}-dev = "ldflags dev-elf"
--- /dev/null
+[Unit]
+Description=TEE Supplicant
+
+[Service]
+User=root
+EnvironmentFile=-/etc/default/tee-supplicant
+ExecStart=/usr/bin/tee-supplicant $OPTARGS
+
+[Install]
+WantedBy=basic.target
+
+++ /dev/null
-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
+++ /dev/null
-From f94d9558d9eae48e92ce8d651539b6cf69eb4394 Mon Sep 17 00:00:00 2001
-From: Joshua Watt <JPEWhacker@gmail.com>
-Date: Mon, 18 May 2020 20:00:00 -0500
-Subject: [PATCH] arm64: Disable outline-atomics when compiling
-
-Disables the automatic detection of LSE (Large System Extension)
-instructions when compiling AArch64 code. GCC 10 implements this
-detection in libgcc using __getauxval(), which optee doesn't implement.
-This requires that the proper -mcpu is passed to GCC so that the code
-can be correctly compiled to use either LSE or load-store-exclusive.
-
-Fixes linker errors like the following when compiling with GCC 10:
-
- aarch64-linux-ld.bfd: libgcc.a(lse-init.o):
- in function `init_have_lse_atomics':
- lse-init.c:44: undefined reference to `__getauxval'
- core/arch/arm/kernel/link.mk:38:
- recipe for target 'build/core/all_objs.o' failed
-
-Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
-Upstream-Status: Submitted [https://github.com/OP-TEE/optee_os/pull/3874]
----
- core/arch/arm/arm.mk | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/core/arch/arm/arm.mk b/core/arch/arm/arm.mk
-index a18eda3b..07069c66 100644
---- a/core/arch/arm/arm.mk
-+++ b/core/arch/arm/arm.mk
-@@ -115,7 +115,7 @@ arm32-platform-aflags-no-hard-float ?=
-
- arm64-platform-cflags-no-hard-float ?= -mgeneral-regs-only
- arm64-platform-cflags-hard-float ?=
--arm64-platform-cflags-generic ?= -mstrict-align
-+arm64-platform-cflags-generic ?= -mstrict-align $(call cc-option,-mno-outline-atomics,)
-
- ifeq ($(DEBUG),1)
- # For backwards compatibility
---
-2.17.1
-
--- /dev/null
+require optee-os.nxp.inc
+
+PV:append = "+git${SRCPV}"
+
+PLATFORM_FLAVOR:ls1088ardb-pb = "ls1088ardb"
+PLATFORM_FLAVOR:ls1046afrwy = "ls1046ardb"
+PLATFORM_FLAVOR:lx2162aqds = "lx2160aqds"
+
+EXTRA_OEMAKE += " \
+ PLATFORM=ls \
+ CFG_ARM64_core=y \
+"
+
+do_compile:append:ls1012afrwy() {
+ mv ${B}/core/tee-raw.bin ${B}/core/tee_512mb.bin
+ oe_runmake CFG_DRAM0_SIZE=0x40000000 all
+}
+
+do_install:append:qoriq() {
+ install -m 644 ${B}/core/tee-raw.bin ${D}${nonarch_base_libdir}/firmware/tee_${MACHINE}.bin
+}
+
+do_install:append:ls1012afrwy() {
+ install -m 644 ${B}/core/tee_512mb.bin ${D}${nonarch_base_libdir}/firmware/tee_${MACHINE}_512mb.bin
+}
+
+INHIBIT_PACKAGE_STRIP = "1"
+COMPATIBLE_MACHINE = "(qoriq-arm64)"
+++ /dev/null
-SUMMARY = "OP-TEE Trusted OS"
-DESCRIPTION = "OPTEE OS"
-
-LICENSE = "BSD"
-LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=c1f21c4f72f372ef38a5a4aee55ec173"
-
-PV = "3.8+git${SRCPV}"
-
-DEPENDS += "python3-pyelftools-native python3-pycryptodome-native python3-pycryptodomex-native dtc-native"
-
-inherit deploy python3native
-
-SRC_URI = "git://source.codeaurora.org/external/qoriq/qoriq-components/optee_os;nobranch=1 \
- file://0001-allow-setting-sysroot-for-libgcc-lookup.patch \
- file://0001-arm64-Disable-outline-atomics-when-compiling.patch \
- "
-SRCREV = "0cb01f7f6aee552ead49990c06f69f73f459cc65"
-
-S = "${WORKDIR}/git"
-
-OPTEEMACHINE ?= "${MACHINE}"
-OPTEEMACHINE:ls1088ardb-pb = "ls1088ardb"
-OPTEEMACHINE:ls1046afrwy = "ls1046ardb"
-OPTEEMACHINE:lx2162aqds = "lx2160aqds"
-
-EXTRA_OEMAKE = "PLATFORM=ls-${OPTEEMACHINE} CFG_ARM64_core=y \
- ARCH=arm \
- CROSS_COMPILE_core=${HOST_PREFIX} \
- CROSS_COMPILE_ta_arm64=${HOST_PREFIX} \
- NOWERROR=1 \
- LDFLAGS= \
- LIBGCC_LOCATE_CFLAGS=--sysroot=${STAGING_DIR_HOST} \
- "
-EXTRA_OEMAKE:append:lx2162aqds = " CFG_EMBED_DTB_SOURCE_FILE=fsl-lx2160a-qds.dts CFG_EMBED_DT=y"
-
-OPTEE_ARCH:armv7a = "arm32"
-OPTEE_ARCH:aarch64 = "arm64"
-
-do_compile() {
- unset LDFLAGS
- oe_runmake all CFG_TEE_TA_LOG_LEVEL=0
- ${OBJCOPY} -v -O binary ${B}/out/arm-plat-ls/core/tee.elf ${B}/out/arm-plat-ls/core/tee.bin
-
- if [ ${MACHINE} = ls1012afrwy ]; then
- mv ${B}/out/arm-plat-ls/core/tee.bin ${B}/out/arm-plat-ls/core/tee_512mb.bin
- oe_runmake CFG_DRAM0_SIZE=0x40000000 all CFG_TEE_TA_LOG_LEVEL=0
- ${OBJCOPY} -v -O binary ${B}/out/arm-plat-ls/core/tee.elf ${B}/out/arm-plat-ls/core/tee.bin
- fi
-}
-
-do_install() {
- #install core on boot directory
- install -d ${D}/lib/firmware/
- if [ ${MACHINE} = ls1012afrwy ]; then
- install -m 644 ${B}/out/arm-plat-ls/core/tee_512mb.bin ${D}/lib/firmware/tee_${MACHINE}_512mb.bin
- fi
- install -m 644 ${B}/out/arm-plat-ls/core/tee.bin ${D}/lib/firmware/tee_${MACHINE}.bin
- #install TA devkit
- install -d ${D}/usr/include/optee/export-user_ta/
-
- for f in ${B}/out/arm-plat-ls/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}/lib/firmware/*; do
- cp $f ${DEPLOYDIR}/optee/
- done
-}
-
-addtask deploy before do_build after do_install
-
-FILES:${PN} = "/lib/firmware/"
-FILES:${PN}-dev = "/usr/include/optee"
-
-INSANE_SKIP:${PN}-dev = "staticdev"
-
-INHIBIT_PACKAGE_STRIP = "1"
-COMPATIBLE_MACHINE = "(qoriq-arm64)"
--- /dev/null
+# Copyright 2020-2021 NXP
+
+SUMMARY = "OPTEE OS"
+DESCRIPTION = "OPTEE OS"
+HOMEPAGE = "http://www.optee.org/"
+LICENSE = "BSD"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=c1f21c4f72f372ef38a5a4aee55ec173"
+
+inherit deploy python3native autotools
+DEPENDS = "python3-pycryptodome-native python3-pyelftools-native python3-pycryptodomex-native dtc-native"
+
+SRC_URI = "git://source.codeaurora.org/external/qoriq/qoriq-components/optee_os.git;nobranch=1"
+SRCREV = "735d98806dc26fbeeecad7f5e60ffeab8170c67e"
+
+S = "${WORKDIR}/git"
+B = "${WORKDIR}/build.${PLATFORM_FLAVOR}"
+
+PLATFORM_FLAVOR ?= "${MACHINE}"
+
+OPTEE_ARCH ?= "arm64"
+OPTEE_ARCH_armv7a = "arm32"
+OPTEE_ARCH:aarch64 = "arm64"
+
+OPTEE_CORE_LOG_LEVEL ?= "1"
+OPTEE_TA_LOG_LEVEL ?= "0"
+
+# Optee-os can be built for 32 bits and 64 bits at the same time
+# as long as the compilers are correctly defined.
+# For 64bits, CROSS_COMPILE64 must be set
+# When defining CROSS_COMPILE and CROSS_COMPILE64, we assure that
+# any 32 or 64 bits builds will pass
+EXTRA_OEMAKE = " \
+ -C ${S} O=${B} \
+ PLATFORM_FLAVOR=${PLATFORM_FLAVOR} \
+ CROSS_COMPILE=${HOST_PREFIX} \
+ CROSS_COMPILE64=${HOST_PREFIX} \
+ CFG_WERROR=y \
+ CFG_TEE_CORE_LOG_LEVEL=${OPTEE_CORE_LOG_LEVEL} \
+ CFG_TEE_TA_LOG_LEVEL=${OPTEE_TA_LOG_LEVEL} \
+"
+
+do_compile() {
+ unset LDFLAGS
+ export CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_HOST}"
+ oe_runmake all
+}
+
+do_install() {
+ install -d ${D}${nonarch_base_libdir}/firmware/
+ install -m 644 ${B}/core/*.bin ${D}${nonarch_base_libdir}/firmware/
+
+ # Install the TA devkit
+ install -d ${D}${includedir}/optee/export-user_ta/
+
+ for f in ${B}/export-ta_${OPTEE_ARCH}/*; do
+ cp -aR $f ${D}${includedir}/optee/export-user_ta/
+ done
+
+ install -d ${D}${nonarch_base_libdir}/optee_armtz
+ find ${B}/export-ta_${OPTEE_ARCH}/ta -name '*.ta' | while read name; do
+ install -m 444 $name ${D}${nonarch_base_libdir}/optee_armtz/
+ done
+}
+
+do_deploy() {
+ install -d ${DEPLOYDIR}/optee
+ install -m 644 ${D}${nonarch_base_libdir}/firmware/* ${DEPLOYDIR}/optee/
+}
+addtask deploy before do_build after do_install
+
+FILES:${PN} = "${nonarch_base_libdir}/firmware/ ${nonarch_base_libdir}/optee_armtz/"
+FILES:${PN}-staticdev = "/usr/include/optee/"
+RDEPENDS:${PN}-dev += "${PN}-staticdev"
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
--- /dev/null
+require optee-test.nxp.inc
+
+PV:append = "+git${SRCPV}"
+
+DEPENDS += "optee-client-qoriq optee-os-qoriq"
+
+TEEC_EXPORT = "${STAGING_DIR_HOST}${prefix}"
+
+EXTRA_OEMAKE += " \
+ TEEC_EXPORT=${TEEC_EXPORT} \
+"
+
+COMPATIBLE_MACHINE = "(qoriq-arm64)"
+++ /dev/null
-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"
-
-DEPENDS = "optee-client-qoriq optee-os-qoriq python3-pycryptodome-native python3-pycryptodomex-native"
-
-inherit python3native
-
-SRC_URI = "git://github.com/OP-TEE/optee_test;nobranch=1"
-SRCREV = "30481e381cb4285706e7516853495a7699c93b2c"
-
-S = "${WORKDIR}/git"
-
-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} \
- CFG_ARM64=y \
- 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}/lib/optee_armtz/
- install -D -p -m0444 ${S}/out/ta/*/*.ta ${D}/lib/optee_armtz/
-}
-
-FILES:${PN} += "/lib/optee_armtz/"
-
-# Imports machine specific configs from staging to build
-PACKAGE_ARCH = "${MACHINE_ARCH}"
-COMPATIBLE_MACHINE = "(qoriq-arm64)"
--- /dev/null
+# Copyright 2020-2021 NXP
+
+SUMMARY = "OPTEE test"
+HOMEPAGE = "http://www.optee.org/"
+
+LICENSE = "BSD & GPLv2"
+LIC_FILES_CHKSUM = "file://LICENSE.md;md5=daa2bcccc666345ab8940aab1315a4fa"
+
+DEPENDS = "python3-pycryptodome-native python3-pycryptodomex-native openssl"
+inherit python3native cmake
+
+SRC_URI = "git://source.codeaurora.org/external/qoriq/qoriq-components/optee_test.git;nobranch=1"
+SRCREV = "69722dab8c1f2683e30e0ee3b536053367e37aad"
+
+S = "${WORKDIR}/git"
+B = "${WORKDIR}/build"
+
+TA_DEV_KIT_DIR ?= "${STAGING_INCDIR}/optee/export-user_ta"
+OPTEE_CLIENT_EXPORT ?= "${STAGING_DIR_HOST}${prefix}"
+
+EXTRA_OEMAKE = " \
+ TA_DEV_KIT_DIR=${TA_DEV_KIT_DIR} \
+ OPTEE_CLIENT_EXPORT=${OPTEE_CLIENT_EXPORT} \
+ CROSS_COMPILE_HOST=${HOST_PREFIX} \
+ CROSS_COMPILE_TA=${HOST_PREFIX} \
+ OPTEE_OPENSSL_EXPORT=${STAGING_INCDIR}/ \
+ -C ${S} O=${B} \
+"
+
+EXTRA_OECMAKE = " \
+ -DOPTEE_TEST_SDK=${TA_DEV_KIT_DIR} \
+"
+
+do_compile() {
+ export CXXFLAGS="${CXXFLAGS} --sysroot=${STAGING_DIR_HOST}"
+ oe_runmake xtest
+ oe_runmake ta
+ oe_runmake test_plugin
+}
+
+do_install() {
+ install -d ${D}${bindir}/
+ install ${B}/xtest/xtest ${D}${bindir}/
+
+ install -d ${D}${nonarch_base_libdir}/optee_armtz
+ find ${B}/ta -name '*.ta' | while read name; do
+ install -m 444 $name ${D}${nonarch_base_libdir}/optee_armtz/
+ done
+
+ install -d ${D}${libdir}/tee-supplicant/plugins/
+ find ${B}/supp_plugin -name '*.plugin' | while read name; do
+ install -m 755 $name ${D}${libdir}/tee-supplicant/plugins/
+ done
+}
+
+FILES:${PN} += "${nonarch_base_libdir} ${libdir}/tee-supplicant/plugins/"
+
+DEBUG_OPTIMIZATION:append = " -Wno-error=maybe-uninitialized -Wno-deprecated-declarations"
+FULL_OPTIMIZATION:append = " -Wno-error=maybe-uninitialized -Wno-deprecated-declarations"
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"