* [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
* Re: [Buildroot] [PATCH] boot: optee-os: enable RISC-V (64-bit) architecture
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
1 sibling, 0 replies; 4+ messages in thread
From: Yu-Chien Peter Lin via buildroot @ 2024-09-11 7:44 UTC (permalink / raw)
To: buildroot, Etienne Carriere
On Sat, Aug 17, 2024 at 07:22:03PM +0800, Yu Chien Peter Lin wrote:
> 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>
Gentle ping!
Hi Etienne, would you like to review the patch?
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Buildroot] [PATCH] boot: optee-os: enable RISC-V (64-bit) architecture
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
1 sibling, 1 reply; 4+ messages in thread
From: Arnout Vandecappelle via buildroot @ 2024-09-14 16:02 UTC (permalink / raw)
To: Yu Chien Peter Lin, buildroot; +Cc: tim609, alvinga, Etienne Carriere
On 17/08/2024 13:22, Yu Chien Peter Lin via buildroot wrote:
> 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>
Hi Peter,
Applied to master, thanks. I made some changes, see below, please check if
things are still OK!
> ---
> 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
I've removed this condition and reverted to the orginal situation, i.e.
setting CROSS_COMPILE_* for all architecture irrespective of the one we actually
use. I guess if it works for arm64/arm32, it will work for rv64 as well... I
wasn't really able to test though so let us know if something went wrong there.
>
> +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 \
This is in fact wrong, it should have been ARCH=arm.
Regards,
Arnout
> 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
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Buildroot] [PATCH] boot: optee-os: enable RISC-V (64-bit) architecture
2024-09-14 16:02 ` Arnout Vandecappelle via buildroot
@ 2024-09-16 5:44 ` Yu-Chien Peter Lin via buildroot
0 siblings, 0 replies; 4+ messages in thread
From: Yu-Chien Peter Lin via buildroot @ 2024-09-16 5:44 UTC (permalink / raw)
To: Arnout Vandecappelle; +Cc: tim609, alvinga, Etienne Carriere, buildroot
On Sat, Sep 14, 2024 at 06:02:08PM +0200, Arnout Vandecappelle wrote:
>
> On 17/08/2024 13:22, Yu Chien Peter Lin via buildroot wrote:
> > 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>
>
> Hi Peter,
>
> Applied to master, thanks. I made some changes, see below, please check if
> things are still OK!
Hi Arnout,
I've confirmed that the qemu_riscv64_virt_defconfig generates the RISC-V
OP-TEE binaries, thanks for handling this.
Best regards,
Peter Lin
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [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