Skip to contentSkip to conversation

boot/optee-os: Add support to build with host-cmake

PATCH Applied Kory Maincent via buildroot 2 participants 4 messages Jul 11, 2024 – Jul 18, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 boot/optee-os: Add support to build with host-cmake

Some specific versions of OP-TEE need cmake on the host to build the scmi firmware, like the newly release STMicroelectronics 3.19.0-stm32mp-r2 version.

To allow building such OP-TEE OS versions, this commit adds the option BR2_TARGET_OPTEE_OS_NEEDS_CMAKE which when enabled ensures that host-cmake is built before OP-TEE OS.

---
 boot/optee-os/Config.in   | 6 ++++++
 boot/optee-os/optee-os.mk | 4 ++++
 2 files changed, 10 insertions(+)
boot/optee-os/Config.in +6 -0
index 34ea993136..7870629732 100644
@@ -91,6 +91,12 @@ config BR2_TARGET_OPTEE_OS_NEEDS_PYTHON_CRYPTOGRAPHY
 	  python-cryptography. Select this option if optee-os needs
 	  python-cryptography to be built.
 
+config BR2_TARGET_OPTEE_OS_NEEDS_CMAKE
+	bool "OP-TEE OS needs cmake"
+	help
+	  Select this option if your OP-TEE OS platform configuration
+	  requires the cmake build system to be available.
+
 config BR2_TARGET_OPTEE_OS_CORE
 	bool "Build core"
 	default y
boot/optee-os/optee-os.mk +4 -0
index 33b4e2e1ab..8fa5c824da 100644
@@ -30,6 +30,10 @@ endif
 
 OPTEE_OS_DEPENDENCIES = host-openssl host-python3 host-python-pyelftools
 
+ifeq ($(BR2_TARGET_OPTEE_OS_NEEDS_CMAKE),y)
+OPTEE_OS_DEPENDENCIES += host-cmake
+endif
+
 ifeq ($(BR2_TARGET_OPTEE_OS_NEEDS_PYTHON_CRYPTOGRAPHY),y)
 OPTEE_OS_DEPENDENCIES += host-python-cryptography
 else
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Etienne, since Kory is on holidays, perhaps you can answer the question below?

Quoted 36 lines · Kory Maincent via buildroot

Some specific versions of OP-TEE need cmake on the host to build the scmi firmware, like the newly release STMicroelectronics 3.19.0-stm32mp-r2 version.

To allow building such OP-TEE OS versions, this commit adds the option BR2_TARGET_OPTEE_OS_NEEDS_CMAKE which when enabled ensures that host-cmake is built before OP-TEE OS.

---
  boot/optee-os/Config.in   | 6 ++++++
  boot/optee-os/optee-os.mk | 4 ++++
  2 files changed, 10 insertions(+)
boot/optee-os/Config.in +6 -0
index 34ea993136..7870629732 100644
@@ -91,6 +91,12 @@ config BR2_TARGET_OPTEE_OS_NEEDS_PYTHON_CRYPTOGRAPHY
  	  python-cryptography. Select this option if optee-os needs
  	  python-cryptography to be built.
 
+config BR2_TARGET_OPTEE_OS_NEEDS_CMAKE
+	bool "OP-TEE OS needs cmake"
+	help
+	  Select this option if your OP-TEE OS platform configuration
+	  requires the cmake build system to be available.
+
  config BR2_TARGET_OPTEE_OS_CORE
  	bool "Build core"
  	default y
boot/optee-os/optee-os.mk +0 -0
index 33b4e2e1ab..8fa5c824da 100644

boot/optee-os/optee-os.mk endif · line 34

Quoted 5 lines
boot/optee-os/optee-os.mk +2 -0
@@ -30,6 +30,10 @@ endif
 
  OPTEE_OS_DEPENDENCIES = host-openssl host-python3 host-python-pyelftools
 
+ifeq ($(BR2_TARGET_OPTEE_OS_NEEDS_CMAKE),y)
+OPTEE_OS_DEPENDENCIES += host-cmake

This should be $(BR2_CMAKE_HOST_DEPENDENCY). I fixed that.

You should also check what the minimum CMake version is, and if it's higher
than 3.18, select the corresponding BR2_HOST_CMAKE_AT_LEAST_X_Y. Etienne?

Applied to master, thanks.

Regards,
Arnout

boot/optee-os/optee-os.mk endif · line 39

Quoted 5 lines
boot/optee-os/optee-os.mk +2 -0
+endif
+
  ifeq ($(BR2_TARGET_OPTEE_OS_NEEDS_PYTHON_CRYPTOGRAPHY),y)
  OPTEE_OS_DEPENDENCIES += host-python-cryptography
  else

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw

Hello Arnout,

Quoted 41 lines · Arnout Vandecappelle

Etienne, since Kory is on holidays, perhaps you can answer the question below?

Quoted 37 lines · Kory Maincent via buildroot

Some specific versions of OP-TEE need cmake on the host to build the scmi firmware, like the newly release STMicroelectronics 3.19.0-stm32mp-r2 version.

To allow building such OP-TEE OS versions, this commit adds the option BR2_TARGET_OPTEE_OS_NEEDS_CMAKE which when enabled ensures that host-cmake is built before OP-TEE OS.

---
  boot/optee-os/Config.in   | 6 ++++++
  boot/optee-os/optee-os.mk | 4 ++++
  2 files changed, 10 insertions(+)
boot/optee-os/Config.in +6 -0
index 34ea993136..7870629732 100644
@@ -91,6 +91,12 @@ config BR2_TARGET_OPTEE_OS_NEEDS_PYTHON_CRYPTOGRAPHY
        python-cryptography. Select this option if optee-os needs
        python-cryptography to be built.
 
+config BR2_TARGET_OPTEE_OS_NEEDS_CMAKE
+     bool "OP-TEE OS needs cmake"
+     help
+       Select this option if your OP-TEE OS platform configuration
+       requires the cmake build system to be available.
+
  config BR2_TARGET_OPTEE_OS_CORE
      bool "Build core"
      default y
boot/optee-os/optee-os.mk +0 -0
index 33b4e2e1ab..8fa5c824da 100644
@@ -30,6 +30,10 @@ endif
 
Quoted 6 lines

boot/optee-os/optee-os.mk endif · line 34

Quoted 4 lines
boot/optee-os/optee-os.mk +2 -0
  OPTEE_OS_DEPENDENCIES = host-openssl host-python3 host-python-pyelftools
 
+ifeq ($(BR2_TARGET_OPTEE_OS_NEEDS_CMAKE),y)
+OPTEE_OS_DEPENDENCIES += host-cmake
  This should be $(BR2_CMAKE_HOST_DEPENDENCY). I fixed that.

Thanks.

Quoted 4 lines

You should also check what the minimum CMake version is, and if it's higher
than 3.18, select the corresponding BR2_HOST_CMAKE_AT_LEAST_X_Y. Etienne?

OP-TEE OS needs at least CMake 3.18.3 to build the SCP-firmware part.
https://gitlab.arm.com/firmware/SCP-firmware/-/blame/v2.14.0/CMakeLists.txt#L10

Since BR seems to start from BR2_HOST_CMAKE_AT_LEAST_3_19, I guess this one already applies. Maybe this will really need to be fixed when a more recent CMake is required.

BR,
Etienne

Quoted 7 lines

Applied to master, thanks.

Regards,
Arnout

Quoted 6 lines

boot/optee-os/optee-os.mk endif · line 39

Quoted 5 lines
boot/optee-os/optee-os.mk +2 -0
+endif
+
  ifeq ($(BR2_TARGET_OPTEE_OS_NEEDS_PYTHON_CRYPTOGRAPHY),y)
  OPTEE_OS_DEPENDENCIES += host-python-cryptography
  else

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw
Quoted 54 lines · Etienne CARRIERE - foss

Hello Arnout,

Quoted 41 lines · Arnout Vandecappelle

Etienne, since Kory is on holidays, perhaps you can answer the question below?

Quoted 37 lines · Kory Maincent via buildroot

Some specific versions of OP-TEE need cmake on the host to build the scmi firmware, like the newly release STMicroelectronics 3.19.0-stm32mp-r2 version.

To allow building such OP-TEE OS versions, this commit adds the option BR2_TARGET_OPTEE_OS_NEEDS_CMAKE which when enabled ensures that host-cmake is built before OP-TEE OS.

---
   boot/optee-os/Config.in   | 6 ++++++
   boot/optee-os/optee-os.mk | 4 ++++
   2 files changed, 10 insertions(+)
boot/optee-os/Config.in +6 -0
index 34ea993136..7870629732 100644
@@ -91,6 +91,12 @@ config BR2_TARGET_OPTEE_OS_NEEDS_PYTHON_CRYPTOGRAPHY
         python-cryptography. Select this option if optee-os needs
         python-cryptography to be built.
 
+config BR2_TARGET_OPTEE_OS_NEEDS_CMAKE
+     bool "OP-TEE OS needs cmake"
+     help
+       Select this option if your OP-TEE OS platform configuration
+       requires the cmake build system to be available.
+
   config BR2_TARGET_OPTEE_OS_CORE
       bool "Build core"
       default y
boot/optee-os/optee-os.mk +0 -0
index 33b4e2e1ab..8fa5c824da 100644
@@ -30,6 +30,10 @@ endif
 
Quoted 6 lines

boot/optee-os/optee-os.mk endif · line 34

Quoted 4 lines
boot/optee-os/optee-os.mk +2 -0
   OPTEE_OS_DEPENDENCIES = host-openssl host-python3 host-python-pyelftools
 
+ifeq ($(BR2_TARGET_OPTEE_OS_NEEDS_CMAKE),y)
+OPTEE_OS_DEPENDENCIES += host-cmake
   This should be $(BR2_CMAKE_HOST_DEPENDENCY). I fixed that.

Thanks.

Quoted 1 line
Quoted 8 lines
Quoted 3 lines

You should also check what the minimum CMake version is, and if it's higher
than 3.18, select the corresponding BR2_HOST_CMAKE_AT_LEAST_X_Y. Etienne?

OP-TEE OS needs at least CMake 3.18.3 to build the SCP-firmware part.
https://gitlab.arm.com/firmware/SCP-firmware/-/blame/v2.14.0/CMakeLists.txt#L10

Since BR seems to start from BR2_HOST_CMAKE_AT_LEAST_3_19, I guess this one already applies.

Yes, 3.18 is the minimum for Buildroot as a whole. One of the options that we
set in pkg-cmake was added in that version.

The docker container used in testing has CMake 3.18, so normally we detect
this automatically in the autobuilders. But in this case, it's never tested in the autobuilders...

Quoted 1 line

Maybe this will really need to be fixed when a more recent CMake is required.

Exactly. I just wanted to double-check if no more recent version is required.
Usually a project declares its minimal version in the CMakeLists.txt itself so it's quite easy to be sure.

Whoever updates optee-os should also remember to check that, but probably
won't. Oh well...

Regards,
Arnout

Quoted 18 lines

BR,
Etienne

Quoted 13 lines

Applied to master, thanks.

Regards,
Arnout

Quoted 5 lines
boot/optee-os/optee-os.mk +2 -0
+endif
+
   ifeq ($(BR2_TARGET_OPTEE_OS_NEEDS_PYTHON_CRYPTOGRAPHY),y)
   OPTEE_OS_DEPENDENCIES += host-python-cryptography
   else

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot