summaryrefslogtreecommitdiffstats
path: root/recipes-security
diff options
context:
space:
mode:
authorOleksandr Suvorov <oleksandr.suvorov@foundries.io>2023-05-01 18:14:59 +0300
committerOleksandr Suvorov <oleksandr.suvorov@foundries.io>2023-05-02 17:30:14 +0300
commitc4288a04f82cea6763f12448e87d95e5c0364cf7 (patch)
tree1102b21395908b4427ca053a93a27f12ded53729 /recipes-security
parentc112655d9b4b4ca79a14237c658a9fec7db325c0 (diff)
downloadmeta-freescale-c4288a04f82cea6763f12448e87d95e5c0364cf7.tar.gz
optee: optimize optee-os and optee-test recipes to reuse code
Add include files for optee-os and optee-test. The include files feature requirements that are specific to optee/optee-os/optee-test projects and i.MX platforms. Recipe files with version number feature the git branch, commit hash and optionally repo URL/patch set. Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Diffstat (limited to 'recipes-security')
-rw-r--r--recipes-security/optee-imx/optee-fslc.inc26
-rw-r--r--recipes-security/optee-imx/optee-os-fslc-imx.inc26
-rw-r--r--recipes-security/optee-imx/optee-os-fslc.inc78
-rw-r--r--recipes-security/optee-imx/optee-os_3.19.0.imx.bb125
-rw-r--r--recipes-security/optee-imx/optee-test-fslc.inc38
-rw-r--r--recipes-security/optee-imx/optee-test_3.19.0.imx.bb58
6 files changed, 175 insertions, 176 deletions
diff --git a/recipes-security/optee-imx/optee-fslc.inc b/recipes-security/optee-imx/optee-fslc.inc
new file mode 100644
index 00000000..6c96dc2b
--- /dev/null
+++ b/recipes-security/optee-imx/optee-fslc.inc
@@ -0,0 +1,26 @@
1HOMEPAGE = "http://www.optee.org/"
2
3inherit python3native features_check
4
5REQUIRED_MACHINE_FEATURES = "optee"
6
7DEPENDS = "python3-cryptography-native"
8
9S = "${WORKDIR}/git"
10B = "${WORKDIR}/build"
11
12OPTEE_ARCH:arm = "arm32"
13OPTEE_ARCH:aarch64 = "arm64"
14
15COMPILER ?= "gcc"
16COMPILER:toolchain-clang = "clang"
17
18CFLAGS += "--sysroot=${STAGING_DIR_HOST}"
19CXXFLAGS += "--sysroot=${STAGING_DIR_HOST}"
20
21EXTRA_OEMAKE = " \
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-fslc-imx.inc b/recipes-security/optee-imx/optee-os-fslc-imx.inc
new file mode 100644
index 00000000..6b72e827
--- /dev/null
+++ b/recipes-security/optee-imx/optee-os-fslc-imx.inc
@@ -0,0 +1,26 @@
1require optee-os-fslc.inc
2
3SRC_URI = "git://github.com/nxp-imx/imx-optee-os.git;protocol=https;branch=${SRCBRANCH}"
4
5# The platform flavor corresponds to the Yocto machine without the leading 'i'.
6PLATFORM_FLAVOR = "${@d.getVar('MACHINE')[1:]}"
7PLATFORM_FLAVOR:imx6qdlsabresd = "mx6qsabresd"
8PLATFORM_FLAVOR:imx6qdlsabreauto = "mx6qsabreauto"
9PLATFORM_FLAVOR:imx6qpdlsolox = "mx6qsabresd"
10PLATFORM_FLAVOR:mx6ul-nxp-bsp = "mx6ulevk"
11PLATFORM_FLAVOR:mx6ull-nxp-bsp = "mx6ullevk"
12PLATFORM_FLAVOR:mx6ulz-nxp-bsp = "mx6ulzevk"
13PLATFORM_FLAVOR:mx8mq-nxp-bsp = "mx8mqevk"
14PLATFORM_FLAVOR:mx8mm-nxp-bsp = "mx8mmevk"
15PLATFORM_FLAVOR:mx8mn-nxp-bsp = "mx8mnevk"
16PLATFORM_FLAVOR:mx8mnul-nxp-bsp = "mx8mnevk"
17PLATFORM_FLAVOR:mx8mp-nxp-bsp = "mx8mpevk"
18PLATFORM_FLAVOR:mx8mpul-nxp-bsp = "mx8mpevk"
19PLATFORM_FLAVOR:mx8qm-nxp-bsp = "mx8qmmek"
20PLATFORM_FLAVOR:mx8qxp-nxp-bsp = "mx8qxpmek"
21PLATFORM_FLAVOR:mx8dx-nxp-bsp = "mx8dxmek"
22PLATFORM_FLAVOR:mx8dxl-nxp-bsp = "mx8dxlevk"
23PLATFORM_FLAVOR:mx8ulp-nxp-bsp = "mx8ulpevk"
24PLATFORM_FLAVOR:mx93-nxp-bsp = "mx93evk"
25
26COMPATIBLE_MACHINE = "(imx-nxp-bsp)"
diff --git a/recipes-security/optee-imx/optee-os-fslc.inc b/recipes-security/optee-imx/optee-os-fslc.inc
new file mode 100644
index 00000000..faa8c993
--- /dev/null
+++ b/recipes-security/optee-imx/optee-os-fslc.inc
@@ -0,0 +1,78 @@
1# Copyright (C) 2017-2021 NXP
2
3SUMMARY = "OPTEE OS"
4DESCRIPTION = "OPTEE OS"
5LICENSE = "BSD-2-Clause"
6LIC_FILES_CHKSUM = "file://LICENSE;md5=c1f21c4f72f372ef38a5a4aee55ec173"
7
8require optee-fslc.inc
9
10DEPENDS += "python3-pyelftools-native u-boot-mkimage-native"
11DEPENDS:append:toolchain-clang = " compiler-rt"
12
13inherit deploy autotools
14
15# Optee-os can be built for 32 bits and 64 bits at the same time
16# as long as the compilers are correctly defined.
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
20EXTRA_OEMAKE += " \
21 PLATFORM=imx-${PLATFORM_FLAVOR} \
22 CROSS_COMPILE=${HOST_PREFIX} \
23 CROSS_COMPILE64=${HOST_PREFIX} \
24 CFG_TEE_TA_LOG_LEVEL=0 \
25 CFG_TEE_CORE_LOG_LEVEL=0 \
26"
27
28LDFLAGS[unexport] = "1"
29CPPFLAGS[unexport] = "1"
30AS[unexport] = "1"
31LD[unexport] = "1"
32
33do_configure[noexec] = "1"
34
35do_compile:prepend() {
36 PLAT_LIBGCC_PATH=$(${CC} -print-libgcc-file-name)
37}
38
39do_compile:arm () {
40 oe_runmake all uTee
41}
42
43do_compile:aarch64 () {
44 oe_runmake all
45}
46do_compile[cleandirs] = "${B}"
47
48do_deploy () {
49 install -d ${DEPLOYDIR}
50 cp ${B}/core/tee-raw.bin ${DEPLOYDIR}/tee.${PLATFORM_FLAVOR}.bin
51 ln -sf tee.${PLATFORM_FLAVOR}.bin ${DEPLOYDIR}/tee.bin
52}
53
54do_deploy:append:arm () {
55 cp ${B}/core/uTee ${DEPLOYDIR}/uTee-${OPTEE_BIN_EXT}
56}
57
58do_install () {
59 install -d ${D}${nonarch_base_libdir}/firmware/
60 install -m 644 ${B}/core/*.bin ${D}${nonarch_base_libdir}/firmware/
61
62 # Install embedded TAs
63 install -d ${D}${nonarch_base_libdir}/optee_armtz/
64 install -m 444 ${B}/ta/*/*.ta ${D}${nonarch_base_libdir}/optee_armtz/
65
66 # Install the TA devkit
67 install -d ${D}${includedir}/optee/export-user_ta_${OPTEE_ARCH}/
68 cp -aR ${B}/export-ta_${OPTEE_ARCH}/* \
69 ${D}${includedir}/optee/export-user_ta_${OPTEE_ARCH}/
70}
71
72addtask deploy after do_compile before do_install
73
74FILES:${PN} = "${nonarch_base_libdir}/firmware/ ${nonarch_base_libdir}/optee_armtz/"
75FILES:${PN}-staticdev = "${includedir}/optee/"
76RDEPENDS:${PN}-dev += "${PN}-staticdev"
77
78PACKAGE_ARCH = "${MACHINE_ARCH}"
diff --git a/recipes-security/optee-imx/optee-os_3.19.0.imx.bb b/recipes-security/optee-imx/optee-os_3.19.0.imx.bb
index 82751a80..9059b538 100644
--- a/recipes-security/optee-imx/optee-os_3.19.0.imx.bb
+++ b/recipes-security/optee-imx/optee-os_3.19.0.imx.bb
@@ -1,125 +1,10 @@
1# Copyright (C) 2017-2021 NXP 1# Copyright (C) 2017-2021 NXP
2 2
3SUMMARY = "OPTEE OS" 3require optee-os-fslc-imx.inc
4DESCRIPTION = "OPTEE OS"
5HOMEPAGE = "http://www.optee.org/"
6LICENSE = "BSD-2-Clause"
7LIC_FILES_CHKSUM = "file://LICENSE;md5=c1f21c4f72f372ef38a5a4aee55ec173"
8 4
9DEPENDS = "python3-pyelftools-native u-boot-mkimage-native \ 5SRC_URI += "file://0001-core-Define-section-attributes-for-clang.patch \
10 python3-cryptography-native" 6 file://0006-allow-setting-sysroot-for-libgcc-lookup.patch \
11DEPENDS:append:toolchain-clang = " compiler-rt" 7 file://0007-allow-setting-sysroot-for-clang.patch \
12 8 file://0010-add-note-GNU-stack-section.patch"
13SRC_URI = "git://github.com/nxp-imx/imx-optee-os.git;protocol=https;branch=${SRCBRANCH} \
14 file://0001-core-Define-section-attributes-for-clang.patch \
15 file://0006-allow-setting-sysroot-for-libgcc-lookup.patch \
16 file://0007-allow-setting-sysroot-for-clang.patch \
17 file://0010-add-note-GNU-stack-section.patch"
18SRCBRANCH = "lf-5.15.71_2.2.0" 9SRCBRANCH = "lf-5.15.71_2.2.0"
19SRCREV = "00919403f040fad4f8603e605932281ff8451b1d" 10SRCREV = "00919403f040fad4f8603e605932281ff8451b1d"
20
21S = "${WORKDIR}/git"
22B = "${WORKDIR}/build"
23
24inherit deploy python3native autotools features_check
25
26REQUIRED_MACHINE_FEATURES = "optee"
27
28# The platform flavor corresponds to the Yocto machine without the leading 'i'.
29PLATFORM_FLAVOR = "${@d.getVar('MACHINE')[1:]}"
30PLATFORM_FLAVOR:imx6qdlsabresd = "mx6qsabresd"
31PLATFORM_FLAVOR:imx6qdlsabreauto = "mx6qsabreauto"
32PLATFORM_FLAVOR:imx6qpdlsolox = "mx6qsabresd"
33PLATFORM_FLAVOR:mx6ul-nxp-bsp = "mx6ulevk"
34PLATFORM_FLAVOR:mx6ull-nxp-bsp = "mx6ullevk"
35PLATFORM_FLAVOR:mx6ulz-nxp-bsp = "mx6ulzevk"
36PLATFORM_FLAVOR:mx8mq-nxp-bsp = "mx8mqevk"
37PLATFORM_FLAVOR:mx8mm-nxp-bsp = "mx8mmevk"
38PLATFORM_FLAVOR:mx8mn-nxp-bsp = "mx8mnevk"
39PLATFORM_FLAVOR:mx8mnul-nxp-bsp = "mx8mnevk"
40PLATFORM_FLAVOR:mx8mp-nxp-bsp = "mx8mpevk"
41PLATFORM_FLAVOR:mx8mpul-nxp-bsp = "mx8mpevk"
42PLATFORM_FLAVOR:mx8qm-nxp-bsp = "mx8qmmek"
43PLATFORM_FLAVOR:mx8qxp-nxp-bsp = "mx8qxpmek"
44PLATFORM_FLAVOR:mx8dx-nxp-bsp = "mx8dxmek"
45PLATFORM_FLAVOR:mx8dxl-nxp-bsp = "mx8dxlevk"
46PLATFORM_FLAVOR:mx8ulp-nxp-bsp = "mx8ulpevk"
47PLATFORM_FLAVOR:mx93-nxp-bsp = "mx93evk"
48
49OPTEE_ARCH:arm = "arm32"
50OPTEE_ARCH:aarch64 = "arm64"
51
52COMPILER ?= "gcc"
53COMPILER:toolchain-clang = "clang"
54
55# Optee-os can be built for 32 bits and 64 bits at the same time
56# as long as the compilers are correctly defined.
57# For 64bits, CROSS_COMPILE64 must be set
58# When defining CROSS_COMPILE and CROSS_COMPILE64, we assure that
59# any 32 or 64 bits builds will pass
60EXTRA_OEMAKE = " \
61 PLATFORM=imx-${PLATFORM_FLAVOR} \
62 CROSS_COMPILE=${HOST_PREFIX} \
63 CROSS_COMPILE64=${HOST_PREFIX} \
64 CFG_TEE_TA_LOG_LEVEL=0 \
65 CFG_TEE_CORE_LOG_LEVEL=0 \
66 OPENSSL_MODULES=${STAGING_LIBDIR_NATIVE}/ossl-modules \
67 COMPILER=${COMPILER} \
68 -C ${S} O=${B} \
69"
70
71LDFLAGS[unexport] = "1"
72CPPFLAGS[unexport] = "1"
73AS[unexport] = "1"
74LD[unexport] = "1"
75
76CFLAGS += "--sysroot=${STAGING_DIR_HOST}"
77CXXFLAGS += "--sysroot=${STAGING_DIR_HOST}"
78
79do_configure[noexec] = "1"
80
81do_compile:prepend() {
82 PLAT_LIBGCC_PATH=$(${CC} -print-libgcc-file-name)
83}
84
85do_compile:arm () {
86 oe_runmake all uTee
87}
88
89do_compile:aarch64 () {
90 oe_runmake all
91}
92do_compile[cleandirs] = "${B}"
93
94do_deploy () {
95 install -d ${DEPLOYDIR}
96 cp ${B}/core/tee-raw.bin ${DEPLOYDIR}/tee.${PLATFORM_FLAVOR}.bin
97 ln -sf tee.${PLATFORM_FLAVOR}.bin ${DEPLOYDIR}/tee.bin
98}
99
100do_deploy:append:arm () {
101 cp ${B}/core/uTee ${DEPLOYDIR}/uTee-${OPTEE_BIN_EXT}
102}
103
104do_install () {
105 install -d ${D}${nonarch_base_libdir}/firmware/
106 install -m 644 ${B}/core/*.bin ${D}${nonarch_base_libdir}/firmware/
107
108 # Install embedded TAs
109 install -d ${D}${nonarch_base_libdir}/optee_armtz/
110 install -m 444 ${B}/ta/*/*.ta ${D}${nonarch_base_libdir}/optee_armtz/
111
112 # Install the TA devkit
113 install -d ${D}${includedir}/optee/export-user_ta_${OPTEE_ARCH}/
114 cp -aR ${B}/export-ta_${OPTEE_ARCH}/* \
115 ${D}${includedir}/optee/export-user_ta_${OPTEE_ARCH}/
116}
117
118addtask deploy after do_compile before do_install
119
120FILES:${PN} = "${nonarch_base_libdir}/firmware/ ${nonarch_base_libdir}/optee_armtz/"
121FILES:${PN}-staticdev = "${includedir}/optee/"
122RDEPENDS:${PN}-dev += "${PN}-staticdev"
123
124PACKAGE_ARCH = "${MACHINE_ARCH}"
125COMPATIBLE_MACHINE = "(imx-nxp-bsp)"
diff --git a/recipes-security/optee-imx/optee-test-fslc.inc b/recipes-security/optee-imx/optee-test-fslc.inc
new file mode 100644
index 00000000..e0c133a7
--- /dev/null
+++ b/recipes-security/optee-imx/optee-test-fslc.inc
@@ -0,0 +1,38 @@
1# Copyright (C) 2017-2021 NXP
2
3SUMMARY = "OPTEE test"
4LICENSE = "BSD-2-Clause & GPL-2.0-only"
5LIC_FILES_CHKSUM = "file://LICENSE.md;md5=daa2bcccc666345ab8940aab1315a4fa"
6
7require optee-fslc.inc
8
9DEPENDS += "optee-os optee-client openssl"
10
11EXTRA_OEMAKE += " \
12 TA_DEV_KIT_DIR=${STAGING_INCDIR}/optee/export-user_ta_${OPTEE_ARCH}/ \
13 CROSS_COMPILE_HOST=${HOST_PREFIX} \
14 CROSS_COMPILE_TA=${HOST_PREFIX} \
15 CROSS_COMPILE=${HOST_PREFIX} \
16"
17
18do_compile() {
19 oe_runmake all
20}
21do_compile[cleandirs] = "${B}"
22
23do_install () {
24 install -d ${D}${bindir}
25 install ${B}/xtest/xtest ${D}${bindir}
26
27 install -d ${D}${nonarch_base_libdir}/optee_armtz
28 find ${B}/ta -name '*.ta' | while read name; do
29 install -m 444 $name ${D}${nonarch_base_libdir}/optee_armtz/
30 done
31
32 install -d ${D}${libdir}/tee-supplicant/plugins/
33 install ${B}/supp_plugin/*plugin ${D}${libdir}/tee-supplicant/plugins/
34}
35
36FILES:${PN} += "${nonarch_base_libdir}/optee_armtz/ ${libdir}/tee-supplicant/plugins/"
37
38RDEPENDS:${PN} = "optee-os"
diff --git a/recipes-security/optee-imx/optee-test_3.19.0.imx.bb b/recipes-security/optee-imx/optee-test_3.19.0.imx.bb
index a75b577c..9cc21efa 100644
--- a/recipes-security/optee-imx/optee-test_3.19.0.imx.bb
+++ b/recipes-security/optee-imx/optee-test_3.19.0.imx.bb
@@ -1,64 +1,10 @@
1# Copyright (C) 2017-2021 NXP 1# Copyright (C) 2017-2021 NXP
2 2
3SUMMARY = "OPTEE test" 3require optee-test-fslc.inc
4HOMEPAGE = "http://www.optee.org/"
5
6LICENSE = "BSD-2-Clause & GPL-2.0-only"
7LIC_FILES_CHKSUM = "file://LICENSE.md;md5=daa2bcccc666345ab8940aab1315a4fa"
8
9DEPENDS = "python3-cryptography-native optee-os optee-client openssl"
10 4
11SRC_URI = "git://github.com/nxp-imx/imx-optee-test.git;protocol=https;branch=${SRCBRANCH}" 5SRC_URI = "git://github.com/nxp-imx/imx-optee-test.git;protocol=https;branch=${SRCBRANCH}"
6
12SRCBRANCH = "lf-5.15.71_2.2.0" 7SRCBRANCH = "lf-5.15.71_2.2.0"
13SRCREV = "5c1dbb531b304f7ae100958f6261b6cefea49b62" 8SRCREV = "5c1dbb531b304f7ae100958f6261b6cefea49b62"
14 9
15S = "${WORKDIR}/git"
16B = "${WORKDIR}/build"
17
18inherit python3native features_check
19
20REQUIRED_MACHINE_FEATURES = "optee"
21
22OPTEE_ARCH:arm = "arm32"
23OPTEE_ARCH:aarch64 = "arm64"
24
25COMPILER ?= "gcc"
26COMPILER:toolchain-clang = "clang"
27
28CFLAGS += "--sysroot=${STAGING_DIR_HOST}"
29CXXFLAGS += "--sysroot=${STAGING_DIR_HOST}"
30
31EXTRA_OEMAKE = " \
32 TA_DEV_KIT_DIR=${STAGING_INCDIR}/optee/export-user_ta_${OPTEE_ARCH}/ \
33 OPTEE_CLIENT_EXPORT=${STAGING_DIR_HOST}${exec_prefix} \
34 CROSS_COMPILE_HOST=${HOST_PREFIX} \
35 CROSS_COMPILE_TA=${HOST_PREFIX} \
36 CROSS_COMPILE=${HOST_PREFIX} \
37 OPENSSL_MODULES=${STAGING_LIBDIR_NATIVE}/ossl-modules \
38 COMPILER=${COMPILER} \
39 -C ${S} O=${B} \
40"
41
42do_compile() {
43 oe_runmake all
44}
45do_compile[cleandirs] = "${B}"
46
47do_install () {
48 install -d ${D}${bindir}
49 install ${B}/xtest/xtest ${D}${bindir}
50
51 install -d ${D}${nonarch_base_libdir}/optee_armtz
52 find ${B}/ta -name '*.ta' | while read name; do
53 install -m 444 $name ${D}${nonarch_base_libdir}/optee_armtz/
54 done
55
56 install -d ${D}${libdir}/tee-supplicant/plugins/
57 install ${B}/supp_plugin/*plugin ${D}${libdir}/tee-supplicant/plugins/
58}
59
60FILES:${PN} += "${nonarch_base_libdir}/optee_armtz/ ${libdir}/tee-supplicant/plugins/"
61
62RDEPENDS:${PN} = "optee-os"
63
64COMPATIBLE_MACHINE = "(imx-nxp-bsp)" 10COMPATIBLE_MACHINE = "(imx-nxp-bsp)"