summaryrefslogtreecommitdiffstats
path: root/recipes-security/optee-imx/optee-os_3.10.0.imx.bb
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-security/optee-imx/optee-os_3.10.0.imx.bb')
-rw-r--r--recipes-security/optee-imx/optee-os_3.10.0.imx.bb100
1 files changed, 100 insertions, 0 deletions
diff --git a/recipes-security/optee-imx/optee-os_3.10.0.imx.bb b/recipes-security/optee-imx/optee-os_3.10.0.imx.bb
new file mode 100644
index 00000000..f9399496
--- /dev/null
+++ b/recipes-security/optee-imx/optee-os_3.10.0.imx.bb
@@ -0,0 +1,100 @@
1# Copyright (C) 2017-2020 NXP
2
3SUMMARY = "OPTEE OS"
4DESCRIPTION = "OPTEE OS"
5HOMEPAGE = "http://www.optee.org/"
6LICENSE = "BSD"
7LIC_FILES_CHKSUM = "file://LICENSE;md5=c1f21c4f72f372ef38a5a4aee55ec173"
8
9DEPENDS = "python3-pycrypto-native python3-pycryptodomex-native python3-pyelftools-native u-boot-mkimage-native"
10
11SRCBRANCH = "imx_5.4.70_2.3.0"
12
13SRC_URI = "\
14 git://source.codeaurora.org/external/imx/imx-optee-os.git;protocol=https;branch=${SRCBRANCH} \
15"
16
17SRCREV = "a991c90475bb1c715651e5fe27f7f32cbe61aef9"
18
19S = "${WORKDIR}/git"
20B = "${WORKDIR}/build.${PLATFORM_FLAVOR}"
21
22inherit deploy python3native autotools
23
24# The platform flavor corresponds to the Yocto machine without the leading 'i'.
25PLATFORM_FLAVOR = "${@d.getVar('MACHINE')[1:]}"
26PLATFORM_FLAVOR_imx6qpdlsolox = "mx6qsabresd"
27PLATFORM_FLAVOR_imx6ul7d = "mx6ulevk"
28PLATFORM_FLAVOR_imx6ull14x14evk = "mx6ullevk"
29PLATFORM_FLAVOR_imx6ull9x9evk = "mx6ullevk"
30PLATFORM_FLAVOR_imx6ulz-14x14-evk = "mx6ulzevk"
31PLATFORM_FLAVOR_mx8mq = "mx8mqevk"
32PLATFORM_FLAVOR_mx8mm = "mx8mmevk"
33PLATFORM_FLAVOR_mx8mn = "mx8mnevk"
34PLATFORM_FLAVOR_mx8mp = "mx8mpevk"
35PLATFORM_FLAVOR_mx8qm = "mx8qmmek"
36PLATFORM_FLAVOR_mx8qxp = "mx8qxpmek"
37PLATFORM_FLAVOR_mx8dx = "mx8dxmek"
38PLATFORM_FLAVOR_mx8dxl = "mx8dxlevk"
39
40OPTEE_ARCH ?= "arm32"
41OPTEE_ARCH_armv7a = "arm32"
42OPTEE_ARCH_aarch64 = "arm64"
43
44# Optee-os can be built for 32 bits and 64 bits at the same time
45# as long as the compilers are correctly defined.
46# For 64bits, CROSS_COMPILE64 must be set
47# When defining CROSS_COMPILE and CROSS_COMPILE64, we assure that
48# any 32 or 64 bits builds will pass
49EXTRA_OEMAKE = " \
50 PLATFORM=imx \
51 PLATFORM_FLAVOR=${PLATFORM_FLAVOR} \
52 CROSS_COMPILE=${HOST_PREFIX} \
53 CROSS_COMPILE64=${HOST_PREFIX} \
54 LDFLAGS= \
55 O=${B} \
56"
57
58do_compile () {
59 unset LDFLAGS
60 export CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_HOST}"
61 oe_runmake -C ${S} all CFG_TEE_TA_LOG_LEVEL=0 CFG_TEE_CORE_LOG_LEVEL=0
62}
63
64
65do_deploy () {
66 install -d ${DEPLOYDIR}
67 ${TARGET_PREFIX}objcopy -O binary ${B}/core/tee.elf ${DEPLOYDIR}/tee.${PLATFORM_FLAVOR}.bin
68
69 if [ "${OPTEE_ARCH}" != "arm64" ]; then
70 IMX_LOAD_ADDR=`${TARGET_PREFIX}readelf -h ${B}/core/tee.elf | grep "Entry point address" | awk '{print $4}'`
71 uboot-mkimage -A arm -O linux -C none -a ${IMX_LOAD_ADDR} -e ${IMX_LOAD_ADDR} \
72 -d ${DEPLOYDIR}/tee.${PLATFORM_FLAVOR}.bin ${DEPLOYDIR}/uTee-${OPTEE_BIN_EXT}
73 fi
74
75 cd ${DEPLOYDIR}
76 ln -sf tee.${PLATFORM_FLAVOR}.bin tee.bin
77 cd -
78}
79
80do_install () {
81 install -d ${D}${nonarch_base_libdir}/firmware/
82 install -m 644 ${B}/core/*.bin ${D}${nonarch_base_libdir}/firmware/
83
84 # Install the TA devkit
85 install -d ${D}/usr/include/optee/export-user_ta_${OPTEE_ARCH}/
86
87 for f in ${B}/export-ta_${OPTEE_ARCH}/*; do
88 cp -aR $f ${D}/usr/include/optee/export-user_ta_${OPTEE_ARCH}/
89 done
90}
91
92addtask deploy after do_compile before do_install
93
94
95FILES_${PN} = "${nonarch_base_libdir}/firmware/"
96FILES_${PN}-staticdev = "/usr/include/optee/"
97RDEPENDS_${PN}-dev += "${PN}-staticdev"
98
99PACKAGE_ARCH = "${MACHINE_ARCH}"
100COMPATIBLE_MACHINE = "(imx)"