From 83fbbd39d8752ad961d2da1cf140012428b99a63 Mon Sep 17 00:00:00 2001 From: Sumit Garg Date: Fri, 29 Dec 2023 19:42:33 +0530 Subject: [PATCH] optee_rust_examples_ext: Migrate to standard environment vars Allow OP-TEE rust examples to be compiled using standard OP-TEE environment variables: - CROSS_COMPILE - TA_DEV_KIT_DIR - OPTEE_CLIENT_EXPORT Acked-by: Jerome Forissier Acked-by: Yuan Zhuang Signed-off-by: Sumit Garg --- br-ext/package/optee_rust_examples_ext/Config.in | 6 ++++++ .../optee_rust_examples_ext/optee_rust_examples_ext.mk | 7 ++++++- common.mk | 5 ++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/br-ext/package/optee_rust_examples_ext/Config.in b/br-ext/package/optee_rust_examples_ext/Config.in index 8162a33b..b2913fa6 100644 --- a/br-ext/package/optee_rust_examples_ext/Config.in +++ b/br-ext/package/optee_rust_examples_ext/Config.in @@ -11,6 +11,12 @@ config BR2_PACKAGE_OPTEE_RUST_EXAMPLES_EXT_SITE if BR2_PACKAGE_OPTEE_RUST_EXAMPLES_EXT +config BR2_PACKAGE_OPTEE_RUST_EXAMPLES_EXT_SDK + string "OPTEE SDK path" + default "" + help + The path to OP-TEE TA development SDK + config BR2_PACKAGE_OPTEE_RUST_EXAMPLES_EXT_CROSS_COMPILE string "OP-TEE Rust examples cross compiler" default "" diff --git a/br-ext/package/optee_rust_examples_ext/optee_rust_examples_ext.mk b/br-ext/package/optee_rust_examples_ext/optee_rust_examples_ext.mk index 5b756582..a44d3e61 100644 --- a/br-ext/package/optee_rust_examples_ext/optee_rust_examples_ext.mk +++ b/br-ext/package/optee_rust_examples_ext/optee_rust_examples_ext.mk @@ -4,6 +4,7 @@ OPTEE_RUST_EXAMPLES_EXT_SITE = $(BR2_PACKAGE_OPTEE_RUST_EXAMPLES_EXT_SITE) OPTEE_RUST_EXAMPLES_EXT_SITE_METHOD = local OPTEE_RUST_EXAMPLES_EXT_INSTALL_STAGING = YES OPTEE_RUST_EXAMPLES_EXT_DEPENDENCIES = optee_client_ext +OPTEE_RUST_EXAMPLES_EXT_SDK = $(BR2_PACKAGE_OPTEE_RUST_EXAMPLES_EXT_SDK) ifneq (,$(BR2_PACKAGE_OPTEE_RUST_EXAMPLES_TC_PATH_ENV)) OPTEE_RUST_EXAMPLES_TC_PATH_ENV = PATH=$(BR2_PACKAGE_OPTEE_RUST_EXAMPLES_TC_PATH_ENV) @@ -28,7 +29,11 @@ export CC = $(OPTEE_DIR)/toolchains/aarch64/bin/aarch64-linux-gnu-gcc define OPTEE_RUST_EXAMPLES_EXT_BUILD_CMDS @$(foreach f,$(wildcard $(@D)/examples/*/Makefile), \ echo Building $f && \ - $(OPTEE_RUST_EXAMPLES_TC_PATH_ENV) $(MAKE) -C $(dir $f) &&) true + $(OPTEE_RUST_EXAMPLES_TC_PATH_ENV) \ + CROSS_COMPILE=$(BR2_PACKAGE_OPTEE_RUST_EXAMPLES_EXT_CROSS_COMPILE) \ + TA_DEV_KIT_DIR=$(OPTEE_RUST_EXAMPLES_EXT_SDK) \ + OPTEE_CLIENT_EXPORT=$(TARGET_DIR) \ + $(MAKE) -C $(dir $f) &&) true endef define OPTEE_RUST_EXAMPLES_EXT_INSTALL_TARGET_CMDS diff --git a/common.mk b/common.mk index 01529129..f174b4c3 100644 --- a/common.mk +++ b/common.mk @@ -196,11 +196,13 @@ CROSS_COMPILE_NS_USER ?= "$(CCACHE)$(AARCH$(COMPILE_NS_USER)_CROSS_COMPILE)" CROSS_COMPILE_NS_KERNEL ?= "$(CCACHE)$(AARCH$(COMPILE_NS_KERNEL)_CROSS_COMPILE)" CROSS_COMPILE_S_USER ?= "$(CCACHE)$(AARCH$(COMPILE_S_USER)_CROSS_COMPILE)" CROSS_COMPILE_S_KERNEL ?= "$(CCACHE)$(AARCH$(COMPILE_S_KERNEL)_CROSS_COMPILE)" +CROSS_COMPILE_RUST ?= "$(AARCH$(COMPILE_S_USER)_CROSS_COMPILE)" else ifeq ($(ARCH),riscv) CROSS_COMPILE_NS_USER ?= "$(CCACHE)$(RISCV$(COMPILE_NS_USER)_CROSS_COMPILE)" CROSS_COMPILE_NS_KERNEL ?= "$(CCACHE)$(RISCV$(COMPILE_NS_KERNEL)_CROSS_COMPILE)" CROSS_COMPILE_S_USER ?= "$(CCACHE)$(RISCV$(COMPILE_S_USER)_CROSS_COMPILE)" CROSS_COMPILE_S_KERNEL ?= "$(CCACHE)$(RISCV$(COMPILE_S_KERNEL)_CROSS_COMPILE)" +CROSS_COMPILE_RUST ?= "$(RISCV$(COMPILE_S_USER)_CROSS_COMPILE)" endif ################################################################################ @@ -285,7 +287,8 @@ BR2_PACKAGE_OPTEE_EXAMPLES_EXT_SITE ?= $(OPTEE_EXAMPLES_PATH) OPTEE_RUST_ENABLE ?= n ifeq ($(OPTEE_RUST_ENABLE),y) BR2_PACKAGE_OPTEE_RUST_EXAMPLES_EXT ?= y -BR2_PACKAGE_OPTEE_RUST_EXAMPLES_EXT_CROSS_COMPILE ?= $(CROSS_COMPILE_S_USER) +BR2_PACKAGE_OPTEE_RUST_EXAMPLES_EXT_CROSS_COMPILE ?= $(CROSS_COMPILE_RUST) +BR2_PACKAGE_OPTEE_RUST_EXAMPLES_EXT_SDK ?= $(OPTEE_OS_TA_DEV_KIT_DIR) BR2_PACKAGE_OPTEE_RUST_EXAMPLES_EXT_SITE ?= $(OPTEE_RUST_PATH) BR2_PACKAGE_OPTEE_RUST_EXAMPLES_TC_PATH_ENV = $(ROOT)/toolchains/aarch64/bin:$(HOME)/.cargo/bin:$(PATH) endif