Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] boot: optee-os: enable RISC-V (64-bit) architecture
@ 2024-08-17 11:22 Yu Chien Peter Lin via buildroot
  2024-09-11  7:44 ` Yu-Chien Peter Lin via buildroot
  2024-09-14 16:02 ` Arnout Vandecappelle via buildroot
  0 siblings, 2 replies; 4+ messages in thread
From: Yu Chien Peter Lin via buildroot @ 2024-08-17 11:22 UTC (permalink / raw)
  To: buildroot; +Cc: tim609, alvinga, Etienne Carriere, Yu Chien Peter Lin

OP-TEE OS and TAs can run on RISC-V (64-bit) machines, so allow
optee-os to be compiled for the new architecture.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
---
 boot/optee-os/Config.in   |  2 +-
 boot/optee-os/optee-os.mk | 29 ++++++++++++++++++++++++-----
 2 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/boot/optee-os/Config.in b/boot/optee-os/Config.in
index 2f996cbafc..cc0044f00a 100644
--- a/boot/optee-os/Config.in
+++ b/boot/optee-os/Config.in
@@ -1,6 +1,6 @@
 config BR2_TARGET_OPTEE_OS
 	bool "optee_os"
-	depends on BR2_ARM_CPU_ARMV8A || BR2_ARM_CPU_ARMV7A
+	depends on BR2_ARM_CPU_ARMV8A || BR2_ARM_CPU_ARMV7A || BR2_RISCV_64
 	help
 	  OP-TEE OS provides the secure world boot image and the trust
 	  application development kit of the OP-TEE project. OP-TEE OS
diff --git a/boot/optee-os/optee-os.mk b/boot/optee-os/optee-os.mk
index 6b04a0f5e1..d135de6dc7 100644
--- a/boot/optee-os/optee-os.mk
+++ b/boot/optee-os/optee-os.mk
@@ -44,26 +44,41 @@ ifeq ($(BR2_TARGET_OPTEE_OS_NEEDS_DTC),y)
 OPTEE_OS_DEPENDENCIES += host-dtc
 endif
 
+OPTEE_OS_MAKE_OPTS = \
+	CROSS_COMPILE="$(TARGET_CROSS)" \
+	CROSS_COMPILE_core="$(TARGET_CROSS)" \
+	PYTHON3="$(HOST_DIR)/bin/python3"
+
+ifeq ($(BR2_RISCV_64),y)
+OPTEE_OS_MAKE_OPTS += CROSS_COMPILE_ta_rv64="$(TARGET_CROSS)"
+else
 # On 64bit targets, OP-TEE OS can be built in 32bit mode, or
 # can be built in 64bit mode and support 32bit and 64bit
 # trusted applications. Since buildroot currently references
 # a single cross compiler, build exclusively in 32bit
 # or 64bit mode.
-OPTEE_OS_MAKE_OPTS = \
-	CROSS_COMPILE="$(TARGET_CROSS)" \
-	CROSS_COMPILE_core="$(TARGET_CROSS)" \
+OPTEE_OS_MAKE_OPTS += \
 	CROSS_COMPILE_ta_arm64="$(TARGET_CROSS)" \
-	CROSS_COMPILE_ta_arm32="$(TARGET_CROSS)" \
-	PYTHON3="$(HOST_DIR)/bin/python3"
+	CROSS_COMPILE_ta_arm32="$(TARGET_CROSS)"
+endif
 
+ifeq ($(BR2_riscv),y)
+OPTEE_OS_MAKE_OPTS += \
+	ARCH=riscv \
+	CFG_RV64_core=y \
+	CFG_USER_TA_TARGETS=ta_rv64
+else
 ifeq ($(BR2_aarch64),y)
 OPTEE_OS_MAKE_OPTS += \
+	ARCH=aarch64 \
 	CFG_ARM64_core=y \
 	CFG_USER_TA_TARGETS=ta_arm64
 else
 OPTEE_OS_MAKE_OPTS += \
+	ARCH=arm \
 	CFG_ARM32_core=y
 endif
+endif
 
 # Get mandatory PLAFORM and optional PLATFORM_FLAVOR and additional
 # variables
@@ -77,6 +92,10 @@ OPTEE_OS_MAKE_OPTS += $(call qstrip,$(BR2_TARGET_OPTEE_OS_ADDITIONAL_VARIABLES))
 # root path otherwise the output directory path depends on the target
 # platform name.
 OPTEE_OS_BUILDDIR_OUT = out
+ifeq ($(BR2_riscv),y)
+OPTEE_OS_LOCAL_SDK = $(OPTEE_OS_BUILDDIR_OUT)/export-ta_rv64
+OPTEE_OS_SDK = $(STAGING_DIR)/lib/optee/export-ta_rv64
+endif
 ifeq ($(BR2_aarch64),y)
 OPTEE_OS_LOCAL_SDK = $(OPTEE_OS_BUILDDIR_OUT)/export-ta_arm64
 OPTEE_OS_SDK = $(STAGING_DIR)/lib/optee/export-ta_arm64
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-09-16  5:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-17 11:22 [Buildroot] [PATCH] boot: optee-os: enable RISC-V (64-bit) architecture Yu Chien Peter Lin via buildroot
2024-09-11  7:44 ` Yu-Chien Peter Lin via buildroot
2024-09-14 16:02 ` Arnout Vandecappelle via buildroot
2024-09-16  5:44   ` Yu-Chien Peter Lin via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox