Skip to contentSkip to conversation

kernel-fit-image.bbclass: Fix operation with KERNEL_DTBVENDORED = "1"

PATCH Superseded Marek Vasut 3 participants 5 messages Jun 16 – Jun 22

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernel-fit-image.bbclass: Fix operation with KERNEL_DTBVENDORED = "1"

In the case KERNEL_DTBVENDORED = "1" , the fitImage configuration subnode names used to contain the vendor prefix in OE 5.0 , e.g.:
"

$ mkimage  -l fitImage
...
 Configuration 0 (conf-freescale_imx8mn-board.dtb)
                       ^^^^^^^^^^
...
"

With OE 6.0 this is no longer the case and KERNEL_DTBVENDORED = "1" and KERNEL_DTBVENDORED = "0" behave exactly the same way:
"

$ mkimage  -l fitImage
...
 Configuration 0 (conf-imx8mn-board.dtb)
...
"

Users depend on the correct configuration subnode names as those are used in the U-Boot "bootm" command when booting fitImages.

Fix this by converting each entry in the KERNEL_DEVICETREE list into the configuration subnode name by replacing all of its path separators with underscores.

Fixes 05d0c7342d76 ("kernel-fit-image.bbclass: add a new FIT image implementation")

---
Cc: Adrian Freihofer <[email protected]>
Cc: Richard Purdie <[email protected]>
Cc: Yoann Congal <[email protected]>
---
NOTE: This should ideally be added into OE 6.0 too

---
 meta/classes-recipe/kernel-fit-image.bbclass | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
meta/classes-recipe/kernel-fit-image.bbclass +8 -1
index ae8f3c66883..7bdb367151a 100644
@@ -94,6 +94,13 @@ python do_compile() {
         for dtb in kernel_devicetree.split():
             # In deploy_dir the DTBs are without sub-directories also with KERNEL_DTBVENDORED = "1"
             dtb_name = os.path.basename(dtb)
+            # With vendored DTs, use the DT name as listed in KERNEL_DEVICETREE
+            # and replace any path separators with underscores, this behaves the
+            # same way as KERNEL_DTBVENDORED = "1" did in OE 5.0 and older.
+            if d.getVar('KERNEL_DTBVENDORED') == "1":
+                conf_name = dtb.replace('/', '_')
+            else:
+                conf_name = dtb_name
 
             # Skip DTB if it's also provided in EXTERNAL_KERNEL_DEVICETREE directory
             if external_kernel_devicetree:
@@ -103,7 +110,7 @@ python do_compile() {
 
             # Copy the dtb or dtbo file into the FIT image assembly directory
             shutil.copyfile(os.path.join(kernel_deploydir, dtb_name), dtb_name)
-            root_node.fitimage_emit_section_dtb(dtb_name, dtb_name,
+            root_node.fitimage_emit_section_dtb(conf_name, dtb_name,
                 d.getVar("UBOOT_DTB_LOADADDRESS"), d.getVar("UBOOT_DTBO_LOADADDRESS"))
 
     if external_kernel_devicetree:
Signature · 1 line
2.53.0
#1 lore raw
Quoted 28 lines · Marek Vasut via lists.openembedded.org

In the case KERNEL_DTBVENDORED = "1" , the fitImage configuration subnode names used to contain the vendor prefix in OE 5.0 , e.g.:
"

$ mkimage  -l fitImage
...
 Configuration 0 (conf-freescale_imx8mn-board.dtb)
                       ^^^^^^^^^^
...
"

With OE 6.0 this is no longer the case and KERNEL_DTBVENDORED = "1" and KERNEL_DTBVENDORED = "0" behave exactly the same way:
"

$ mkimage  -l fitImage
...
 Configuration 0 (conf-imx8mn-board.dtb)
...
"

Users depend on the correct configuration subnode names as those are used in the U-Boot "bootm" command when booting fitImages.

Fix this by converting each entry in the KERNEL_DEVICETREE list into the configuration subnode name by replacing all of its path separators with underscores.

Fixes 05d0c7342d76 ("kernel-fit-image.bbclass: add a new FIT image implementation")
Quoted 7 lines

---
Cc: Adrian Freihofer <[email protected]>
Cc: Richard Purdie <[email protected]>
Cc: Yoann Congal <[email protected]>
---
NOTE: This should ideally be added into OE 6.0 too
---

Hi Marek,

Thanks for your patch.

It looks like this is breaking the fitimage.KernelFitImageRecipeTests.test_fit_image_ext_dtb_dtbo selftest:

2026-06-17 18:15:46,751 - oe-selftest - INFO - fitimage.KernelFitImageRecipeTests.test_fit_image_ext_dtb_dtbo (subunit.RemotedTestCase)
2026-06-17 18:15:46,752 - oe-selftest - INFO -  ... FAIL
...
2026-06-17 18:15:46,752 - oe-selftest - INFO - 9: 36/79 281/688 (28.27s) (0 failed) (fitimage.KernelFitImageRecipeTests.test_fit_image_ext_dtb_dtbo)
2026-06-17 18:15:46,752 - oe-selftest - INFO - testtools.testresult.real._StringException: Traceback (most recent call last):
  File "/srv/pokybuild/yocto-worker/oe-selftest-debian/build/layers/openembedded-core/meta/lib/oeqa/selftest/cases/fitimage.py", line 1259, in test_fit_image_ext_dtb_dtbo
    self._test_fitimage(bb_vars)
  File "/srv/pokybuild/yocto-worker/oe-selftest-debian/build/layers/openembedded-core/meta/lib/oeqa/selftest/cases/fitimage.py", line 646, in _test_fitimage
    self._check_its_file(bb_vars, fitimage_its_path)
  File "/srv/pokybuild/yocto-worker/oe-selftest-debian/build/layers/openembedded-core/meta/lib/oeqa/selftest/cases/fitimage.py", line 566, in _check_its_file
    self.assertTrue(found_all,
  File "/usr/lib/python3.12/unittest/case.py", line 727, in assertTrue
    raise self.failureException(msg)

AssertionError: False is not true : Fields in Image Tree Source File /srv/pokybuild/yocto-worker/oe-selftest-debian/build/build-st-2472397/tmp/deploy/images/qemux86-64/fit-image.its did not match, error in finding fdt = "fdt-test-overlay.dtbo";

https://autobuilder.yoctoproject.org/valkyrie/#/builders/35/builds/4062
https://autobuilder.yoctoproject.org/valkyrie/#/builders/23/builds/4140
https://autobuilder.yoctoproject.org/valkyrie/#/builders/48/builds/3912

Can you have a look at the issue?

Thanks,
Mathieu

Signature · 3 lines
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw
Quoted 39 lines · Mathieu Dubois-Briand
Quoted 28 lines · Marek Vasut via lists.openembedded.org

In the case KERNEL_DTBVENDORED = "1" , the fitImage configuration subnode names used to contain the vendor prefix in OE 5.0 , e.g.:
"

$ mkimage  -l fitImage
...
  Configuration 0 (conf-freescale_imx8mn-board.dtb)
                        ^^^^^^^^^^
...
"

With OE 6.0 this is no longer the case and KERNEL_DTBVENDORED = "1" and KERNEL_DTBVENDORED = "0" behave exactly the same way:
"

$ mkimage  -l fitImage
...
  Configuration 0 (conf-imx8mn-board.dtb)
...
"

Users depend on the correct configuration subnode names as those are used in the U-Boot "bootm" command when booting fitImages.

Fix this by converting each entry in the KERNEL_DEVICETREE list into the configuration subnode name by replacing all of its path separators with underscores.

Fixes 05d0c7342d76 ("kernel-fit-image.bbclass: add a new FIT image implementation")
Quoted 7 lines

---
Cc: Adrian Freihofer <[email protected]>
Cc: Richard Purdie <[email protected]>
Cc: Yoann Congal <[email protected]>
---
NOTE: This should ideally be added into OE 6.0 too
---

Hi Marek,

Quoted 7 lines

Thanks for your patch.

It looks like this is breaking the fitimage.KernelFitImageRecipeTests.test_fit_image_ext_dtb_dtbo selftest:

2026-06-17 18:15:46,751 - oe-selftest - INFO - fitimage.KernelFitImageRecipeTests.test_fit_image_ext_dtb_dtbo (subunit.RemotedTestCase)
2026-06-17 18:15:46,752 - oe-selftest - INFO -  ... FAIL

I think the oe selftest fails because KERNEL_DTBVENDORED is undefined, I inverted the conditional to handle that case and sent a V2, locally the oe selftest for fitImage now passes. Thanks !

#3 lore raw
In reply to Mathieu Dubois-Briand

Hi Marek, hi Mathieu

The issue is that the tests need to handle this change too. I tried to come up with a complete solution here:
https://lists.openembedded.org/g/openembedded-core/message/239258

The proposal is:
1. Fix the tests
2. Add the patches from Marek

Note: Here is my complete WIP branch for the fitimage related changes:
https://git.openembedded.org/openembedded-core-contrib/log/?h=adrianf/fit-improvements
There is one more patch which will add test coverage for the KERNEL_DTBVENDORED = "1" case. I will send this later, after the patches which are already in the queue will be merged to master.

Regards,
Adrian

Quoted 11 lines

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

#4 lore raw

On 6/21/26 12:21 PM, [email protected] wrote:

Hello Adrian,

Quoted 10 lines

The issue is that the tests need to handle this change too. I tried to come up with a complete solution here:
https://lists.openembedded.org/g/openembedded-core/message/239258

The proposal is:
1. Fix the tests
2. Add the patches from Marek

Quoted 5 lines

Note: Here is my complete WIP branch for the fitimage related changes:
https://git.openembedded.org/openembedded-core-contrib/log/?h=adrianf/fit-improvements
There is one more patch which will add test coverage for the KERNEL_DTBVENDORED = "1" case. I will send this later, after the patches which are already in the queue will be merged to master.

Thank you.

Signature · 2 lines
Best regards,
Marek Vasut