diff options
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.bb | 100 |
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 | |||
3 | SUMMARY = "OPTEE OS" | ||
4 | DESCRIPTION = "OPTEE OS" | ||
5 | HOMEPAGE = "http://www.optee.org/" | ||
6 | LICENSE = "BSD" | ||
7 | LIC_FILES_CHKSUM = "file://LICENSE;md5=c1f21c4f72f372ef38a5a4aee55ec173" | ||
8 | |||
9 | DEPENDS = "python3-pycrypto-native python3-pycryptodomex-native python3-pyelftools-native u-boot-mkimage-native" | ||
10 | |||
11 | SRCBRANCH = "imx_5.4.70_2.3.0" | ||
12 | |||
13 | SRC_URI = "\ | ||
14 | git://source.codeaurora.org/external/imx/imx-optee-os.git;protocol=https;branch=${SRCBRANCH} \ | ||
15 | " | ||
16 | |||
17 | SRCREV = "a991c90475bb1c715651e5fe27f7f32cbe61aef9" | ||
18 | |||
19 | S = "${WORKDIR}/git" | ||
20 | B = "${WORKDIR}/build.${PLATFORM_FLAVOR}" | ||
21 | |||
22 | inherit deploy python3native autotools | ||
23 | |||
24 | # The platform flavor corresponds to the Yocto machine without the leading 'i'. | ||
25 | PLATFORM_FLAVOR = "${@d.getVar('MACHINE')[1:]}" | ||
26 | PLATFORM_FLAVOR_imx6qpdlsolox = "mx6qsabresd" | ||
27 | PLATFORM_FLAVOR_imx6ul7d = "mx6ulevk" | ||
28 | PLATFORM_FLAVOR_imx6ull14x14evk = "mx6ullevk" | ||
29 | PLATFORM_FLAVOR_imx6ull9x9evk = "mx6ullevk" | ||
30 | PLATFORM_FLAVOR_imx6ulz-14x14-evk = "mx6ulzevk" | ||
31 | PLATFORM_FLAVOR_mx8mq = "mx8mqevk" | ||
32 | PLATFORM_FLAVOR_mx8mm = "mx8mmevk" | ||
33 | PLATFORM_FLAVOR_mx8mn = "mx8mnevk" | ||
34 | PLATFORM_FLAVOR_mx8mp = "mx8mpevk" | ||
35 | PLATFORM_FLAVOR_mx8qm = "mx8qmmek" | ||
36 | PLATFORM_FLAVOR_mx8qxp = "mx8qxpmek" | ||
37 | PLATFORM_FLAVOR_mx8dx = "mx8dxmek" | ||
38 | PLATFORM_FLAVOR_mx8dxl = "mx8dxlevk" | ||
39 | |||
40 | OPTEE_ARCH ?= "arm32" | ||
41 | OPTEE_ARCH_armv7a = "arm32" | ||
42 | OPTEE_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 | ||
49 | EXTRA_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 | |||
58 | do_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 | |||
65 | do_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 | |||
80 | do_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 | |||
92 | addtask deploy after do_compile before do_install | ||
93 | |||
94 | |||
95 | FILES_${PN} = "${nonarch_base_libdir}/firmware/" | ||
96 | FILES_${PN}-staticdev = "/usr/include/optee/" | ||
97 | RDEPENDS_${PN}-dev += "${PN}-staticdev" | ||
98 | |||
99 | PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
100 | COMPATIBLE_MACHINE = "(imx)" | ||