diff options
-rw-r--r-- | recipes-security/optee-imx/optee-os_3.2.0.imx.bb | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/recipes-security/optee-imx/optee-os_3.2.0.imx.bb b/recipes-security/optee-imx/optee-os_3.2.0.imx.bb new file mode 100644 index 00000000..594aec35 --- /dev/null +++ b/recipes-security/optee-imx/optee-os_3.2.0.imx.bb | |||
@@ -0,0 +1,92 @@ | |||
1 | # Copyright (C) 2017-2018 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=69663ab153298557a59c67a60a743e5b" | ||
8 | |||
9 | inherit deploy pythonnative autotools | ||
10 | DEPENDS = "python-pycrypto-native u-boot-mkimage-native" | ||
11 | |||
12 | SRCBRANCH = "imx_4.14.78_1.0.0_ga" | ||
13 | OPTEE_OS_SRC ?= "git://source.codeaurora.org/external/imx/imx-optee-os.git;protocol=https" | ||
14 | SRC_URI = "${OPTEE_OS_SRC};branch=${SRCBRANCH}" | ||
15 | SRCREV = "6a52487eb0ff664e4ebbd48497f0d3322844d51d" | ||
16 | |||
17 | S = "${WORKDIR}/git" | ||
18 | B = "${WORKDIR}/build.${PLATFORM_FLAVOR}" | ||
19 | |||
20 | # The platform flavor corresponds to the Yocto machine without the leading 'i'. | ||
21 | PLATFORM_FLAVOR = "${@d.getVar('MACHINE')[1:]}" | ||
22 | PLATFORM_FLAVOR_imx6qpdlsolox = "mx6qsabresd" | ||
23 | PLATFORM_FLAVOR_imx6ul7d = "mx6ulevk" | ||
24 | PLATFORM_FLAVOR_imx6ull14x14evk = "mx6ullevk" | ||
25 | PLATFORM_FLAVOR_imx6ull9x9evk = "mx6ullevk" | ||
26 | PLATFORM_FLAVOR_imx6ulz14x14evk = "mx6ullevk" | ||
27 | PLATFORM_FLAVOR_mx8mm = "mx8mmevk" | ||
28 | |||
29 | OPTEE_ARCH ?= "arm32" | ||
30 | OPTEE_ARCH_armv7a = "arm32" | ||
31 | OPTEE_ARCH_aarch64 = "arm64" | ||
32 | |||
33 | # Optee-os can be built for 32 bits and 64 bits at the same time | ||
34 | # as long as the compilers are correctly defined. | ||
35 | # For 64bits, CROSS_COMPILE64 must be set | ||
36 | # When defining CROSS_COMPILE and CROSS_COMPILE64, we assure that | ||
37 | # any 32 or 64 bits builds will pass | ||
38 | EXTRA_OEMAKE = "PLATFORM=imx PLATFORM_FLAVOR=${PLATFORM_FLAVOR} \ | ||
39 | CROSS_COMPILE=${HOST_PREFIX} \ | ||
40 | CROSS_COMPILE64=${HOST_PREFIX} \ | ||
41 | NOWERROR=1 \ | ||
42 | LDFLAGS= \ | ||
43 | O=${B} \ | ||
44 | CFG_SECURE_DATA_PATH=y \ | ||
45 | CFG_TEE_SDP_MEM_BASE=0xCC000000 \ | ||
46 | CFG_TEE_SDP_MEM_SIZE=0x02000000 \ | ||
47 | CFG_TEE_SDP_NONCACHE=y \ | ||
48 | " | ||
49 | |||
50 | |||
51 | do_compile () { | ||
52 | unset LDFLAGS | ||
53 | export CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_HOST}" | ||
54 | oe_runmake -C ${S} all CFG_TEE_TA_LOG_LEVEL=0 | ||
55 | } | ||
56 | |||
57 | |||
58 | do_deploy () { | ||
59 | install -d ${DEPLOYDIR} | ||
60 | ${TARGET_PREFIX}objcopy -O binary ${B}/core/tee.elf ${DEPLOYDIR}/tee.${PLATFORM_FLAVOR}.bin | ||
61 | |||
62 | if [ "${OPTEE_ARCH}" != "arm64" ]; then | ||
63 | IMX_LOAD_ADDR=`cat ${B}/core/tee-init_load_addr.txt` && \ | ||
64 | uboot-mkimage -A arm -O linux -C none -a ${IMX_LOAD_ADDR} -e ${IMX_LOAD_ADDR} \ | ||
65 | -d ${DEPLOYDIR}/tee.${PLATFORM_FLAVOR}.bin ${DEPLOYDIR}/uTee-${OPTEE_BIN_EXT} | ||
66 | fi | ||
67 | |||
68 | cd ${DEPLOYDIR} | ||
69 | ln -sf tee.${PLATFORM_FLAVOR}.bin tee.bin | ||
70 | cd - | ||
71 | } | ||
72 | |||
73 | do_install () { | ||
74 | install -d ${D}/lib/firmware/ | ||
75 | install -m 644 ${B}/core/*.bin ${D}/lib/firmware/ | ||
76 | |||
77 | # Install the TA devkit | ||
78 | install -d ${D}/usr/include/optee/export-user_ta_${OPTEE_ARCH}/ | ||
79 | |||
80 | for f in ${B}/export-ta_${OPTEE_ARCH}/*; do | ||
81 | cp -aR $f ${D}/usr/include/optee/export-user_ta_${OPTEE_ARCH}/ | ||
82 | done | ||
83 | } | ||
84 | |||
85 | addtask deploy after do_compile before do_install | ||
86 | |||
87 | |||
88 | FILES_${PN} = "${nonarch_base_libdir}/firmware/" | ||
89 | FILES_${PN}-staticdev = "/usr/include/optee/" | ||
90 | RDEPENDS_${PN}-dev += "${PN}-staticdev" | ||
91 | |||
92 | PACKAGE_ARCH = "${MACHINE_ARCH}" | ||