diff options
22 files changed, 501 insertions, 187 deletions
diff --git a/conf/machine/include/imx-base.inc b/conf/machine/include/imx-base.inc index 8ccdeb64..932b1e69 100644 --- a/conf/machine/include/imx-base.inc +++ b/conf/machine/include/imx-base.inc | |||
@@ -606,12 +606,12 @@ PREFERRED_VERSION_vulkan-tools:imxvulkan ??= "1.3.275.0.imx" | |||
606 | PREFERRED_VERSION_vulkan-validation-layers:imxvulkan ??= "1.3.275.0.imx" | 606 | PREFERRED_VERSION_vulkan-validation-layers:imxvulkan ??= "1.3.275.0.imx" |
607 | 607 | ||
608 | # Use i.MX optee Version | 608 | # Use i.MX optee Version |
609 | PREFERRED_VERSION_optee-os:mx8-nxp-bsp ??= "4.2.0.imx" | 609 | PREFERRED_VERSION_optee-os:mx8-nxp-bsp ??= "4.4.0.imx" |
610 | PREFERRED_VERSION_optee-os:mx9-nxp-bsp ??= "4.2.0.imx" | 610 | PREFERRED_VERSION_optee-os:mx9-nxp-bsp ??= "4.4.0.imx" |
611 | PREFERRED_VERSION_optee-client:mx8-nxp-bsp ??= "4.2.0.imx" | 611 | PREFERRED_VERSION_optee-client:mx8-nxp-bsp ??= "4.4.0.imx" |
612 | PREFERRED_VERSION_optee-client:mx9-nxp-bsp ??= "4.2.0.imx" | 612 | PREFERRED_VERSION_optee-client:mx9-nxp-bsp ??= "4.4.0.imx" |
613 | PREFERRED_VERSION_optee-test:mx8-nxp-bsp ??= "4.2.0.imx" | 613 | PREFERRED_VERSION_optee-test:mx8-nxp-bsp ??= "4.4.0.imx" |
614 | PREFERRED_VERSION_optee-test:mx9-nxp-bsp ??= "4.2.0.imx" | 614 | PREFERRED_VERSION_optee-test:mx9-nxp-bsp ??= "4.4.0.imx" |
615 | 615 | ||
616 | # Use i.MX opencv Version | 616 | # Use i.MX opencv Version |
617 | PREFERRED_VERSION_opencv:mx8-nxp-bsp ??= "4.6.0.imx" | 617 | PREFERRED_VERSION_opencv:mx8-nxp-bsp ??= "4.6.0.imx" |
diff --git a/recipes-security/optee-imx/optee-client-fslc-imx.inc b/recipes-security/optee-imx/optee-client-fslc-imx.inc index 60e9e1fa..7aeff9fd 100644 --- a/recipes-security/optee-imx/optee-client-fslc-imx.inc +++ b/recipes-security/optee-imx/optee-client-fslc-imx.inc | |||
@@ -1,7 +1,36 @@ | |||
1 | # Copyright 2017-2024 NXP | 1 | # Copied from meta-imx/meta-imx-bsp/recipes-security/optee/optee-client-imx.inc. |
2 | # See: https://github.com/nxp-imx/imx-manifest/blob/imx-linux-scarthgap/imx-6.6.52-2.2.0.xml#L37 | ||
2 | 3 | ||
3 | require optee-client-fslc.inc | 4 | require optee-client-fslc.inc |
4 | 5 | ||
5 | SRC_URI += "git://github.com/nxp-imx/imx-optee-client.git;protocol=https;branch=${SRCBRANCH}" | 6 | DEPENDS += "util-linux-libuuid" |
6 | 7 | ||
7 | COMPATIBLE_MACHINE = "(imx-nxp-bsp)" | 8 | FILESEXTRAPATHS:prepend := "${THISDIR}/optee-client:" |
9 | SRC_URI:remove = "git://github.com/OP-TEE/optee_client.git;branch=master;protocol=https" | ||
10 | SRC_URI:prepend = "${OPTEE_CLIENT_SRC};branch=${SRCBRANCH} " | ||
11 | OPTEE_CLIENT_SRC ?= "git://github.com/nxp-imx/imx-optee-client.git;protocol=https" | ||
12 | |||
13 | inherit pkgconfig | ||
14 | |||
15 | EXTRA_OECMAKE += "-DCFG_TEE_CLIENT_LOAD_PATH=${nonarch_base_libdir}" | ||
16 | |||
17 | # Copy the udev rule from the libts recipe for starting tee-supplicant@.service | ||
18 | SRC_URI += "file://tee-udev.rules" | ||
19 | # Unix group name for dev/tee* ownership. | ||
20 | TEE_GROUP_NAME ?= "teeclnt" | ||
21 | do_install:append () { | ||
22 | if ${@oe.utils.conditional('VIRTUAL-RUNTIME_dev_manager', 'busybox-mdev', 'false', 'true', d)}; then | ||
23 | install -d ${D}${nonarch_base_libdir}/udev/rules.d/ | ||
24 | install -m 755 ${UNPACKDIR}/tee-udev.rules ${D}${nonarch_base_libdir}/udev/rules.d/ | ||
25 | sed -i -e "s/teeclnt/${TEE_GROUP_NAME}/" ${D}${nonarch_base_libdir}/udev/rules.d/tee-udev.rules | ||
26 | fi | ||
27 | |||
28 | if [ "${libdir}" != "${nonarch_base_libdir}" ]; then | ||
29 | rm -rf ${D}${libdir}/systemd | ||
30 | fi | ||
31 | } | ||
32 | inherit ${@oe.utils.conditional('VIRTUAL-RUNTIME_dev_manager', 'busybox-mdev', '', 'useradd', d)} | ||
33 | USERADD_PACKAGES = "${PN}" | ||
34 | GROUPADD_PARAM:${PN} = "--system ${TEE_GROUP_NAME}" | ||
35 | |||
36 | FILES:${PN} += "${libdir}/* ${includedir}/*" | ||
diff --git a/recipes-security/optee-imx/optee-client-fslc.inc b/recipes-security/optee-imx/optee-client-fslc.inc index f55f0ab2..455bdd78 100644 --- a/recipes-security/optee-imx/optee-client-fslc.inc +++ b/recipes-security/optee-imx/optee-client-fslc.inc | |||
@@ -1,42 +1,43 @@ | |||
1 | # Copyright 2017-2024 NXP | 1 | # Copied from meta-arm/recipes-security/optee/optee-client.inc. |
2 | # See: https://github.com/nxp-imx/imx-manifest/blob/imx-linux-scarthgap/imx-6.6.52-2.2.0.xml#L30 | ||
3 | |||
4 | SUMMARY = "OP-TEE Client API" | ||
5 | DESCRIPTION = "Open Portable Trusted Execution Environment - Normal World Client side of the TEE" | ||
6 | HOMEPAGE = "https://www.op-tee.org/" | ||
2 | 7 | ||
3 | SUMMARY = "OPTEE Client libs" | ||
4 | HOMEPAGE = "http://www.optee.org/" | ||
5 | LICENSE = "BSD-2-Clause" | 8 | LICENSE = "BSD-2-Clause" |
6 | LIC_FILES_CHKSUM = "file://LICENSE;md5=69663ab153298557a59c67a60a743e5b" | 9 | LIC_FILES_CHKSUM = "file://LICENSE;md5=69663ab153298557a59c67a60a743e5b" |
7 | 10 | ||
8 | SRC_URI = "file://tee-supplicant.service" | 11 | inherit systemd update-rc.d cmake |
9 | |||
10 | S = "${WORKDIR}/git" | ||
11 | B = "${WORKDIR}/build" | ||
12 | 12 | ||
13 | inherit python3native systemd features_check pkgconfig | 13 | SRC_URI = " \ |
14 | 14 | git://github.com/OP-TEE/optee_client.git;branch=master;protocol=https \ | |
15 | DEPENDS = "util-linux-libuuid" | 15 | file://tee-supplicant@.service \ |
16 | file://tee-supplicant.sh \ | ||
17 | " | ||
16 | 18 | ||
17 | REQUIRED_MACHINE_FEATURES = "optee" | 19 | UPSTREAM_CHECK_GITTAGREGEX = "^(?P<pver>\d+(\.\d+)+)$" |
18 | 20 | ||
19 | SYSTEMD_SERVICE:${PN} = "tee-supplicant.service" | 21 | S = "${WORKDIR}/git" |
20 | 22 | ||
21 | EXTRA_OEMAKE = " \ | 23 | EXTRA_OECMAKE = " \ |
22 | -C ${S} O=${B} \ | 24 | -DBUILD_SHARED_LIBS=ON \ |
25 | -DCFG_TEE_FS_PARENT_PATH='${localstatedir}/lib/tee' \ | ||
23 | " | 26 | " |
27 | EXTRA_OECMAKE:append:toolchain-clang = " -DCFG_WERROR=0" | ||
24 | 28 | ||
25 | do_install () { | 29 | do_install:append() { |
26 | oe_runmake -C ${S} install | 30 | install -D -p -m0644 ${UNPACKDIR}/tee-supplicant@.service ${D}${systemd_system_unitdir}/tee-supplicant@.service |
27 | 31 | install -D -p -m0755 ${UNPACKDIR}/tee-supplicant.sh ${D}${sysconfdir}/init.d/tee-supplicant | |
28 | install -D -p -m0644 ${B}/export/usr/lib/libteec.so.2.0.0 ${D}${libdir}/libteec.so.2.0.0 | ||
29 | ln -sf libteec.so.2.0.0 ${D}${libdir}/libteec.so.2 | ||
30 | ln -sf libteec.so.2.0.0 ${D}${libdir}/libteec.so | ||
31 | |||
32 | install -D -p -m0644 ${B}/export/usr/lib/libckteec.so.0.1.0 ${D}${libdir}/libckteec.so.0.1.0 | ||
33 | ln -sf libckteec.so.0.1.0 ${D}${libdir}/libckteec.so.0 | ||
34 | ln -sf libckteec.so.0.1.0 ${D}${libdir}/libckteec.so | ||
35 | 32 | ||
36 | install -D -p -m0755 ${B}/export/usr/sbin/tee-supplicant ${D}${bindir}/tee-supplicant | 33 | sed -i -e s:@sysconfdir@:${sysconfdir}:g \ |
34 | -e s:@sbindir@:${sbindir}:g \ | ||
35 | ${D}${systemd_system_unitdir}/tee-supplicant@.service \ | ||
36 | ${D}${sysconfdir}/init.d/tee-supplicant | ||
37 | } | ||
37 | 38 | ||
38 | cp -a ${B}/export/usr/include ${D}${includedir} | 39 | SYSTEMD_SERVICE:${PN} = "tee-supplicant@.service" |
39 | 40 | ||
40 | sed -i -e s:/etc:${sysconfdir}:g -e s:/usr/bin:${bindir}:g ${UNPACKDIR}/tee-supplicant.service | 41 | INITSCRIPT_PACKAGES = "${PN}" |
41 | install -D -p -m0644 ${UNPACKDIR}/tee-supplicant.service ${D}${systemd_system_unitdir}/tee-supplicant.service | 42 | INITSCRIPT_NAME:${PN} = "tee-supplicant" |
42 | } | 43 | INITSCRIPT_PARAMS:${PN} = "start 10 1 2 3 4 5 . stop 90 0 6 ." |
diff --git a/recipes-security/optee-imx/optee-client/tee-supplicant.service b/recipes-security/optee-imx/optee-client/tee-supplicant.service deleted file mode 100644 index 0e2b4f6b..00000000 --- a/recipes-security/optee-imx/optee-client/tee-supplicant.service +++ /dev/null | |||
@@ -1,11 +0,0 @@ | |||
1 | [Unit] | ||
2 | Description=TEE Supplicant | ||
3 | |||
4 | [Service] | ||
5 | User=root | ||
6 | EnvironmentFile=-/etc/default/tee-supplicant | ||
7 | ExecStart=/usr/bin/tee-supplicant $OPTARGS | ||
8 | |||
9 | [Install] | ||
10 | WantedBy=basic.target | ||
11 | |||
diff --git a/recipes-security/optee-imx/optee-client/tee-supplicant.sh b/recipes-security/optee-imx/optee-client/tee-supplicant.sh new file mode 100644 index 00000000..b4d21950 --- /dev/null +++ b/recipes-security/optee-imx/optee-client/tee-supplicant.sh | |||
@@ -0,0 +1,46 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # Source function library | ||
4 | . /etc/init.d/functions | ||
5 | |||
6 | NAME=tee-supplicant | ||
7 | PATH=/sbin:/bin:/usr/sbin:/usr/bin | ||
8 | DESC="OP-TEE Supplicant" | ||
9 | |||
10 | DAEMON=@sbindir@/$NAME | ||
11 | |||
12 | test -f $DAEMON || exit 0 | ||
13 | |||
14 | test -f @sysconfdir@/default/$NAME && . @sysconfdir@/default/$NAME | ||
15 | test -f @sysconfdir@/default/rcS && . @sysconfdir@/default/rcS | ||
16 | |||
17 | SSD_OPTIONS="--oknodo --quiet --exec $DAEMON -- -d $OPTARGS" | ||
18 | |||
19 | set -e | ||
20 | |||
21 | case $1 in | ||
22 | start) | ||
23 | echo -n "Starting $DESC: " | ||
24 | start-stop-daemon --start $SSD_OPTIONS | ||
25 | echo "${DAEMON##*/}." | ||
26 | ;; | ||
27 | stop) | ||
28 | echo -n "Stopping $DESC: " | ||
29 | start-stop-daemon --stop $SSD_OPTIONS | ||
30 | echo "${DAEMON##*/}." | ||
31 | ;; | ||
32 | restart|force-reload) | ||
33 | $0 stop | ||
34 | sleep 1 | ||
35 | $0 start | ||
36 | ;; | ||
37 | status) | ||
38 | status ${DAEMON} || exit $? | ||
39 | ;; | ||
40 | *) | ||
41 | echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2 | ||
42 | exit 1 | ||
43 | ;; | ||
44 | esac | ||
45 | |||
46 | exit 0 | ||
diff --git a/recipes-security/optee-imx/optee-client/tee-supplicant@.service b/recipes-security/optee-imx/optee-client/tee-supplicant@.service new file mode 100644 index 00000000..72c0b9aa --- /dev/null +++ b/recipes-security/optee-imx/optee-client/tee-supplicant@.service | |||
@@ -0,0 +1,10 @@ | |||
1 | [Unit] | ||
2 | Description=TEE Supplicant on %i | ||
3 | |||
4 | [Service] | ||
5 | User=root | ||
6 | EnvironmentFile=-@sysconfdir@/default/tee-supplicant | ||
7 | ExecStart=@sbindir@/tee-supplicant $OPTARGS | ||
8 | |||
9 | [Install] | ||
10 | WantedBy=basic.target | ||
diff --git a/recipes-security/optee-imx/optee-client/tee-udev.rules b/recipes-security/optee-imx/optee-client/tee-udev.rules new file mode 100644 index 00000000..43fafd8c --- /dev/null +++ b/recipes-security/optee-imx/optee-client/tee-udev.rules | |||
@@ -0,0 +1,7 @@ | |||
1 | # tee devices can only be accessed by the teeclnt group members | ||
2 | KERNEL=="tee[0-9]*", TAG+="systemd", MODE="0660", GROUP="teeclnt" | ||
3 | |||
4 | # If a /dev/teepriv[0-9]* device is detected, start an instance of | ||
5 | # tee-supplicant.service with the device name as parameter | ||
6 | KERNEL=="teepriv[0-9]*", MODE="0660", OWNER="root", GROUP="tee", \ | ||
7 | TAG+="systemd", ENV{SYSTEMD_WANTS}+="tee-supplicant@%k.service" | ||
diff --git a/recipes-security/optee-imx/optee-client_4.2.0.imx.bb b/recipes-security/optee-imx/optee-client_4.2.0.imx.bb deleted file mode 100644 index 59f8c84d..00000000 --- a/recipes-security/optee-imx/optee-client_4.2.0.imx.bb +++ /dev/null | |||
@@ -1,7 +0,0 @@ | |||
1 | require optee-client-fslc-imx.inc | ||
2 | |||
3 | SRCBRANCH = "lf-6.6.36_2.1.0" | ||
4 | SRCREV = "3eac340a781c00ccd61b151b0e9c22a8c6e9f9f0" | ||
5 | |||
6 | DEPENDS += "util-linux" | ||
7 | EXTRA_OEMAKE += "PKG_CONFIG=pkg-config" | ||
diff --git a/recipes-security/optee-imx/optee-client_4.4.0.imx.bb b/recipes-security/optee-imx/optee-client_4.4.0.imx.bb new file mode 100644 index 00000000..322f998f --- /dev/null +++ b/recipes-security/optee-imx/optee-client_4.4.0.imx.bb | |||
@@ -0,0 +1,4 @@ | |||
1 | require optee-client-fslc-imx.inc | ||
2 | |||
3 | SRCBRANCH = "lf-6.6.52_2.2.0" | ||
4 | SRCREV = "d221676a58b305bddbf97db00395205b3038de8e" | ||
diff --git a/recipes-security/optee-imx/optee-fslc.inc b/recipes-security/optee-imx/optee-fslc.inc index 6c96dc2b..42e23fc2 100644 --- a/recipes-security/optee-imx/optee-fslc.inc +++ b/recipes-security/optee-imx/optee-fslc.inc | |||
@@ -1,26 +1,43 @@ | |||
1 | HOMEPAGE = "http://www.optee.org/" | 1 | # Copied from meta-arm/recipes-security/optee/optee.inc. |
2 | # See: https://github.com/nxp-imx/imx-manifest/blob/imx-linux-scarthgap/imx-6.6.52-2.2.0.xml#L30 | ||
2 | 3 | ||
3 | inherit python3native features_check | 4 | UPSTREAM_CHECK_GITTAGREGEX = "^(?P<pver>\d+(\.\d+)+)$" |
4 | 5 | ||
5 | REQUIRED_MACHINE_FEATURES = "optee" | 6 | COMPATIBLE_MACHINE ?= "invalid" |
7 | COMPATIBLE_MACHINE:qemuarm64 ?= "qemuarm64" | ||
8 | COMPATIBLE_MACHINE:qemuarm ?= "qemuarm" | ||
9 | # Please add supported machines below or set it in .bbappend or .conf | ||
6 | 10 | ||
7 | DEPENDS = "python3-cryptography-native" | 11 | OPTEEMACHINE ?= "${MACHINE}" |
12 | OPTEEMACHINE:aarch64:qemuall ?= "vexpress-qemu_armv8a" | ||
13 | OPTEEMACHINE:arm:qemuall ?= "vexpress-qemu_virt" | ||
8 | 14 | ||
9 | S = "${WORKDIR}/git" | 15 | OPTEE_ARCH = "null" |
10 | B = "${WORKDIR}/build" | 16 | OPTEE_ARCH:arm = "arm32" |
11 | |||
12 | OPTEE_ARCH:arm = "arm32" | ||
13 | OPTEE_ARCH:aarch64 = "arm64" | 17 | OPTEE_ARCH:aarch64 = "arm64" |
18 | OPTEE_CORE = "${@d.getVar('OPTEE_ARCH').upper()}" | ||
19 | |||
20 | # FIXME - breaks with Clang 18. See https://github.com/OP-TEE/optee_os/issues/6754 | ||
21 | TOOLCHAIN = "gcc" | ||
22 | |||
23 | OPTEE_TOOLCHAIN = "${@d.getVar('TOOLCHAIN') or 'gcc'}" | ||
24 | OPTEE_COMPILER = "${@bb.utils.contains("BBFILE_COLLECTIONS", "clang-layer", "${OPTEE_TOOLCHAIN}", "gcc", d)}" | ||
14 | 25 | ||
15 | COMPILER ?= "gcc" | 26 | # Set here but not passed to EXTRA_OEMAKE by default as that breaks |
16 | COMPILER:toolchain-clang = "clang" | 27 | # the optee-os build |
28 | TA_DEV_KIT_DIR = "${STAGING_INCDIR}/optee/export-user_ta" | ||
29 | |||
30 | EXTRA_OEMAKE += "V=1 \ | ||
31 | LIBGCC_LOCATE_CFLAGS='${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}' \ | ||
32 | COMPILER=${OPTEE_COMPILER} \ | ||
33 | OPTEE_CLIENT_EXPORT=${STAGING_DIR_HOST}${prefix} \ | ||
34 | TEEC_EXPORT=${STAGING_DIR_HOST}${prefix} \ | ||
35 | " | ||
36 | # python3-cryptography needs the legacy provider, so set OPENSSL_MODULES to the | ||
37 | # right path until this is relocated automatically. | ||
38 | export OPENSSL_MODULES="${STAGING_LIBDIR_NATIVE}/ossl-modules" | ||
17 | 39 | ||
18 | CFLAGS += "--sysroot=${STAGING_DIR_HOST}" | 40 | CFLAGS += "--sysroot=${STAGING_DIR_HOST}" |
19 | CXXFLAGS += "--sysroot=${STAGING_DIR_HOST}" | 41 | |
20 | 42 | # See the rationale in https://github.com/f-secure-foundry/advisories/blob/master/Security_Advisory-Ref_FSC-HWSEC-VR2021-0001-OP-TEE_TrustZone_bypass.txt. | |
21 | EXTRA_OEMAKE = " \ | 43 | CVE_STATUS[CVE-2021-36133] = "disputed: devices shipped open for development purposes" |
22 | COMPILER=${COMPILER} \ | ||
23 | OPENSSL_MODULES=${STAGING_LIBDIR_NATIVE}/ossl-modules \ | ||
24 | OPTEE_CLIENT_EXPORT=${STAGING_DIR_HOST}${exec_prefix} \ | ||
25 | -C ${S} O=${B} \ | ||
26 | " | ||
diff --git a/recipes-security/optee-imx/optee-os-common-fslc-imx.inc b/recipes-security/optee-imx/optee-os-common-fslc-imx.inc new file mode 100644 index 00000000..941182fe --- /dev/null +++ b/recipes-security/optee-imx/optee-os-common-fslc-imx.inc | |||
@@ -0,0 +1,62 @@ | |||
1 | # Copied from meta-imx/meta-imx-bsp/recipes-security/optee/optee-os-common-imx.inc. | ||
2 | # See: https://github.com/nxp-imx/imx-manifest/blob/imx-linux-scarthgap/imx-6.6.52-2.2.0.xml#L37 | ||
3 | |||
4 | require optee-os-fslc.inc | ||
5 | |||
6 | DEPENDS:append:arm = "u-boot-mkimage-native" | ||
7 | |||
8 | FILESEXTRAPATHS:prepend := "${THISDIR}/optee-os:" | ||
9 | |||
10 | SRC_URI:remove = "git://github.com/OP-TEE/optee_os.git;branch=master;protocol=https" | ||
11 | SRC_URI:prepend = "${OPTEE_OS_SRC};branch=${SRCBRANCH} " | ||
12 | SRC_URI:append = " file://0007-allow-setting-sysroot-for-clang.patch" | ||
13 | SRC_URI:remove = "file://0001-allow-setting-sysroot-for-libgcc-lookup.patch \ | ||
14 | file://0002-optee-enable-clang-support.patch \ | ||
15 | file://0003-core-link-add-no-warn-rwx-segments.patch" | ||
16 | |||
17 | OPTEE_OS_SRC ?= "git://github.com/nxp-imx/imx-optee-os.git;protocol=https" | ||
18 | |||
19 | inherit features_check | ||
20 | |||
21 | REQUIRED_MACHINE_FEATURES = "optee" | ||
22 | |||
23 | OPTEEMACHINE = "imx-${@d.getVar('MACHINE')[1:]}" | ||
24 | OPTEEMACHINE:imx6qpdlsolox = "imx-mx6qsabresd" | ||
25 | OPTEEMACHINE:mx6ul-nxp-bsp = "imx-mx6ulevk" | ||
26 | OPTEEMACHINE:mx6ull-nxp-bsp = "imx-mx6ullevk" | ||
27 | OPTEEMACHINE:mx6ulz-nxp-bsp = "imx-mx6ulzevk" | ||
28 | OPTEEMACHINE:mx8mq-nxp-bsp = "imx-mx8mqevk" | ||
29 | OPTEEMACHINE:mx8mm-nxp-bsp = "imx-mx8mmevk" | ||
30 | OPTEEMACHINE:mx8mn-nxp-bsp = "imx-mx8mnevk" | ||
31 | OPTEEMACHINE:mx8mp-nxp-bsp = "imx-mx8mpevk" | ||
32 | OPTEEMACHINE:mx8mpul-nxp-bsp = "imx-mx8mpevk" | ||
33 | OPTEEMACHINE:mx8qm-nxp-bsp = "imx-mx8qmmek" | ||
34 | OPTEEMACHINE:mx8qxp-nxp-bsp = "imx-mx8qxpmek" | ||
35 | OPTEEMACHINE:mx8dx-nxp-bsp = "imx-mx8dxmek" | ||
36 | OPTEEMACHINE:mx8dxl-nxp-bsp = "imx-mx8dxlevk" | ||
37 | OPTEEMACHINE:mx8mnul-nxp-bsp = "imx-mx8mnevk" | ||
38 | OPTEEMACHINE:mx8ulp-nxp-bsp = "imx-mx8ulpevk" | ||
39 | OPTEEMACHINE:mx91-nxp-bsp = "imx-mx91evk" | ||
40 | OPTEEMACHINE:mx93-nxp-bsp = "imx-mx93evk" | ||
41 | OPTEEMACHINE:mx95-nxp-bsp = "imx-mx95evk" | ||
42 | |||
43 | # Strip the leading imx- | ||
44 | PLATFORM_FLAVOR = "${@d.getVar('OPTEEMACHINE')[4:]}" | ||
45 | |||
46 | EXTRA_OEMAKE:append = " \ | ||
47 | CFG_TEE_TA_LOG_LEVEL=0 \ | ||
48 | CFG_TEE_CORE_LOG_LEVEL=0 \ | ||
49 | " | ||
50 | |||
51 | EXTRA_OEMAKE:append:imx8mq-lpddr4-wevk = " \ | ||
52 | CFG_CORE_LARGE_PHYS_ADDR=y \ | ||
53 | CFG_CORE_ARM64_PA_BITS=36 \ | ||
54 | CFG_DDR_SIZE=0x100000000 \ | ||
55 | CFG_TZDRAM_START=0xfe000000 \ | ||
56 | " | ||
57 | |||
58 | EXTRA_OEMAKE:append:imx8dxlb0-fips-lpddr4-evk = " \ | ||
59 | CFG_NXP_CAAM=n \ | ||
60 | " | ||
61 | |||
62 | COMPATIBLE_MACHINE = "(imx-nxp-bsp)" | ||
diff --git a/recipes-security/optee-imx/optee-os-fslc-imx.inc b/recipes-security/optee-imx/optee-os-fslc-imx.inc index f4a532b7..5fe6a75a 100644 --- a/recipes-security/optee-imx/optee-os-fslc-imx.inc +++ b/recipes-security/optee-imx/optee-os-fslc-imx.inc | |||
@@ -1,27 +1,26 @@ | |||
1 | require optee-os-fslc.inc | 1 | # Copied from meta-imx/meta-imx-bsp/recipes-security/optee/optee-os-imx.inc. |
2 | # See: https://github.com/nxp-imx/imx-manifest/blob/imx-linux-scarthgap/imx-6.6.52-2.2.0.xml#L37 | ||
2 | 3 | ||
3 | SRC_URI = "git://github.com/nxp-imx/imx-optee-os.git;protocol=https;branch=${SRCBRANCH}" | 4 | require optee-os-common-fslc-imx.inc |
4 | 5 | ||
5 | # The platform flavor corresponds to the Yocto machine without the leading 'i'. | 6 | do_compile:arm() { |
6 | PLATFORM_FLAVOR = "${@d.getVar('MACHINE')[1:]}" | 7 | oe_runmake -C ${S} all uTee |
7 | PLATFORM_FLAVOR:imx6qdlsabresd = "mx6qsabresd" | 8 | } |
8 | PLATFORM_FLAVOR:imx6qdlsabreauto = "mx6qsabreauto" | ||
9 | PLATFORM_FLAVOR:imx6qpdlsolox = "mx6qsabresd" | ||
10 | PLATFORM_FLAVOR:mx6ul-nxp-bsp = "mx6ulevk" | ||
11 | PLATFORM_FLAVOR:mx6ull-nxp-bsp = "mx6ullevk" | ||
12 | PLATFORM_FLAVOR:mx6ulz-nxp-bsp = "mx6ulzevk" | ||
13 | PLATFORM_FLAVOR:mx8mq-nxp-bsp = "mx8mqevk" | ||
14 | PLATFORM_FLAVOR:mx8mm-nxp-bsp = "mx8mmevk" | ||
15 | PLATFORM_FLAVOR:mx8mn-nxp-bsp = "mx8mnevk" | ||
16 | PLATFORM_FLAVOR:mx8mnul-nxp-bsp = "mx8mnevk" | ||
17 | PLATFORM_FLAVOR:mx8mp-nxp-bsp = "mx8mpevk" | ||
18 | PLATFORM_FLAVOR:mx8mpul-nxp-bsp = "mx8mpevk" | ||
19 | PLATFORM_FLAVOR:mx8qm-nxp-bsp = "mx8qmmek" | ||
20 | PLATFORM_FLAVOR:mx8qxp-nxp-bsp = "mx8qxpmek" | ||
21 | PLATFORM_FLAVOR:mx8dx-nxp-bsp = "mx8dxmek" | ||
22 | PLATFORM_FLAVOR:mx8dxl-nxp-bsp = "mx8dxlevk" | ||
23 | PLATFORM_FLAVOR:mx8ulp-nxp-bsp = "mx8ulpevk" | ||
24 | PLATFORM_FLAVOR:mx93-nxp-bsp = "mx93evk" | ||
25 | PLATFORM_FLAVOR:mx95-nxp-bsp = "mx95evk" | ||
26 | 9 | ||
27 | COMPATIBLE_MACHINE = "(imx-nxp-bsp)" | 10 | do_install:append () { |
11 | # Install embedded TAs | ||
12 | install -d ${D}${nonarch_base_libdir}/optee_armtz/ | ||
13 | install -m 444 ${B}/ta/*/*.ta ${D}${nonarch_base_libdir}/optee_armtz/ | ||
14 | } | ||
15 | |||
16 | do_deploy:append() { | ||
17 | cp ${B}/core/tee-raw.bin ${DEPLOYDIR}/${MLPREFIX}optee/tee.${PLATFORM_FLAVOR}.bin | ||
18 | ln -sf ${MLPREFIX}optee/tee.${PLATFORM_FLAVOR}.bin ${DEPLOYDIR}/tee.bin | ||
19 | } | ||
20 | |||
21 | do_deploy:append:arm() { | ||
22 | cp ${B}/core/uTee ${DEPLOYDIR}/${MLPREFIX}optee/uTee-${OPTEE_BIN_EXT} | ||
23 | ln -sf ${MLPREFIX}optee/uTee-${OPTEE_BIN_EXT} ${DEPLOYDIR}/uTee-${OPTEE_BIN_EXT} | ||
24 | } | ||
25 | |||
26 | FILES:${PN} += "${nonarch_base_libdir}/optee_armtz" | ||
diff --git a/recipes-security/optee-imx/optee-os-fslc.inc b/recipes-security/optee-imx/optee-os-fslc.inc index 61906344..c1f1f48f 100644 --- a/recipes-security/optee-imx/optee-os-fslc.inc +++ b/recipes-security/optee-imx/optee-os-fslc.inc | |||
@@ -1,90 +1,86 @@ | |||
1 | # Copyright (C) 2017-2021,2024 NXP | 1 | # Copied from meta-arm/recipes-security/optee/optee-os.inc. |
2 | # See: https://github.com/nxp-imx/imx-manifest/blob/imx-linux-scarthgap/imx-6.6.52-2.2.0.xml#L30 | ||
3 | |||
4 | SUMMARY = "OP-TEE Trusted OS" | ||
5 | DESCRIPTION = "Open Portable Trusted Execution Environment - Trusted side of the TEE" | ||
6 | HOMEPAGE = "https://www.op-tee.org/" | ||
2 | 7 | ||
3 | SUMMARY = "OPTEE OS" | ||
4 | DESCRIPTION = "OPTEE OS" | ||
5 | LICENSE = "BSD-2-Clause" | 8 | LICENSE = "BSD-2-Clause" |
6 | LIC_FILES_CHKSUM = "file://LICENSE;md5=c1f21c4f72f372ef38a5a4aee55ec173" | 9 | LIC_FILES_CHKSUM = "file://LICENSE;md5=c1f21c4f72f372ef38a5a4aee55ec173" |
7 | 10 | ||
11 | inherit deploy python3native | ||
8 | require optee-fslc.inc | 12 | require optee-fslc.inc |
9 | 13 | ||
10 | DEPENDS += "python3-pyelftools-native u-boot-mkimage-native" | 14 | CVE_PRODUCT = "linaro:op-tee op-tee:op-tee_os" |
15 | |||
16 | DEPENDS = "python3-pyelftools-native python3-cryptography-native" | ||
17 | |||
11 | DEPENDS:append:toolchain-clang = " compiler-rt" | 18 | DEPENDS:append:toolchain-clang = " compiler-rt" |
12 | 19 | ||
13 | inherit deploy autotools | 20 | SRC_URI = "git://github.com/OP-TEE/optee_os.git;branch=master;protocol=https" |
14 | 21 | ||
15 | # Optee-os can be built for 32 bits and 64 bits at the same time | 22 | S = "${WORKDIR}/git" |
16 | # as long as the compilers are correctly defined. | 23 | B = "${WORKDIR}/build" |
17 | # For 64bits, CROSS_COMPILE64 must be set | ||
18 | # When defining CROSS_COMPILE and CROSS_COMPILE64, we assure that | ||
19 | # any 32 or 64 bits builds will pass | ||
20 | EXTRA_OEMAKE += " \ | ||
21 | PLATFORM=imx-${PLATFORM_FLAVOR} \ | ||
22 | CROSS_COMPILE=${HOST_PREFIX} \ | ||
23 | CROSS_COMPILE64=${HOST_PREFIX} \ | ||
24 | CFLAGS32=--sysroot=${STAGING_DIR_HOST} \ | ||
25 | CFLAGS64=--sysroot=${STAGING_DIR_HOST} \ | ||
26 | CFG_TEE_TA_LOG_LEVEL=0 \ | ||
27 | CFG_TEE_CORE_LOG_LEVEL=0 \ | ||
28 | " | ||
29 | 24 | ||
30 | EXTRA_OEMAKE:append:imx8mq-lpddr4-wevk = " \ | 25 | EXTRA_OEMAKE += " \ |
31 | CFG_CORE_LARGE_PHYS_ADDR=y \ | 26 | PLATFORM=${OPTEEMACHINE} \ |
32 | CFG_CORE_ARM64_PA_BITS=36 \ | 27 | CFG_${OPTEE_CORE}_core=y \ |
33 | CFG_DDR_SIZE=0x100000000 \ | 28 | CROSS_COMPILE_core=${HOST_PREFIX} \ |
34 | CFG_TZDRAM_START=0xfe000000 \ | 29 | CROSS_COMPILE_ta_${OPTEE_ARCH}=${HOST_PREFIX} \ |
30 | NOWERROR=1 \ | ||
31 | ta-targets=ta_${OPTEE_ARCH} \ | ||
32 | O=${B} \ | ||
35 | " | 33 | " |
34 | EXTRA_OEMAKE += " HOST_PREFIX=${HOST_PREFIX}" | ||
35 | EXTRA_OEMAKE += " CROSS_COMPILE64=${HOST_PREFIX}" | ||
36 | 36 | ||
37 | LDFLAGS[unexport] = "1" | 37 | LDFLAGS[unexport] = "1" |
38 | CPPFLAGS[unexport] = "1" | 38 | CPPFLAGS[unexport] = "1" |
39 | AS[unexport] = "1" | 39 | AS[unexport] = "1" |
40 | LD[unexport] = "1" | 40 | LD[unexport] = "1" |
41 | 41 | ||
42 | do_configure[noexec] = "1" | ||
43 | |||
44 | do_compile:prepend() { | 42 | do_compile:prepend() { |
45 | PLAT_LIBGCC_PATH=$(${CC} -print-libgcc-file-name) | 43 | PLAT_LIBGCC_PATH=$(${CC} -print-libgcc-file-name) |
46 | } | ||
47 | |||
48 | do_compile:arm () { | ||
49 | oe_runmake all uTee | ||
50 | } | 44 | } |
51 | 45 | ||
52 | do_compile:aarch64 () { | 46 | do_compile() { |
53 | oe_runmake all | 47 | oe_runmake -C ${S} all |
54 | } | 48 | } |
55 | do_compile[cleandirs] = "${B}" | 49 | do_compile[cleandirs] = "${B}" |
56 | 50 | ||
57 | do_deploy () { | 51 | do_install() { |
58 | install -d ${DEPLOYDIR} | 52 | #install core in firmware |
59 | cp ${B}/core/tee-raw.bin ${DEPLOYDIR}/tee.${PLATFORM_FLAVOR}.bin | 53 | install -d ${D}${nonarch_base_libdir}/firmware/ |
60 | ln -sf tee.${PLATFORM_FLAVOR}.bin ${DEPLOYDIR}/tee.bin | 54 | install -m 644 ${B}/core/*.bin ${B}/core/tee.elf ${D}${nonarch_base_libdir}/firmware/ |
61 | } | ||
62 | 55 | ||
63 | do_deploy:append:arm () { | 56 | #install tas in optee_armtz |
64 | cp ${B}/core/uTee ${DEPLOYDIR}/uTee-${OPTEE_BIN_EXT} | 57 | install -d ${D}${nonarch_base_libdir}/optee_armtz/ |
58 | install -m 444 ${B}/ta/*/*.ta ${D}${nonarch_base_libdir}/optee_armtz | ||
65 | } | 59 | } |
66 | 60 | ||
67 | do_install () { | 61 | PACKAGE_ARCH = "${MACHINE_ARCH}" |
68 | install -d ${D}${nonarch_base_libdir}/firmware/ | ||
69 | install -m 644 ${B}/core/*.bin ${D}${nonarch_base_libdir}/firmware/ | ||
70 | 62 | ||
71 | # Install embedded TAs | 63 | do_deploy() { |
72 | install -d ${D}${nonarch_base_libdir}/optee_armtz/ | 64 | install -d ${DEPLOYDIR}/${MLPREFIX}optee |
73 | install -m 444 ${B}/ta/*/*.ta ${D}${nonarch_base_libdir}/optee_armtz/ | 65 | install -m 644 ${D}${nonarch_base_libdir}/firmware/* ${DEPLOYDIR}/${MLPREFIX}optee |
74 | 66 | ||
75 | # Install the TA devkit | 67 | install -d ${DEPLOYDIR}/${MLPREFIX}optee/ta |
76 | install -d ${D}${includedir}/optee/export-user_ta_${OPTEE_ARCH}/ | 68 | install -m 644 ${B}/ta/*/*.elf ${DEPLOYDIR}/${MLPREFIX}optee/ta |
77 | cp -aR ${B}/export-ta_${OPTEE_ARCH}/* \ | ||
78 | ${D}${includedir}/optee/export-user_ta_${OPTEE_ARCH}/ | ||
79 | } | 69 | } |
80 | 70 | ||
81 | addtask deploy after do_compile before do_install | 71 | addtask deploy before do_build after do_install |
82 | 72 | ||
83 | FILES:${PN} = "${nonarch_base_libdir}/firmware/ ${nonarch_base_libdir}/optee_armtz/" | 73 | SYSROOT_DIRS += "${nonarch_base_libdir}/firmware" |
84 | FILES:${PN}-staticdev = "${includedir}/optee/" | ||
85 | RDEPENDS:${PN}-dev += "${PN}-staticdev" | ||
86 | 74 | ||
87 | # FIXME: Build paths are currently embedded | 75 | PACKAGES += "${PN}-ta" |
88 | INSANE_SKIP:${PN}-staticdev += "buildpaths" | 76 | FILES:${PN} = "${nonarch_base_libdir}/firmware/" |
77 | FILES:${PN}-ta = "${nonarch_base_libdir}/optee_armtz/*" | ||
78 | |||
79 | |||
80 | # note: "textrel" is not triggered on all archs | ||
81 | INSANE_SKIP:${PN} = "textrel" | ||
82 | # Build paths are currently embedded | ||
83 | INSANE_SKIP:${PN} += "buildpaths" | ||
84 | INSANE_SKIP:${PN}-dev = "staticdev" | ||
85 | INHIBIT_PACKAGE_STRIP = "1" | ||
89 | 86 | ||
90 | PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
diff --git a/recipes-security/optee-imx/optee-os-tadevkit-fslc-imx.inc b/recipes-security/optee-imx/optee-os-tadevkit-fslc-imx.inc new file mode 100644 index 00000000..18cf9a37 --- /dev/null +++ b/recipes-security/optee-imx/optee-os-tadevkit-fslc-imx.inc | |||
@@ -0,0 +1,27 @@ | |||
1 | # Copied from meta-imx/meta-imx-bsp/recipes-security/optee/optee-os-tadevkit-imx.inc. | ||
2 | # See: https://github.com/nxp-imx/imx-manifest/blob/imx-linux-scarthgap/imx-6.6.52-2.2.0.xml#L37 | ||
3 | |||
4 | require optee-os-common-fslc-imx.inc | ||
5 | |||
6 | SUMMARY = "OP-TEE Trusted OS TA devkit" | ||
7 | DESCRIPTION = "OP-TEE TA devkit for build TAs" | ||
8 | HOMEPAGE = "https://www.op-tee.org/" | ||
9 | |||
10 | DEPENDS += "python3-pycryptodome-native" | ||
11 | |||
12 | do_install() { | ||
13 | #install TA devkit | ||
14 | install -d ${D}${includedir}/optee/export-user_ta/ | ||
15 | for f in ${B}/export-ta_${OPTEE_ARCH}/* ; do | ||
16 | cp -aR $f ${D}${includedir}/optee/export-user_ta/ | ||
17 | done | ||
18 | } | ||
19 | |||
20 | do_deploy() { | ||
21 | echo "Do not inherit do_deploy from optee-os." | ||
22 | } | ||
23 | |||
24 | FILES:${PN} = "${includedir}/optee/" | ||
25 | |||
26 | # Build paths are currently embedded | ||
27 | INSANE_SKIP:${PN}-dev += "buildpaths" | ||
diff --git a/recipes-security/optee-imx/optee-os-tadevkit_4.4.0.imx.bb b/recipes-security/optee-imx/optee-os-tadevkit_4.4.0.imx.bb new file mode 100644 index 00000000..bb2e2cf6 --- /dev/null +++ b/recipes-security/optee-imx/optee-os-tadevkit_4.4.0.imx.bb | |||
@@ -0,0 +1,4 @@ | |||
1 | require optee-os-tadevkit-fslc-imx.inc | ||
2 | |||
3 | SRCBRANCH = "lf-6.6.52_2.2.0" | ||
4 | SRCREV = "60beb308810f9561a67fdb435388a64c85eb6dcb" | ||
diff --git a/recipes-security/optee-imx/optee-os/0007-allow-setting-sysroot-for-clang.patch b/recipes-security/optee-imx/optee-os/0007-allow-setting-sysroot-for-clang.patch new file mode 100644 index 00000000..067ba6eb --- /dev/null +++ b/recipes-security/optee-imx/optee-os/0007-allow-setting-sysroot-for-clang.patch | |||
@@ -0,0 +1,30 @@ | |||
1 | From db9e44af75c7cfd3316cab15aaa387383df3e57e Mon Sep 17 00:00:00 2001 | ||
2 | From: Brett Warren <brett.warren@arm.com> | ||
3 | Date: Wed, 23 Sep 2020 09:27:34 +0100 | ||
4 | Subject: [PATCH] optee: enable clang support | ||
5 | |||
6 | When compiling with clang, the LIBGCC_LOCATE_CFLAG variable used | ||
7 | to provide a sysroot wasn't included, which results in not locating | ||
8 | compiler-rt. This is mitigated by including the variable as ammended. | ||
9 | |||
10 | Upstream-Status: Pending | ||
11 | ChangeId: 8ba69a4b2eb8ebaa047cb266c9aa6c2c3da45701 | ||
12 | Signed-off-by: Brett Warren <brett.warren@arm.com> | ||
13 | |||
14 | --- | ||
15 | mk/clang.mk | 2 +- | ||
16 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
17 | |||
18 | diff --git a/mk/clang.mk b/mk/clang.mk | ||
19 | index c141a3f2..7d067cc0 100644 | ||
20 | --- a/mk/clang.mk | ||
21 | +++ b/mk/clang.mk | ||
22 | @@ -27,7 +27,7 @@ comp-cflags-warns-clang := -Wno-language-extension-token \ | ||
23 | |||
24 | # Note, use the compiler runtime library (libclang_rt.builtins.*.a) instead of | ||
25 | # libgcc for clang | ||
26 | -libgcc$(sm) := $(shell $(CC$(sm)) $(CFLAGS$(arch-bits-$(sm))) \ | ||
27 | +libgcc$(sm) := $(shell $(CC$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CFLAGS$(arch-bits-$(sm))) \ | ||
28 | -rtlib=compiler-rt -print-libgcc-file-name 2> /dev/null) | ||
29 | |||
30 | # Core ASLR relies on the executable being ready to run from its preferred load | ||
diff --git a/recipes-security/optee-imx/optee-os_4.2.0.imx.bb b/recipes-security/optee-imx/optee-os_4.4.0.imx.bb index 11da204e..5ff12a59 100644 --- a/recipes-security/optee-imx/optee-os_4.2.0.imx.bb +++ b/recipes-security/optee-imx/optee-os_4.4.0.imx.bb | |||
@@ -6,5 +6,5 @@ SRC_URI += " \ | |||
6 | file://0001-core-Define-section-attributes-for-clang.patch \ | 6 | file://0001-core-Define-section-attributes-for-clang.patch \ |
7 | file://0002-optee-enable-clang-support.patch \ | 7 | file://0002-optee-enable-clang-support.patch \ |
8 | " | 8 | " |
9 | SRCBRANCH = "lf-6.6.36_2.1.0" | 9 | SRCBRANCH = "lf-6.6.52_2.2.0" |
10 | SRCREV = "612bc5a642a4608d282abeee2349d86de996d7ee" | 10 | SRCREV = "60beb308810f9561a67fdb435388a64c85eb6dcb" |
diff --git a/recipes-security/optee-imx/optee-test-fslc-imx.inc b/recipes-security/optee-imx/optee-test-fslc-imx.inc new file mode 100644 index 00000000..ab16fd22 --- /dev/null +++ b/recipes-security/optee-imx/optee-test-fslc-imx.inc | |||
@@ -0,0 +1,18 @@ | |||
1 | # Copied from meta-imx/meta-imx-bsp/recipes-security/optee/optee-test-imx.inc. | ||
2 | # See: https://github.com/nxp-imx/imx-manifest/blob/imx-linux-scarthgap/imx-6.6.52-2.2.0.xml#L37 | ||
3 | |||
4 | require optee-test-fslc.inc | ||
5 | |||
6 | DEPENDS += "openssl" | ||
7 | |||
8 | FILESEXTRAPATHS:prepend := "${THISDIR}/optee-test:" | ||
9 | |||
10 | SRC_URI:remove = "git://github.com/OP-TEE/optee_test.git;branch=master;protocol=https" | ||
11 | SRC_URI:prepend = "${OPTEE_TEST_SRC};branch=${SRCBRANCH} " | ||
12 | |||
13 | OPTEE_TEST_SRC ?= "git://github.com/nxp-imx/imx-optee-test.git;protocol=https" | ||
14 | |||
15 | EXTRA_OEMAKE:append:libc-musl = " OPTEE_OPENSSL_EXPORT=${STAGING_INCDIR}" | ||
16 | CFLAGS:append:libc-musl = " -Wno-error=deprecated-declarations" | ||
17 | |||
18 | COMPATIBLE_MACHINE = "(imx-nxp-bsp)" | ||
diff --git a/recipes-security/optee-imx/optee-test-fslc.inc b/recipes-security/optee-imx/optee-test-fslc.inc index e0c133a7..0fb5f878 100644 --- a/recipes-security/optee-imx/optee-test-fslc.inc +++ b/recipes-security/optee-imx/optee-test-fslc.inc | |||
@@ -1,38 +1,65 @@ | |||
1 | # Copyright (C) 2017-2021 NXP | 1 | # Copied from meta-arm/recipes-security/optee/optee-test.inc. |
2 | # See: https://github.com/nxp-imx/imx-manifest/blob/imx-linux-scarthgap/imx-6.6.52-2.2.0.xml#L30 | ||
3 | |||
4 | SUMMARY = "OP-TEE sanity testsuite" | ||
5 | DESCRIPTION = "Open Portable Trusted Execution Environment - Test suite" | ||
6 | HOMEPAGE = "https://www.op-tee.org/" | ||
2 | 7 | ||
3 | SUMMARY = "OPTEE test" | ||
4 | LICENSE = "BSD-2-Clause & GPL-2.0-only" | 8 | LICENSE = "BSD-2-Clause & GPL-2.0-only" |
5 | LIC_FILES_CHKSUM = "file://LICENSE.md;md5=daa2bcccc666345ab8940aab1315a4fa" | 9 | LIC_FILES_CHKSUM = "file://LICENSE.md;md5=daa2bcccc666345ab8940aab1315a4fa" |
6 | 10 | ||
11 | inherit python3native ptest | ||
12 | inherit deploy | ||
7 | require optee-fslc.inc | 13 | require optee-fslc.inc |
8 | 14 | ||
9 | DEPENDS += "optee-os optee-client openssl" | 15 | DEPENDS = "optee-client optee-os-tadevkit python3-cryptography-native openssl" |
16 | |||
17 | SRC_URI = "git://github.com/OP-TEE/optee_test.git;branch=master;protocol=https \ | ||
18 | file://run-ptest \ | ||
19 | " | ||
20 | |||
21 | S = "${WORKDIR}/git" | ||
22 | B = "${WORKDIR}/build" | ||
10 | 23 | ||
11 | EXTRA_OEMAKE += " \ | 24 | EXTRA_OEMAKE += "TA_DEV_KIT_DIR=${TA_DEV_KIT_DIR} \ |
12 | TA_DEV_KIT_DIR=${STAGING_INCDIR}/optee/export-user_ta_${OPTEE_ARCH}/ \ | 25 | OPTEE_OPENSSL_EXPORT=${STAGING_INCDIR} \ |
13 | CROSS_COMPILE_HOST=${HOST_PREFIX} \ | 26 | CROSS_COMPILE_HOST=${HOST_PREFIX} \ |
14 | CROSS_COMPILE_TA=${HOST_PREFIX} \ | 27 | CROSS_COMPILE_TA=${HOST_PREFIX} \ |
15 | CROSS_COMPILE=${HOST_PREFIX} \ | 28 | O=${B} \ |
16 | " | 29 | " |
30 | |||
31 | CFLAGS += "-Wno-error=deprecated-declarations" | ||
17 | 32 | ||
18 | do_compile() { | 33 | do_compile() { |
19 | oe_runmake all | 34 | cd ${S} |
35 | # Top level makefile doesn't seem to handle parallel make gracefully | ||
36 | oe_runmake xtest | ||
37 | oe_runmake ta | ||
38 | oe_runmake test_plugin | ||
20 | } | 39 | } |
21 | do_compile[cleandirs] = "${B}" | 40 | do_compile[cleandirs] = "${B}" |
22 | 41 | ||
23 | do_install () { | 42 | do_install () { |
24 | install -d ${D}${bindir} | 43 | install -D -p -m0755 ${B}/xtest/xtest ${D}${bindir}/xtest |
25 | install ${B}/xtest/xtest ${D}${bindir} | ||
26 | 44 | ||
27 | install -d ${D}${nonarch_base_libdir}/optee_armtz | 45 | # install path should match the value set in optee-client/tee-supplicant |
28 | find ${B}/ta -name '*.ta' | while read name; do | 46 | # default TEEC_LOAD_PATH is /lib |
29 | install -m 444 $name ${D}${nonarch_base_libdir}/optee_armtz/ | 47 | mkdir -p ${D}${nonarch_base_libdir}/optee_armtz/ |
30 | done | 48 | install -D -p -m0444 ${B}/ta/*/*.ta ${D}${nonarch_base_libdir}/optee_armtz/ |
49 | mkdir -p ${D}${libdir}/tee-supplicant/plugins | ||
50 | install -D -p -m0444 ${B}/supp_plugin/*.plugin ${D}${libdir}/tee-supplicant/plugins/ | ||
51 | } | ||
31 | 52 | ||
32 | install -d ${D}${libdir}/tee-supplicant/plugins/ | 53 | do_deploy () { |
33 | install ${B}/supp_plugin/*plugin ${D}${libdir}/tee-supplicant/plugins/ | 54 | install -d ${DEPLOYDIR}/${MLPREFIX}optee/ta |
55 | install -m 644 ${B}/ta/*/*.elf ${DEPLOYDIR}/${MLPREFIX}optee/ta | ||
34 | } | 56 | } |
35 | 57 | ||
36 | FILES:${PN} += "${nonarch_base_libdir}/optee_armtz/ ${libdir}/tee-supplicant/plugins/" | 58 | addtask deploy before do_build after do_install |
59 | |||
60 | FILES:${PN} += "${nonarch_base_libdir}/optee_armtz/ \ | ||
61 | ${libdir}/tee-supplicant/plugins/ \ | ||
62 | " | ||
37 | 63 | ||
38 | RDEPENDS:${PN} = "optee-os" | 64 | # Imports machine specific configs from staging to build |
65 | PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
diff --git a/recipes-security/optee-imx/optee-test/run-ptest b/recipes-security/optee-imx/optee-test/run-ptest new file mode 100644 index 00000000..ba88c14d --- /dev/null +++ b/recipes-security/optee-imx/optee-test/run-ptest | |||
@@ -0,0 +1,52 @@ | |||
1 | #!/bin/sh | ||
2 | xtest | awk ' | ||
3 | |||
4 | # Escapes the special characters in a string so that, when | ||
5 | # included in a regex, it represents a literal match | ||
6 | function regx_escape_literal(str, ret) { | ||
7 | ret = str | ||
8 | gsub(/[\[\]\^\$\.\*\?\+\{\}\\\(\)\|]/ , "\\\\&", str) | ||
9 | return str | ||
10 | } | ||
11 | |||
12 | # Returns the simple test formatted name | ||
13 | function name(n, ret) { | ||
14 | ret = n | ||
15 | gsub(/\./, " ", ret) | ||
16 | return ret | ||
17 | } | ||
18 | |||
19 | # Returns the simple test formatted result | ||
20 | function result(res) { | ||
21 | if(res ~ /OK/) { | ||
22 | return "PASS" | ||
23 | } else if(res ~ /FAILED/) { | ||
24 | return "FAIL" | ||
25 | } | ||
26 | } | ||
27 | |||
28 | function parse(name, description, has_subtests, result_line) { | ||
29 | has_subtests = 0 | ||
30 | |||
31 | # Consume every line up to the result line | ||
32 | result_line = " " regx_escape_literal(name) " (OK|FAILED)" | ||
33 | do { | ||
34 | getline | ||
35 | |||
36 | # If this is a subtest (denoted by an "o" bullet) then subparse | ||
37 | if($0 ~ /^o /) { | ||
38 | parse($2, description " : " substr($0, index($0, $3))) | ||
39 | has_subtests = 1 | ||
40 | } | ||
41 | } while ($0 !~ result_line) | ||
42 | |||
43 | # Only print the results for the deepest nested subtests | ||
44 | if(!has_subtests) { | ||
45 | print result($2) ": " name(name) " - " description | ||
46 | } | ||
47 | } | ||
48 | |||
49 | # Start parsing at the beginning of every test (denoted by a "*" bullet) | ||
50 | /^\* / { parse($2, substr($0, index($0, $3))) } | ||
51 | |||
52 | ' | ||
diff --git a/recipes-security/optee-imx/optee-test_4.2.0.imx.bb b/recipes-security/optee-imx/optee-test_4.2.0.imx.bb deleted file mode 100644 index e2cf40e9..00000000 --- a/recipes-security/optee-imx/optee-test_4.2.0.imx.bb +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | # Copyright 2017-2024 NXP | ||
2 | |||
3 | require optee-test-fslc.inc | ||
4 | |||
5 | SRC_URI = "git://github.com/nxp-imx/imx-optee-test.git;protocol=https;branch=${SRCBRANCH}" | ||
6 | |||
7 | SRCBRANCH = "lf-6.6.36_2.1.0" | ||
8 | SRCREV = "5b52b48a73b4cc3f228ec66ae6cf9920897bb2e6" | ||
9 | |||
10 | COMPATIBLE_MACHINE = "(imx-nxp-bsp)" | ||
diff --git a/recipes-security/optee-imx/optee-test_4.4.0.imx.bb b/recipes-security/optee-imx/optee-test_4.4.0.imx.bb new file mode 100644 index 00000000..b4ac1271 --- /dev/null +++ b/recipes-security/optee-imx/optee-test_4.4.0.imx.bb | |||
@@ -0,0 +1,13 @@ | |||
1 | # Copyright 2017-2024 NXP | ||
2 | |||
3 | require optee-test-fslc-imx.inc | ||
4 | |||
5 | # The BSD and GPL license files are now included in the source | ||
6 | # https://github.com/OP-TEE/optee_test/commit/a748f5fcd9ec8a574dc86a5aa56d05bc6ac174e7 | ||
7 | LIC_FILES_CHKSUM = "file://LICENSE.md;md5=a8fa504109e4cd7ea575bc49ea4be560 \ | ||
8 | file://LICENSE-BSD;md5=dca16d6efa93b55d0fd662ae5cd6feeb \ | ||
9 | file://LICENSE-GPL;md5=10e86b5d2a6cb0e2b9dcfdd26a9ac58d" | ||
10 | |||
11 | |||
12 | SRCBRANCH = "lf-6.6.52_2.2.0" | ||
13 | SRCREV = "dafc98ed8364d7281a9a7f0788dd0a2067844a59" | ||