boot: optee-os: enable RISC-V (64-bit) architecture
PATCH 1/1 boot: optee-os: enable RISC-V (64-bit) architecture
OP-TEE OS and TAs can run on RISC-V (64-bit) machines, so allow optee-os to be compiled for the new architecture.
--- boot/optee-os/Config.in | 2 +- boot/optee-os/optee-os.mk | 29 ++++++++++++++++++++++++----- 2 files changed, 25 insertions(+), 6 deletions(-)
boot/optee-os/Config.in +1 -1
@@ -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
boot/optee-os/optee-os.mk +24 -5
@@ -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
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 4 lines · 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 <[email protected]>
Gentle ping!
Hi Etienne, would you like to review the patch?
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 4 lines · Yu Chien Peter Lin via buildroot
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 <[email protected]>
Hi Peter,
Applied to master, thanks. I made some changes, see below, please check if
things are still OK!
Quoted 37 lines
--- boot/optee-os/Config.in | 2 +- boot/optee-os/optee-os.mk | 29 ++++++++++++++++++++++++----- 2 files changed, 25 insertions(+), 6 deletions(-)boot/optee-os/Config.in +1
-1@@ -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 OSboot/optee-os/optee-os.mk +8
-0@@ -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
boot/optee-os/optee-os.mk ifeq ($(BR2_TARGET_OPTEE_OS_NEEDS_DTC),y) · line 63
Quoted 10 lines
boot/optee-os/optee-os.mk +3
-5# 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.
boot/optee-os/optee-os.mk ifeq ($(BR2_TARGET_OPTEE_OS_NEEDS_DTC),y) · line 73
Quoted 10 lines
boot/optee-os/optee-os.mk +7
-0+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
Quoted 12 lines
boot/optee-os/optee-os.mk +2
-0CFG_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
boot/optee-os/optee-os.mk OPTEE_OS_MAKE_OPTS += $(call qstrip,$(BR2_TARGET_OPTEE_OS_ADDITIONAL_VARIABLES)) · line 101
Quoted 10 lines
boot/optee-os/optee-os.mk +4
-0@@ -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
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 11 lines · Arnout Vandecappelle
Quoted 4 lines · Yu Chien Peter Lin via buildroot
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 <[email protected]>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
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot