Browse Source

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

Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
Cc: Christoph Muellner <christoph.muellner@theobroma-systems.com>
Signed-off-by: Julien Olivain <ju.o@free.fr>
Vincent Stehlé 6 months ago
parent
commit
1220b505bc
2 changed files with 29 additions and 1 deletions
  1. 25 1
      boot/uboot/Config.in
  2. 4 0
      boot/uboot/uboot.mk

+ 25 - 1
boot/uboot/Config.in

@@ -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"

+ 4 - 0
boot/uboot/uboot.mk

@@ -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