Skip to contentSkip to conversation

kernel-fit-image: Add KERNEL_DTBVENDORED support for FIT_CONF_DEFAULT_DTB

PATCH Superseded Ryan Eatmon 2 participants 3 messages Jun 30 – Jul 2

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernel-fit-image: Add KERNEL_DTBVENDORED support for FIT_CONF_DEFAULT_DTB

When specifying a FIT_CONF_DEFAULT_DTB for a machine, you have to exactly align the name with what will be in the fitImage file or you will get a build error. If you also turn on KERNEL_DTBVENDORED then you must also specify the vendor directory as part of the dtb name that you want for the default, but you must manually do the same mapping that the kernel-fit-image class is doing when it generates the fit-image.its file.

This patch just adds the same logic to figure out the value for the requested default dtb and eliminate the need to understand the internal mapping of the class. It should make specifying the value more intuitive. The same value that you put in the KERNEL_DEVICETREE can be used in the FIT_CONF_DEFAULT_DTB and the new code will correctly honor the KERNEL_DTBVENDORED setting.

Before:

  KERNEL_DEVICETREE = "
    ti/k3-am62p5-sk.dtb \
    ... \
  "
  FIT_CONF_DEFAULT_DTB = "ti_k3-am62p5-sk.dtb"

After:

  KERNEL_DEVICETREE = "
    ti/k3-am62p5-sk.dtb \
    ... \
  "
  FIT_CONF_DEFAULT_DTB = "ti/k3-am62p5-sk.dtb"
---
 meta/classes-recipe/kernel-fit-image.bbclass | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
meta/classes-recipe/kernel-fit-image.bbclass +14 -1
index 448a88ccb1..f49838d639 100644
@@ -195,8 +195,21 @@ python do_compile() {
                                                  loadable_loadaddress,
                                                  loadable_entrypoint)
 
+    # Figure out if we have a default dtb and if we need to honor the
+    # KERNEL_DTBVENDORED variable to tweak the name to match what will be
+    # in the fitImage.
+    default_dtb = d.getVar("FIT_CONF_DEFAULT_DTB")
+    if default_dtb:
+        # With vendored DTs, replace any path separators with underscores,
+        # this matches the behavior used to generate the dtb entry in other
+        # parts of the code.
+        if d.getVar('KERNEL_DTBVENDORED') != "1":
+            default_dtb = os.path.basename(default_dtb)
+        else:
+            default_dtb = default_dtb.replace('/', '_')
+
     # Generate the configuration section
-    root_node.fitimage_emit_section_config(d.getVar("FIT_CONF_DEFAULT_DTB"), d.getVar("FIT_CONF_MAPPINGS"))
+    root_node.fitimage_emit_section_config(default_dtb, d.getVar("FIT_CONF_MAPPINGS"))
 
     # Write the its file
     root_node.write_its_file(itsfile)
Signature · 1 line
2.43.0
#1 lore raw

Hi Ryan

Quoted 61 lines · Ryan Eatmon via lists.openembedded.org

When specifying a FIT_CONF_DEFAULT_DTB for a machine, you have to exactly align the name with what will be in the fitImage file or you will get a build error.  If you also turn on KERNEL_DTBVENDORED then you
must also specify the vendor directory as part of the dtb name that you
want for the default, but you must manually do the same mapping that the
kernel-fit-image class is doing when it generates the fit-image.its file.

This patch just adds the same logic to figure out the value for the requested default dtb and eliminate the need to understand the internal
mapping of the class.  It should make specifying the value more intuitive.  The same value that you put in the KERNEL_DEVICETREE can be
used in the FIT_CONF_DEFAULT_DTB and the new code will correctly honor
the KERNEL_DTBVENDORED setting.

Before:

  KERNEL_DEVICETREE = "
    ti/k3-am62p5-sk.dtb \
    ... \
  "
  FIT_CONF_DEFAULT_DTB = "ti_k3-am62p5-sk.dtb"

After:

  KERNEL_DEVICETREE = "
    ti/k3-am62p5-sk.dtb \
    ... \
  "
  FIT_CONF_DEFAULT_DTB = "ti/k3-am62p5-sk.dtb"

---
 meta/classes-recipe/kernel-fit-image.bbclass | 15 ++++++++++++++-

 1 file changed, 14 insertions(+), 1 deletion(-)
meta/classes-recipe/kernel-fit-image.bbclass +0 -0
index 448a88ccb1..f49838d639 100644
@@ -195,8 +195,21 @@ python do_compile() {


loadable_loadaddress,

loadable_entrypoint)

+    # Figure out if we have a default dtb and if we need to honor the
+    # KERNEL_DTBVENDORED variable to tweak the name to match what will be
+    # in the fitImage.
+    default_dtb = d.getVar("FIT_CONF_DEFAULT_DTB")
+    if default_dtb:
+        # With vendored DTs, replace any path separators with

Quoted 8 lines

underscores,
+        # this matches the behavior used to generate the dtb entry in other
+        # parts of the code.
+        if d.getVar('KERNEL_DTBVENDORED') != "1":
+            default_dtb = os.path.basename(default_dtb) +        else:
+            default_dtb = default_dtb.replace('/', '_')

This is probably needed in addition to
https://git.openembedded.org/openembedded-core/commit/?id=4297b94c3728cd2e320d75b68c508e12ab127719
if I understand correctly.

Would it make sense to move this if else block into a function which can be used in both places?

Regards,
Adrian

Quoted 21 lines

+
     # Generate the configuration section
- root_node.fitimage_emit_section_config(d.getVar("FIT_CONF_DEFAULT_DTB "), d.getVar("FIT_CONF_MAPPINGS"))
+    root_node.fitimage_emit_section_config(default_dtb, d.getVar("FIT_CONF_MAPPINGS"))

     # Write the its file root_node.write_its_file(itsfile)

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#239914):
https://lists.openembedded.org/g/openembedded-core/message/239914
Mute This Topic: https://lists.openembedded.org/mt/120052405/4454582
Group Owner: [email protected] Unsubscribe:
https://lists.openembedded.org/g/openembedded-core/unsub [
[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw
Quoted 78 lines · On 7/2/2026 4:31 AM, [email protected] wrote:

Hi Ryan

Quoted 61 lines · Ryan Eatmon via lists.openembedded.org

When specifying a FIT_CONF_DEFAULT_DTB for a machine, you have to exactly align the name with what will be in the fitImage file or you will get a build error.  If you also turn on KERNEL_DTBVENDORED then you
must also specify the vendor directory as part of the dtb name that you
want for the default, but you must manually do the same mapping that the
kernel-fit-image class is doing when it generates the fit-image.its file.

This patch just adds the same logic to figure out the value for the requested default dtb and eliminate the need to understand the internal
mapping of the class.  It should make specifying the value more intuitive.  The same value that you put in the KERNEL_DEVICETREE can be
used in the FIT_CONF_DEFAULT_DTB and the new code will correctly honor
the KERNEL_DTBVENDORED setting.

Before:

  KERNEL_DEVICETREE = "
    ti/k3-am62p5-sk.dtb \
    ... \
  "
  FIT_CONF_DEFAULT_DTB = "ti_k3-am62p5-sk.dtb"

After:

  KERNEL_DEVICETREE = "
    ti/k3-am62p5-sk.dtb \
    ... \
  "
  FIT_CONF_DEFAULT_DTB = "ti/k3-am62p5-sk.dtb"

---
  meta/classes-recipe/kernel-fit-image.bbclass | 15 ++++++++++++++-
  1 file changed, 14 insertions(+), 1 deletion(-)
meta/classes-recipe/kernel-fit-image.bbclass +1 -0
index 448a88ccb1..f49838d639 100644
@@ -195,8 +195,21 @@ python do_compile() {
 
 loadable_loadaddress,
 
 loadable_entrypoint)
 
+    # Figure out if we have a default dtb and if we need to honor

the
+    # KERNEL_DTBVENDORED variable to tweak the name to match what will be
+    # in the fitImage.
+    default_dtb = d.getVar("FIT_CONF_DEFAULT_DTB")
+    if default_dtb:
+        # With vendored DTs, replace any path separators with

Quoted 8 lines

underscores,
+        # this matches the behavior used to generate the dtb entry in other
+        # parts of the code.
+        if d.getVar('KERNEL_DTBVENDORED') != "1":
+            default_dtb = os.path.basename(default_dtb) +        else:
+            default_dtb = default_dtb.replace('/', '_')

This is probably needed in addition to
https://git.openembedded.org/openembedded-core/commit/?id=4297b94c3728cd2e320d75b68c508e12ab127719
if I understand correctly.

Quoted 2 lines

Would it make sense to move this if else block into a function which can be used in both places?

Yes. It would. I'll send a v2 with that and a test case as well.

Quoted 24 lines

Regards,
Adrian

Quoted 21 lines
meta/classes-recipe/kernel-fit-image.bbclass +1 -1
+
      # Generate the configuration section
-

root_node.fitimage_emit_section_config(d.getVar("FIT_CONF_DEFAULT_DTB "), d.getVar("FIT_CONF_MAPPINGS"))
+    root_node.fitimage_emit_section_config(default_dtb, d.getVar("FIT_CONF_MAPPINGS"))

     # Write the its file
     root_node.write_its_file(itsfile)

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#239914):
https://lists.openembedded.org/g/openembedded-core/message/239914
Mute This Topic: https://lists.openembedded.org/mt/120052405/4454582
Group Owner: [email protected] Unsubscribe:
https://lists.openembedded.org/g/openembedded-core/unsub [
[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 3 lines
Ryan Eatmon                [email protected]
-----------------------------------------
Texas Instruments, Inc.  -  LCPD  -  MGTS