Skip to contentSkip to conversation

boot/optee-os: package sets TA SDK location

PATCH New Etienne Carriere 2 participants 14 messages Mar 1, 2019 – Aug 9, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/9 boot/optee-os: package sets TA SDK location

Makefile script for boot package optee-os produces make variable OPTEE_OS_STAGING_SDK to locate the Trusted Application SDK expected by other packages when building OP-TEE trusted applications.

---
 boot/optee-os/optee-os.mk | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
boot/optee-os/optee-os.mk +4 -2
index aeac067..df481c9 100644
@@ -55,9 +55,11 @@ OPTEE_OS_MAKE_OPTS += $(call qstrip,$(BR2_TARGET_OPTEE_OS_ADDITIONAL_VARIABLES))
 OPTEE_OS_BUILDDIR_OUT = out
 ifeq ($(BR2_aarch64),y)
 OPTEE_OS_LOCAL_SDK = $(OPTEE_OS_BUILDDIR_OUT)/export-ta_arm64
+OPTEE_OS_STAGING_SDK = $(STAGING_DIR)/lib/optee/export-ta_arm64
 endif
 ifeq ($(BR2_arm),y)
 OPTEE_OS_LOCAL_SDK = $(OPTEE_OS_BUILDDIR_OUT)/export-ta_arm32
+OPTEE_OS_STAGING_SDK = $(STAGING_DIR)/lib/optee/export-ta_arm32
 endif
 
 ifeq ($(BR2_TARGET_OPTEE_OS_CORE),y)
@@ -86,8 +88,8 @@ define OPTEE_OS_BUILD_SDK
 		 $(TARGET_CONFIGURE_OPTS) $(OPTEE_OS_MAKE_OPTS) ta_dev_kit
 endef
 define OPTEE_OS_INSTALL_STAGING_CMDS
-	mkdir -p $(STAGING_DIR)/lib/optee
-	cp -ardpf $(@D)/$(OPTEE_OS_LOCAL_SDK) $(STAGING_DIR)/lib/optee
+	mkdir -p $(OPTEE_OS_STAGING_SDK)
+	cp -ardpf $(@D)/$(OPTEE_OS_LOCAL_SDK)/* $(OPTEE_OS_STAGING_SDK)
 endef
 endif # BR2_TARGET_OPTEE_OS_SDK
 
Signature · 1 line
1.9.1
#1 lore raw

PATCH 2/9 package/optee-test: locate TA SDK though optee-os package

Package optee-os was recently changed to produce variable OPTEE_OS_STAGING_SDK to other packages to locate the OP-TEE Trusted Application SDK generated from optee-os package and installed in the Buildroot output staging directory.

---
 package/optee-test/optee-test.mk | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
package/optee-test/optee-test.mk +2 -7
index 1ab6bf4..687347d 100644
@@ -11,12 +11,7 @@ OPTEE_TEST_LICENSE_FILES = LICENSE.md
 
 OPTEE_TEST_DEPENDENCIES = optee-client optee-os
 
-ifeq ($(BR2_aarch64),y)
-OPTEE_TEST_SDK = $(STAGING_DIR)/lib/optee/export-ta_arm64
-else ifeq ($(BR2_arm),y)
-OPTEE_TEST_SDK = $(STAGING_DIR)/lib/optee/export-ta_arm32
-endif
-OPTEE_TEST_CONF_OPTS = -DOPTEE_TEST_SDK=$(OPTEE_TEST_SDK)
+OPTEE_TEST_CONF_OPTS = -DOPTEE_TEST_SDK=$(OPTEE_OS_STAGING_SDK)
 
 # Trusted Application are not built from CMake due to ta_dev_kit
 # dependencies. We must build and install them on target.
@@ -24,7 +19,7 @@ define OPTEE_TEST_BUILD_TAS
 	$(foreach f,$(wildcard $(@D)/ta/*/Makefile), \
 		$(TARGET_CONFIGURE_OPTS) \
 		$(MAKE) CROSS_COMPILE=$(TARGET_CROSS) \
-			TA_DEV_KIT_DIR=$(OPTEE_TEST_SDK) \
+			TA_DEV_KIT_DIR=$(OPTEE_OS_STAGING_SDK) \
 			-C $(dir $f) all
 	)
 endef
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/9 package/optee-test: locate TA SDK though optee-os package

Quoted 9 lines · On Fri, 1 Mar 2019 17:47:06 +0100 Etienne Carriere…

Package optee-os was recently changed to produce variable OPTEE_OS_STAGING_SDK to other packages to locate the OP-TEE Trusted Application SDK generated from optee-os package and installed in the Buildroot output staging directory.

---
 package/optee-test/optee-test.mk | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

Applied to master, after adjusting the commit log and the variable name. Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#3 lore raw

PATCH 3/9 package/optee-examples: locate TA SDK though optee-os package

In reply to Etienne Carriere

Package optee-os was recently changed to produce variable OPTEE_OS_STAGING_SDK to other packages to locate the OP-TEE Trusted Application SDK generated from optee-os package and installed in the Buildroot output staging directory.

---
 package/optee-examples/optee-examples.mk | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
package/optee-examples/optee-examples.mk +1 -7
index 10fe62b..1f5548d 100644
@@ -11,19 +11,13 @@ OPTEE_EXAMPLES_LICENSE_FILES = LICENSE
 
 OPTEE_EXAMPLES_DEPENDENCIES = optee-client optee-os
 
-ifeq ($(BR2_aarch64),y)
-OPTEE_EXAMPLES_SDK = $(STAGING_DIR)/lib/optee/export-ta_arm64
-else ifeq ($(BR2_arm),y)
-OPTEE_EXAMPLES_SDK = $(STAGING_DIR)/lib/optee/export-ta_arm32
-endif
-
 # Trusted Application are not built from CMake due to ta_dev_kit dependencies.
 # We must build and install them on target.
 define OPTEE_EXAMPLES_BUILD_TAS
 	$(foreach f,$(wildcard $(@D)/*/ta/Makefile), \
 		$(TARGET_CONFIGURE_OPTS) \
 		$(MAKE) CROSS_COMPILE=$(TARGET_CROSS) \
-			TA_DEV_KIT_DIR=$(OPTEE_EXAMPLES_SDK) \
+			TA_DEV_KIT_DIR=$(OPTEE_OS_STAGING_SDK) \
 			O=out -C $(dir $f) all
 	)
 endef
Signature · 1 line
1.9.1
#4 lore raw

PATCH 3/9 package/optee-examples: locate TA SDK though optee-os package

Quoted 9 lines · On Fri, 1 Mar 2019 17:47:07 +0100 Etienne Carriere…

Package optee-os was recently changed to produce variable OPTEE_OS_STAGING_SDK to other packages to locate the OP-TEE Trusted Application SDK generated from optee-os package and installed in the Buildroot output staging directory.

---
 package/optee-examples/optee-examples.mk | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

Applied to master after adjusting the variable name and commit log. Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#5 lore raw

PATCH 4/9 package/optee-client: fix build warnings 3.4.0

In reply to Etienne Carriere

And a patch for optee-client package currently synced with tag 3.4.0 which contains source issues to be fixed.

---
 .../0001-libteec-fix-build-warnings.patch          | 65 ++++++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644 package/optee-client/0001-libteec-fix-build-warnings.patch
package/optee-client/0001-libteec-fix-build-warnings.patch new file +65 -0
new file mode 100644
index 0000000..21f47ec
@@ -0,0 +1,65 @@
+From 657414ccd20b4fb2985efd83b0679964fec923c2 Mon Sep 17 00:00:00 2001
+From: Etienne Carriere <[email protected]>
+Date: Fri, 1 Mar 2019 09:36:46 +0100
+Subject: [PATCH] libteec: fix build warnings
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Fix build warnings reported by the Buildroot team [1]:
+
+/home/thomas/projets/outputs/armv5-ctng-linux-gnueabi/build/optee-client-3.4.0/libteec/src/tee_client_api.c: In function 'TEEC_InitializeContext':
+/home/thomas/projets/outputs/armv5-ctng-linux-gnueabi/build/optee-client-3.4.0/libteec/src/tee_client_api.c:149:28: error: 'gen_caps' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+    ctx->reg_mem = gen_caps & TEE_GEN_CAP_REG_MEM;
+                            ^
+/home/thomas/projets/buildroot/output/build/optee-client-3.4.0/libteec/src/tee_client_api.c: In function ?TEEC_OpenSession?:
+/home/thomas/projets/buildroot/output/build/optee-client-3.4.0/libteec/src/tee_client_api.c:507:8: error: cast increases required alignment of target type [-Werror=cast-align]
+  arg = (struct tee_ioctl_open_session_arg *)buf;
+        ^
+/home/thomas/projets/buildroot/output/build/optee-client-3.4.0/libteec/src/tee_client_api.c: In function ?TEEC_InvokeCommand?:
+/home/thomas/projets/buildroot/output/build/optee-client-3.4.0/libteec/src/tee_client_api.c:581:8: error: cast increases required alignment of target type [-Werror=cast-align]
+  arg = (struct tee_ioctl_invoke_arg *)buf;
+        ^
+
+[1] http://lists.busybox.net/pipermail/buildroot/2019-February/243437.html
+
+Reported-by: Thomas Petazzoni <[email protected]>
+Signed-off-by: Etienne Carriere <[email protected]>
+---
+ libteec/src/tee_client_api.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/libteec/src/tee_client_api.c b/libteec/src/tee_client_api.c
+index 698092b..a8683fd 100644
+--- a/libteec/src/tee_client_api.c
++++ b/libteec/src/tee_client_api.c
+@@ -140,7 +140,7 @@ TEEC_Result TEEC_InitializeContext(const char *name, TEEC_Context *ctx)
+ 		return TEEC_ERROR_BAD_PARAMETERS;
+ 
+ 	for (n = 0; n < TEEC_MAX_DEV_SEQ; n++) {
+-		uint32_t gen_caps;
++		uint32_t gen_caps = 0;
+ 
+ 		snprintf(devname, sizeof(devname), "/dev/tee%zu", n);
+ 		fd = teec_open_dev(devname, name, &gen_caps);
+@@ -504,7 +504,7 @@ TEEC_Result TEEC_OpenSession(TEEC_Context *ctx, TEEC_Session *session,
+ 	buf_data.buf_ptr = (uintptr_t)buf;
+ 	buf_data.buf_len = sizeof(buf);
+ 
+-	arg = (struct tee_ioctl_open_session_arg *)buf;
++	arg = (struct tee_ioctl_open_session_arg *)(void *)buf;
+ 	arg->num_params = TEEC_CONFIG_PAYLOAD_REF_COUNT;
+ 	params = (struct tee_ioctl_param *)(arg + 1);
+ 
+@@ -578,7 +578,7 @@ TEEC_Result TEEC_InvokeCommand(TEEC_Session *session, uint32_t cmd_id,
+ 	buf_data.buf_ptr = (uintptr_t)buf;
+ 	buf_data.buf_len = sizeof(buf);
+ 
+-	arg = (struct tee_ioctl_invoke_arg *)buf;
++	arg = (struct tee_ioctl_invoke_arg *)(void *)buf;
+ 	arg->num_params = TEEC_CONFIG_PAYLOAD_REF_COUNT;
+ 	params = (struct tee_ioctl_param *)(arg + 1);
+ 
+-- 
+1.9.1
+
Signature · 1 line
1.9.1
#6 lore raw

PATCH 5/9 package/optee-client: support BUILD_STATIC_LIBS

In reply to Etienne Carriere

Patch optee-client from release 3.4.0 to support building resources with static linkage of executable binaries with the user libraries.

The optee-client patch is under review in the OP-TEE project [1] and should be merged in the next OP-TEE release 3.5.0.

This change drops !BR2_STATIC_LIBS constraint on package optee-client.

[1] https://github.com/OP-TEE/optee_client/pull/147

---
 .../0001-libteec-fix-build-warnings.patch          |  4 +-
 ...pport-BUILD_STATIC_LIBS-BUILD_SHARED_LIBS.patch | 51 ++++++++++++++++++++++
 package/optee-client/Config.in                     |  4 --
 3 files changed, 53 insertions(+), 6 deletions(-)
 create mode 100644 package/optee-client/0002-cmake-support-BUILD_STATIC_LIBS-BUILD_SHARED_LIBS.patch
package/optee-client/0001-libteec-fix-build-warnings.patch +2 -2
index 21f47ec..aec07b4 100644
@@ -1,7 +1,7 @@
-From 657414ccd20b4fb2985efd83b0679964fec923c2 Mon Sep 17 00:00:00 2001
+From 2f5ab18b4886b31a33850ee51f33fb753e9c7b7f Mon Sep 17 00:00:00 2001
 From: Etienne Carriere <[email protected]>
 Date: Fri, 1 Mar 2019 09:36:46 +0100
-Subject: [PATCH] libteec: fix build warnings
+Subject: [PATCH 1/2] libteec: fix build warnings
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: 8bit
package/optee-client/0002-cmake-support-BUILD_STATIC_LIBS-BUILD_SHARED_LIBS.patch new file +51 -0

51 lines not on this page · raw message

package/optee-client/Config.in +0 -4
index db0b7b7..0de136c 100644
@@ -1,6 +1,5 @@
 config BR2_PACKAGE_OPTEE_CLIENT
 	bool "optee-client"
-	depends on !BR2_STATIC_LIBS
 	help
 	  Enable the OP-TEE client package that brings non-secure
 	  client application resources for OP-TEE support. OP-TEE
@@ -12,6 +11,3 @@ config BR2_PACKAGE_OPTEE_CLIENT
 	  and invoked by the secure world.
 
 	  https://github.com/OP-TEE/optee_client
-
-comment "optee-client needs a toolchain w/ dynamic library"
-	depends on BR2_STATIC_LIBS
Signature · 1 line
1.9.1
#7 lore raw

PATCH 6/9 package/optee-test: drop constraint on !BR2_STATIC_LIBS

In reply to Etienne Carriere

Optee-client recently supports BR2_STATIC_LIBS and BR2_SHARED_LIBS directives. This change removes the constraint on package optee-test that now supports static linking of embedded binaries.

---
 package/optee-test/Config.in | 5 -----
 1 file changed, 5 deletions(-)
package/optee-test/Config.in +0 -5
index 575790b..2bccc76 100644
@@ -1,7 +1,6 @@
 config BR2_PACKAGE_OPTEE_TEST
 	bool "optee-test"
 	depends on BR2_TARGET_OPTEE_OS
-	depends on !BR2_STATIC_LIBS # optee-client
 	select BR2_PACKAGE_OPTEE_CLIENT
 	select BR2_TARGET_OPTEE_OS_SDK
 	help
@@ -21,7 +20,3 @@ config BR2_PACKAGE_OPTEE_TEST
 	  execution.
 
 	  http://github.com/OP-TEE/optee_test
-
-comment "optee-test needs a toolchain w/ dynamic library"
-	depends on BR2_TARGET_OPTEE_OS
-	depends on BR2_STATIC_LIBS
Signature · 1 line
1.9.1
#8 lore raw

PATCH 7/9 package/optee-examples: drop constraint on !BR2_STATIC_LIBS

In reply to Etienne Carriere

Optee-client recently supports BR2_STATIC_LIBS and BR2_SHARED_LIBS directives. This change removes the constraint on package optee-examples that now supports static linking of embedded binaries.

---
 package/optee-examples/Config.in | 5 -----
 1 file changed, 5 deletions(-)
package/optee-examples/Config.in +0 -5
index 479f920..3f730ca 100644
@@ -1,7 +1,6 @@
 config BR2_PACKAGE_OPTEE_EXAMPLES
 	bool "optee-examples"
 	depends on BR2_TARGET_OPTEE_OS
-	depends on !BR2_STATIC_LIBS # optee-client
 	select BR2_PACKAGE_OPTEE_CLIENT
 	select BR2_TARGET_OPTEE_OS_SDK
 	help
@@ -17,7 +16,3 @@ config BR2_PACKAGE_OPTEE_EXAMPLES
 	  execution.
 
 	  https://github.com/linaro-swg/optee_examples
-
-comment "optee-examples needs a toolchain w/ dynamic library"
-	depends on BR2_TARGET_OPTEE_OS
-	depends on BR2_STATIC_LIBS
Signature · 1 line
1.9.1
#9 lore raw

PATCH 8/9 package/optee-benchmark: drop constraint on !BR2_STATIC_LIBS

In reply to Etienne Carriere

Optee-client recently supports BR2_STATIC_LIBS and BR2_SHARED_LIBS directives. This change removes the constraint on package optee-benchmarktest that now supports static linking of embedded binaries.

---
 package/optee-benchmark/Config.in | 4 ----
 1 file changed, 4 deletions(-)
package/optee-benchmark/Config.in +0 -4
index 0e36549..a4af645 100644
@@ -1,6 +1,5 @@
 config BR2_PACKAGE_OPTEE_BENCHMARK
 	bool "optee-benchmark"
-	depends on !BR2_STATIC_LIBS # optee-client
 	select BR2_PACKAGE_OPTEE_CLIENT
 	select BR2_PACKAGE_LIBYAML
 	help
@@ -10,6 +9,3 @@ config BR2_PACKAGE_OPTEE_BENCHMARK
 	  by the OP-TEE project.
 
 	  http://github.com/linaro-swg/optee_benchmark
-
-comment "optee-benchmark needs a toolchain w/ dynamic library"
-	depends on BR2_STATIC_LIBS
Signature · 1 line
1.9.1
#10 lore raw

PATCH 9/9 boot/optee-os: support alternate image files

In reply to Etienne Carriere

Some platform may generate specific boot image files instead of the generic files tee.bin and tee-*_v2.bin when building OP-TEE OS package.

This change introduces optee-os configuration directive BR2_TARGET_OPTEE_OS_CORE_IMAGES that allows board configuration to specify its expected boot image file names.

---
 boot/optee-os/Config.in   | 13 +++++++++++++
 boot/optee-os/optee-os.mk |  7 +++++--
 2 files changed, 18 insertions(+), 2 deletions(-)
boot/optee-os/Config.in +13 -0
index a1f1b91..0f2df27 100644
@@ -99,4 +99,17 @@ config BR2_TARGET_OPTEE_OS_ADDITIONAL_VARIABLES
 	  Additional parameters for the OP-TEE OS build
 	  E.g. 'CFG_TEE_CORE_LOG_LEVEL=3 CFG_UNWIND=y'
 
+config BR2_TARGET_OPTEE_OS_CORE_IMAGES
+	string "Binary boot image filenames"
+	default "tee-header_v2.bin tee-pager_v2.bin"
+	help
+	  Names of generated image files that are installed in the
+	  output images/ directory.
+
+	  With OP-TEE pager disabled, defaults are tee-header_v2.bin
+	  and tee-pager_v2.bin.
+
+	  With OP-TEE pager enabled, one would select the 3 files
+	  tee-header_v2.bin, tee-pager_v2.bin and tee-pageable_v2.bin.
+
 endif # BR2_TARGET_OPTEE_OS
boot/optee-os/optee-os.mk +5 -2
index df481c9..e445e72 100644
@@ -62,6 +62,8 @@ OPTEE_OS_LOCAL_SDK = $(OPTEE_OS_BUILDDIR_OUT)/export-ta_arm32
 OPTEE_OS_STAGING_SDK = $(STAGING_DIR)/lib/optee/export-ta_arm32
 endif
 
+OPTEE_OS_IMAGE_FILES = $(call qstrip,$(BR2_TARGET_OPTEE_OS_CORE_IMAGES))
+
 ifeq ($(BR2_TARGET_OPTEE_OS_CORE),y)
 define OPTEE_OS_BUILD_CORE
 	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) O=$(OPTEE_OS_BUILDDIR_OUT) \
@@ -69,8 +71,9 @@ define OPTEE_OS_BUILD_CORE
 endef
 define OPTEE_OS_INSTALL_IMAGES_CORE
 	mkdir -p $(BINARIES_DIR)
-	cp -dpf $(@D)/$(OPTEE_OS_BUILDDIR_OUT)/core/tee.bin $(BINARIES_DIR)
-	cp -dpf $(@D)/$(OPTEE_OS_BUILDDIR_OUT)/core/tee-*_v2.bin $(BINARIES_DIR)
+	$(foreach f,$(OPTEE_OS_IMAGE_FILES), \
+		cp -dpf $(@D)/$(OPTEE_OS_BUILDDIR_OUT)/core/$(f) $(BINARIES_DIR)/
+	)
 endef
 endif # BR2_TARGET_OPTEE_OS_CORE
 
Signature · 1 line
1.9.1
#11 lore raw

PATCH 9/9 boot/optee-os: support alternate image files

Etienne,

Quoted 9 lines · On Fri, 1 Mar 2019 17:47:13 +0100 Etienne Carriere…

Some platform may generate specific boot image files instead of the generic files tee.bin and tee-*_v2.bin when building OP-TEE OS package.

This change introduces optee-os configuration directive BR2_TARGET_OPTEE_OS_CORE_IMAGES that allows board configuration to specify its expected boot image file names.

Thanks, I've applied this patch, with some changes. See below.

boot/optee-os/Config.in config BR2_TARGET_OPTEE_OS_ADDITIONAL_VARIABLES · line 104

Quoted 3 lines
boot/optee-os/Config.in +3 -0
+config BR2_TARGET_OPTEE_OS_CORE_IMAGES
+	string "Binary boot image filenames"
+	default "tee-header_v2.bin tee-pager_v2.bin"

The problem with this default value is that it breaks existing configurations. Indeed, today (without your patch), was get copied is tee.bin tee-*_v2.bin. So we want to preserve this behavior, and to achieve that, I've changed this line to:

	default "tee.bin tee-*_v2.bin"

boot/optee-os/Config.in config BR2_TARGET_OPTEE_OS_ADDITIONAL_VARIABLES · line 113

Quoted 5 lines
boot/optee-os/Config.in +5 -0
+	  With OP-TEE pager disabled, defaults are tee-header_v2.bin
+	  and tee-pager_v2.bin.
+
+	  With OP-TEE pager enabled, one would select the 3 files
+	  tee-header_v2.bin, tee-pager_v2.bin and tee-pageable_v2.bin.

I dropped these details, which I think are no longer that relevant with the changed default value.

boot/optee-os/optee-os.mk define OPTEE_OS_BUILD_CORE · line 75

Quoted 6 lines

define OPTEE_OS_INSTALL_IMAGES_CORE

boot/optee-os/optee-os.mk +2 -2
 	mkdir -p $(BINARIES_DIR)
-	cp -dpf $(@D)/$(OPTEE_OS_BUILDDIR_OUT)/core/tee.bin $(BINARIES_DIR)
-	cp -dpf $(@D)/$(OPTEE_OS_BUILDDIR_OUT)/core/tee-*_v2.bin $(BINARIES_DIR)
+	$(foreach f,$(OPTEE_OS_IMAGE_FILES), \
+		cp -dpf $(@D)/$(OPTEE_OS_BUILDDIR_OUT)/core/$(f) $(BINARIES_DIR)/

I have changed this to:

	cp -dpf $(wildcard $(@D)/$(OPTEE_OS_BUILDDIR_OUT)/core/$(f)) $(BINARIES_DIR)/

so that the tee-*_v2.bin gets properly expanded. I tested with a Marvell Armada 7K/8K OP-TEE configuration, and it continued to properly install the .bin files that were installed before this patch.

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#12 lore raw

PATCH 9/9 boot/optee-os: support alternate image files

Hi Thomas,

Thanks for the review, fixes and merge.

Regards,
etienne

Quoted 61 lines · Thomas Petazzoni

Etienne,

Quoted 9 lines · On Fri, 1 Mar 2019 17:47:13 +0100 Etienne Carriere…

Some platform may generate specific boot image files instead of the generic files tee.bin and tee-*_v2.bin when building OP-TEE OS package.

This change introduces optee-os configuration directive BR2_TARGET_OPTEE_OS_CORE_IMAGES that allows board configuration to specify its expected boot image file names.

Thanks, I've applied this patch, with some changes. See below.

boot/optee-os/Config.in config BR2_TARGET_OPTEE_OS_ADDITIONAL_VARIABLES · line 104

Quoted 3 lines
boot/optee-os/Config.in +3 -0
+config BR2_TARGET_OPTEE_OS_CORE_IMAGES
+     string "Binary boot image filenames"
+     default "tee-header_v2.bin tee-pager_v2.bin"

The problem with this default value is that it breaks existing configurations. Indeed, today (without your patch), was get copied is tee.bin tee-*_v2.bin. So we want to preserve this behavior, and to achieve that, I've changed this line to:

        default "tee.bin tee-*_v2.bin"

boot/optee-os/Config.in config BR2_TARGET_OPTEE_OS_ADDITIONAL_VARIABLES · line 113

Quoted 5 lines
boot/optee-os/Config.in +5 -0
+       With OP-TEE pager disabled, defaults are tee-header_v2.bin
+       and tee-pager_v2.bin.
+
+       With OP-TEE pager enabled, one would select the 3 files
+       tee-header_v2.bin, tee-pager_v2.bin and tee-pageable_v2.bin.

I dropped these details, which I think are no longer that relevant with the changed default value.

boot/optee-os/optee-os.mk define OPTEE_OS_BUILD_CORE · line 75

Quoted 6 lines

define OPTEE_OS_INSTALL_IMAGES_CORE

      mkdir -p $(BINARIES_DIR)
boot/optee-os/optee-os.mk +2 -2
-     cp -dpf $(@D)/$(OPTEE_OS_BUILDDIR_OUT)/core/tee.bin $(BINARIES_DIR)
-     cp -dpf $(@D)/$(OPTEE_OS_BUILDDIR_OUT)/core/tee-*_v2.bin $(BINARIES_DIR)
+     $(foreach f,$(OPTEE_OS_IMAGE_FILES), \
+             cp -dpf $(@D)/$(OPTEE_OS_BUILDDIR_OUT)/core/$(f) $(BINARIES_DIR)/

I have changed this to:

        cp -dpf $(wildcard $(@D)/$(OPTEE_OS_BUILDDIR_OUT)/core/$(f)) $(BINARIES_DIR)/

so that the tee-*_v2.bin gets properly expanded. I tested with a Marvell Armada 7K/8K OP-TEE configuration, and it continued to properly install the .bin files that were installed before this patch.

Thanks,

Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

#13 lore raw

PATCH 1/9 boot/optee-os: package sets TA SDK location

In reply to Etienne Carriere
Quoted 8 lines · On Fri, 1 Mar 2019 17:47:05 +0100 Etienne Carriere…

Makefile script for boot package optee-os produces make variable OPTEE_OS_STAGING_SDK to locate the Trusted Application SDK expected by other packages when building OP-TEE trusted applications.

---
 boot/optee-os/optee-os.mk | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

I changed the variable name to be just OPTEE_OS_SDK, and applied after adjusting the commit log. Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com