Skip to content

Commit

Permalink
optee_rust_examples_ext: Migrate to standard environment vars
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Yuan Zhuang <[email protected]>
Signed-off-by: Sumit Garg <[email protected]>
  • Loading branch information
b49020 authored and jforissier committed Jan 3, 2024
1 parent 98a7281 commit 83fbbd3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
6 changes: 6 additions & 0 deletions br-ext/package/optee_rust_examples_ext/Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
5 changes: 4 additions & 1 deletion common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

################################################################################
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 83fbbd3

Please sign in to comment.