boot/uboot: add support for embedded TEE in binary format
PATCH 1/1 boot/uboot: add support for embedded TEE in binary format
We can embed a TEE in ELF format into U-Boot, but versions of OP-TEE since 3.8.0 must be embedded in binary format, as the tee.bin contains important meta-data. [1]
Update the configuration menu and the Makefile to allow selecting to embed either tee.elf or tee.bin.
By default, embed the TEE in ELF format to stay compatible with existing configurations.
[1] https://github.com/OP-TEE/optee_os/issues/4542
---
Hi,
This patch is useful when embedding OP-TEE in U-Boot, where we should use the TEE in binary format with OP-TEE versions >= 3.8.0.
To try on ROCKPro64, start from rockpro64_defconfig, then add:
BR2_TARGET_OPTEE_OS=y
BR2_TARGET_OPTEE_OS_NEEDS_DTC=y
BR2_TARGET_OPTEE_OS_PLATFORM="rockchip-rk3399"
BR2_TARGET_UBOOT_NEEDS_OPTEE_TEE=y
BR2_TARGET_UBOOT_NEEDS_OPTEE_TEE_BIN=y
Finally, add a U-Boot config fragment with:
CONFIG_TEE=yCONFIG_OPTEE_LIB=yCONFIG_OPTEE_TZDRAM_SIZE=0x02000000
The following message will be printed during boot:
## Checking hash(es) for Image tee-1 ... sha256+ OK
Then the system will boot.
Just in case, I could also verify that adding this patch does not break the build for the following defconfigs, which have OP-TEE and U-Boot:
arm_fvp_ebbr
beagleboneai64
beagleplayqemu_aarch64_ebbrqemu_arm_ebbrqemu_arm_vexpress_tzti_am62ax_skti_am62px_skti_am62x_skti_am64x_sk
Best regards, and happy new year!
Vincent.
boot/uboot/Config.in | 26 +++++++++++++++++++++++++- boot/uboot/uboot.mk | 4 ++++ 2 files changed, 29 insertions(+), 1 deletion(-)
boot/uboot/Config.in +25 -1
@@ -274,7 +274,31 @@ config BR2_TARGET_UBOOT_NEEDS_OPTEE_TEE Some platforms (such as Rockchip) encapsulate the TEE inside U-Boot. This option makes sure optee-os gets built prior to U-Boot, and that the TEE variable pointing to OPTEE's - tee.elf, is passed during the Buildroot build. + core file, is passed during the Buildroot build. + +choice + prompt "U-Boot OPTEE TEE format" + default BR2_TARGET_UBOOT_NEEDS_OPTEE_TEE_ELF + depends on BR2_TARGET_UBOOT_NEEDS_OPTEE_TEE + help + Select the TEE format. + You may select the TEE in ELF format only for OP-TEE + versions before 3.8.0. + Since this version, the TEE in binary format must be used as + it contains important meta-data. + +config BR2_TARGET_UBOOT_NEEDS_OPTEE_TEE_ELF + bool "tee.elf" + help + ELF format may be used only for OP-TEE versions before + 3.8.0. + +config BR2_TARGET_UBOOT_NEEDS_OPTEE_TEE_BIN + bool "tee.bin" + help + Binary format must be used for OP-TEE versions since 3.8.0. + +endchoice config BR2_TARGET_UBOOT_NEEDS_OPENSBI bool "U-Boot needs OpenSBI"
boot/uboot/uboot.mk +4 -0
@@ -196,7 +196,11 @@ endif ifeq ($(BR2_TARGET_UBOOT_NEEDS_OPTEE_TEE),y) UBOOT_DEPENDENCIES += optee-os +ifeq ($(BR2_TARGET_UBOOT_NEEDS_OPTEE_TEE_ELF),y) UBOOT_MAKE_OPTS += TEE=$(BINARIES_DIR)/tee.elf +else ifeq ($(BR2_TARGET_UBOOT_NEEDS_OPTEE_TEE_BIN),y) +UBOOT_MAKE_OPTS += TEE=$(BINARIES_DIR)/tee.bin +endif endif # TI K3 devices needs at least ti-sysfw (System Firmware) provided
Signature · 6 lines
2.45.2 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 7 lines · Vincent Stehlé
We can embed a TEE in ELF format into U-Boot, but versions of OP-TEE since 3.8.0 must be embedded in binary format, as the tee.bin contains important meta-data. [1]
Update the configuration menu and the
Makefileto allow selecting to embed either tee.elf or tee.bin.
Quoted 7 lines
By default, embed the TEE in ELF format to stay compatible with existing configurations.
[1] https://github.com/OP-TEE/optee_os/issues/4542
Signed-off-by Vincent Stehlé <[email protected]>Cc Christoph Muellner <[email protected]>
Applied to master, thanks.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot