]> code.ossystems Code Review - meta-freescale.git/commitdiff
optee: Add support for optee imx fork to imx8mqevk
authorPeter Griffin <peter.griffin@linaro.org>
Fri, 25 Oct 2019 09:04:01 +0000 (11:04 +0200)
committerOtavio Salvador <otavio@ossystems.com.br>
Fri, 8 Nov 2019 18:31:25 +0000 (15:31 -0300)
optee imx fork like most other imx forked components is
more fully featured for imx devices and supports things
like CAAM accleration.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
conf/machine/include/imx-base.inc
recipes-bsp/imx-atf/imx-atf_2.0.bb
recipes-bsp/imx-mkimage/imx-boot_0.2.bb

index 7e5437d3d2d0a2db22b3e4f7cd536267eee18be5..459b98d4c793de6d628fa8014e1729de1df6f337 100644 (file)
@@ -266,6 +266,11 @@ PREFERRED_VERSION_libdrm_mx6 ?= "2.4.91.imx"
 PREFERRED_VERSION_libdrm_mx7 ?= "2.4.91.imx"
 PREFERRED_VERSION_libdrm_mx8 ?= "2.4.91.imx"
 
+# Use i.MX optee Version
+PREFERRED_VERSION_optee-os_mx8     ?= "3.2.0.imx"
+PREFERRED_VERSION_optee-client_mx8 ?= "3.2.0.imx"
+PREFERRED_VERSION_optee-test_mx8   ?= "3.2.0.imx"
+
 # Handle default kernel
 IMX_DEFAULT_KERNEL = "linux-imx"
 IMX_DEFAULT_KERNEL_mxs = "linux-fslc"
@@ -287,19 +292,29 @@ SOC_DEFAULT_IMAGE_FSTYPES_mxs = "uboot-mxsboot-sdcard wic.gz"
 # Do not update fstab file when using wic images
 WIC_CREATE_EXTRA_ARGS ?= "--no-fstab-update"
 
+OPTEE_BOOT_IMAGE         = "uTee"
+OPTEE_BOOT_IMAGE_aarch64 = ""
+
+SDCARD_ROOTFS ?= "${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.ext4"
+
 IMAGE_FSTYPES ?= "${SOC_DEFAULT_IMAGE_FSTYPES}"
 
 IMAGE_BOOT_FILES ?= " \
     ${KERNEL_IMAGETYPE} \
     ${@make_dtb_boot_files(d)} \
+    ${@bb.utils.contains('MACHINE_FEATURES', 'optee', '${OPTEE_BOOT_IMAGE}', '', d)} \
 "
 
 ### wic default support
+OPTEE_WKS_FILE_DEPENDS         = "optee-os"
+OPTEE_WKS_FILE_DEPENDS_aarch64 = ""
+
 WKS_FILE_DEPENDS ?= " \
     virtual/bootloader \
     \
     e2fsprogs-native \
     bmap-tools-native \
+    ${@bb.utils.contains('MACHINE_FEATURES', 'optee', '${OPTEE_WKS_FILE_DEPENDS}', '', d)} \
 "
 
 WKS_FILE_DEPENDS_mx8 += "imx-boot"
index 6a1ed74d0ef98b2e255e66343710394660d95169..15122520f34e8756abdc3117d1ac2b4f14b762e1 100644 (file)
@@ -30,16 +30,25 @@ EXTRA_OEMAKE += " \
     PLAT=${PLATFORM} \
 "
 
+BUILD_OPTEE = "${@bb.utils.contains('MACHINE_FEATURES', 'optee', 'true', 'false', d)}"
+
 do_compile() {
     # Clear LDFLAGS to avoid the option -Wl recognize issue
     unset LDFLAGS
     oe_runmake bl31
+    if ${BUILD_OPTEE}; then
+       oe_runmake clean BUILD_BASE=build-optee
+       oe_runmake BUILD_BASE=build-optee SPD=opteed bl31
+    fi
 }
 
 do_install[noexec] = "1"
 
 do_deploy() {
     install -Dm 0644 ${S}/build/${PLATFORM}/release/bl31.bin ${DEPLOYDIR}/${BOOT_TOOLS}/bl31-${PLATFORM}.bin
+    if ${BUILD_OPTEE}; then
+       install -m 0644 ${S}/build-optee/${PLATFORM}/release/bl31.bin ${DEPLOYDIR}/${BOOT_TOOLS}/bl31-${PLATFORM}.bin-optee
+    fi
 }
 addtask deploy after do_compile
 
index 04e8b11e0c51432ce53332839cb8d9e5ae6f94a0..7518c91119911baf629e524dfd02552e15f9a255 100644 (file)
@@ -14,6 +14,7 @@ DEPENDS += " \
     firmware-imx \
     ${IMX_EXTRA_FIRMWARE} \
     imx-atf \
+    ${@bb.utils.contains('MACHINE_FEATURES', 'optee', 'optee-os', '', d)} \
 "
 DEPENDS_append_mx8m = " dtc-native"
 BOOT_NAME = "imx-boot"
@@ -30,6 +31,7 @@ do_compile[depends] += " \
     virtual/bootloader:do_deploy \
     ${@' '.join('%s:do_deploy' % r for r in '${IMX_EXTRA_FIRMWARE}'.split() )} \
     imx-atf:do_deploy \
+    ${@bb.utils.contains('MACHINE_FEATURES', 'optee', 'optee-os:do_deploy', '', d)} \
 "
 
 SC_FIRMWARE_NAME ?= "scfw_tcm.bin"
@@ -39,7 +41,7 @@ ATF_MACHINE_NAME_mx8qm = "bl31-imx8qm.bin"
 ATF_MACHINE_NAME_mx8qxp = "bl31-imx8qx.bin"
 ATF_MACHINE_NAME_mx8mq = "bl31-imx8mq.bin"
 ATF_MACHINE_NAME_mx8mm = "bl31-imx8mm.bin"
-ATF_MACHINE_NAME_append = "${@bb.utils.contains('COMBINED_FEATURES', 'optee', '-optee', '', d)}"
+ATF_MACHINE_NAME_append = "${@bb.utils.contains('MACHINE_FEATURES', 'optee', '-optee', '', d)}"
 
 UBOOT_NAME = "u-boot-${MACHINE}.bin-${UBOOT_CONFIG}"
 BOOT_CONFIG_MACHINE = "${BOOT_NAME}-${MACHINE}-${UBOOT_CONFIG}.bin"
@@ -52,6 +54,8 @@ SOC_TARGET_mx8qxp = "iMX8QX"
 SOC_TARGET_mx8mq  = "iMX8M"
 SOC_TARGET_mx8mm  = "iMX8MM"
 
+DEPLOY_OPTEE = "${@bb.utils.contains('MACHINE_FEATURES', 'optee', 'true', 'false', d)}"
+
 IMXBOOT_TARGETS ?= \
     "${@bb.utils.contains('UBOOT_CONFIG', 'fspi', 'flash_flexspi', \
         bb.utils.contains('UBOOT_CONFIG', 'nand', 'flash_nand', \
@@ -99,6 +103,9 @@ compile_mx8x() {
 do_compile() {
     compile_${SOC_FAMILY}
     # mkimage for i.MX8
+    if ${DEPLOY_OPTEE}; then
+        cp ${DEPLOY_DIR_IMAGE}/tee.bin ${BOOT_STAGING}
+    fi
     for target in ${IMXBOOT_TARGETS}; do
         bbnote "building ${SOC_TARGET} - ${target}"
         make SOC=${SOC_TARGET} dtbs=${UBOOT_DTB_NAME} ${target}
@@ -141,6 +148,12 @@ do_deploy() {
     deploy_${SOC_FAMILY}
     # copy the tool mkimage to deploy path and sc fw, dcd and uboot
     install -m 0644 ${DEPLOY_DIR_IMAGE}/${UBOOT_NAME}        ${DEPLOYDIR}/${BOOT_TOOLS}
+
+    # copy tee.bin to deploy path
+    if ${DEPLOY_OPTEE}; then
+       install -m 0644 ${DEPLOY_DIR_IMAGE}/tee.bin ${DEPLOYDIR}/${BOOT_TOOLS}
+    fi
+
     # copy makefile (soc.mak) for reference
     install -m 0644 ${BOOT_STAGING}/soc.mak                  ${DEPLOYDIR}/${BOOT_TOOLS}
     # copy the generated boot image to deploy path