Skip to contentSkip to conversation

arm/trusted-firmware-a: Add cot-dt2c

PATCH Applied Jon Mason 2 participants 3 messages Jan 22, 2025 – Feb 12, 2025

lore
Share & tools
lore

Jon Mason

author
#0 lore raw

PATCH 1/2 arm/trusted-firmware-a: Add cot-dt2c

Platforms with GENERATE_COT need to either have COT_DESC_IN_DTB set or use cot-dt2c to generate it. Add cot-dt2c from trusted-firmware-a sources and its python dependencies to enable this for those that need it.

Also, move all the relevant platforms in meta-arm-bsp to use 2.12

---
 .../trusted-firmware-a/cot-dt2c_0.1.0.bb      | 25 +++++++++++++++++++
 .../python/python3-pydevicetree_0.0.12.bb     | 10 ++++++++
 2 files changed, 35 insertions(+)
 create mode 100644 meta-arm/recipes-bsp/trusted-firmware-a/cot-dt2c_0.1.0.bb
 create mode 100644 meta-arm/recipes-devtools/python/python3-pydevicetree_0.0.12.bb
meta-arm/recipes-bsp/trusted-firmware-a/cot-dt2c_0.1.0.bb new file +25 -0
new file mode 100644
index 000000000000..8f64b8a66b8a
@@ -0,0 +1,25 @@
+# Description, License, and version from tools/cot_dt2c/pyproject.toml in TF-A source
+DESCRIPTION = "CoT-dt2c Tool is a python script to convert CoT DT file into corresponding C file"
+LICENSE = "BSD-3-Clause"
+
+SRC_URI_TRUSTED_FIRMWARE_A ?= "git://git.trustedfirmware.org/TF-A/trusted-firmware-a.git;protocol=https"
+SRC_URI = "${SRC_URI_TRUSTED_FIRMWARE_A};branch=${SRCBRANCH}"
+LIC_FILES_CHKSUM = "file://docs/license.rst;md5=83b7626b8c7a37263c6a58af8d19bee1"
+
+# Use cot-dt2c from TF-A v2.12.0
+SRCREV = "4ec2948fe3f65dba2f19e691e702f7de2949179c"
+SRCBRANCH = "master"
+
+inherit python_poetry_core
+
+BBCLASSEXTEND = "native nativesdk"
+
+S = "${UNPACKDIR}/git"
+
+# Dependencies of plotly and igraph are not needed for the standard case
+RDEPENDS:${PN} += "python3-click \
+                   python3-pydevicetree \
+                   python3-pyparsing \
+                  "
+
+PEP517_SOURCE_PATH = "${S}/tools/cot_dt2c"
meta-arm/recipes-devtools/python/python3-pydevicetree_0.0.12.bb new file +10 -0
new file mode 100644
index 000000000000..fdd7715df629
@@ -0,0 +1,10 @@
+SUMMARY = "Python 3 library for parsing, querying, and modifying Devicetree Source v1 files"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://PKG-INFO;beginline=8;endline=8;md5=23f9ad5cad3d8cc0336e2a5d8a87e1fa"
+HOMEPAGE = "https://github.com/sifive/pydevicetree"
+
+inherit pypi setuptools3
+
+SRC_URI[sha256sum] = "1ca19ec38bec0095a0a8dc4753a578e8c6e9a70873112547d30c92b32411f667"
+
+BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.39.5 (Apple Git-154)
author
#1 lore raw

PATCH 2/2 arm/trusted-firmware-a: Move 2.11 to meta-arm-bsp

Move v2.11 to meta-arm-bsp so that corstone1000 can still use it (though 2.12 does appear to work). Move all the other platforms in meta-arm-bsp to use 2.12.

---
 meta-arm-bsp/conf/machine/fvp-base.conf                     | 2 --
 meta-arm-bsp/conf/machine/sgi575.conf                       | 2 --
 .../trusted-firmware-a/trusted-firmware-a-fvp-base.inc      | 6 ++++++
 .../trusted-firmware-a/trusted-firmware-a-sgi575.inc        | 6 ++++++
 .../trusted-firmware-a/trusted-firmware-a_2.11.0.bb         | 0
 5 files changed, 12 insertions(+), 4 deletions(-)
 rename {meta-arm => meta-arm-bsp}/recipes-bsp/trusted-firmware-a/trusted-firmware-a_2.11.0.bb (100%)
meta-arm-bsp/conf/machine/fvp-base.conf +0 -2
index b69995256008..03896a347184 100644
@@ -20,8 +20,6 @@ SERIAL_CONSOLES = "115200;ttyAMA0"
 # FIXME -  This is being upstreamed.  Remove once that has occurred.
 KERNEL_CONSOLE ?= "${@','.join(d.getVar('SERIAL_CONSOLES').split(' ')[0].split(';')[::-1]) or 'ttyS0'}"
 
-PREFERRED_VERSION_trusted-firmware-a ?= "2.11.%"
-
 PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto"
 KERNEL_DTB_NAME = "fvp-base-revc.dtb"
 KERNEL_DEVICETREE = "arm/${KERNEL_DTB_NAME}"
meta-arm-bsp/conf/machine/sgi575.conf +0 -2
index e905c4293792..3c2c94b6dcbf 100644
@@ -6,8 +6,6 @@
 
 require conf/machine/include/arm/armv8-2a/tune-cortexa75.inc
 
-PREFERRED_VERSION_trusted-firmware-a ?= "2.11.%"
-
 EXTRA_IMAGEDEPENDS += "virtual/control-processor-firmware"
 
 EXTRA_IMAGEDEPENDS += "trusted-firmware-a"
meta-arm-bsp/recipes-bsp/trusted-firmware-a/trusted-firmware-a-fvp-base.inc +6 -0
index a5d1ee53515b..4f0d34ea09b5 100644
@@ -62,3 +62,9 @@ EXTRA_OEMAKE += "FVP_DT_PREFIX=fvp-base-gicv3-psci-1t FVP_USE_GIC_DRIVER=FVP_GIC
 
 # Our fvp-base machine explicitly has v8.4 cores
 EXTRA_OEMAKE += "ARM_ARCH_MAJOR=8 ARM_ARCH_MINOR=4"
+
+# If GENERATE_COT is set, then tf-a will try to use local poetry install
+# to run the python cot-dt2c command.  Disable the local poetry and use
+# the provided cot-dt2c.
+EXTRA_OEMAKE += "POETRY=''"
+DEPENDS += "cot-dt2c-native"
meta-arm-bsp/recipes-bsp/trusted-firmware-a/trusted-firmware-a-sgi575.inc +6 -0
index 20904b34cb78..01cc67bb32e3 100644
@@ -11,3 +11,9 @@ TFA_UEFI           = "1"
 
 EXTRA_OEMAKE += "TRUSTED_BOARD_BOOT=1 GENERATE_COT=1 ARM_ROTPK_LOCATION=devel_rsa \
                      ROT_KEY=plat/arm/board/common/rotpk/arm_rotprivk_rsa.pem"
+
+# If GENERATE_COT is set, then tf-a will try to use local poetry install
+# to run the python cot-dt2c command.  Disable the local poetry and use
+# the provided cot-dt2c.
+EXTRA_OEMAKE += "POETRY=''"
+DEPENDS += "cot-dt2c-native"
meta-arm-bsp/recipes-bsp/trusted-firmware-a/trusted-firmware-a_2.11.0.bb renamed from meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a_2.11.0.bb +0 -0
similarity index 100%
rename from meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a_2.11.0.bb
rename to meta-arm-bsp/recipes-bsp/trusted-firmware-a/trusted-firmware-a_2.11.0.bb
Signature · 1 line
2.39.5 (Apple Git-154)
Applied
#2 lore raw
In reply to Jon Mason
Quoted 8 lines · Jon Mason

Platforms with GENERATE_COT need to either have COT_DESC_IN_DTB set or use cot-dt2c to generate it. Add cot-dt2c from trusted-firmware-a sources and its python dependencies to enable this for those that need it.

Also, move all the relevant platforms in meta-arm-bsp to use 2.12

[...]

Applied, thanks!

[1/2] arm/trusted-firmware-a: Add cot-dt2c

      commit: f0f0be29a3ca8fa491fba1964d2a8335d896662a
[2/2] arm/trusted-firmware-a: Move 2.11 to meta-arm-bsp
      commit: 8a457932df115edbffb6d741baeb0a19c6853df6

Best regards,

Signature · 1 line
Jon Mason <[email protected]>