From 1220b505bc454643b1d7e7d812669beb9afc8dc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20Stehl=C3=A9?= Date: Tue, 7 Jan 2025 15:21:09 +0100 Subject: [PATCH] boot/uboot: add support for embedded TEE in binary format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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é Cc: Christoph Muellner Signed-off-by: Julien Olivain --- boot/uboot/Config.in | 26 +++++++++++++++++++++++++- boot/uboot/uboot.mk | 4 ++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/boot/uboot/Config.in b/boot/uboot/Config.in index 8648d6eb7e..f6823d537b 100644 --- a/boot/uboot/Config.in +++ b/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" diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk index d8faef648f..b3094029e7 100644 --- a/boot/uboot/uboot.mk +++ b/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