Skip to contentSkip to conversation

fitimage: introduce FIT_CONF_STRIP_EXT

PATCH In review Richard Leitner 2 participants 3 messages Jan 7 – Jan 9

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fitimage: introduce FIT_CONF_STRIP_EXT

Introduce a configuration variable named FIT_CONF_STRIP_EXT which removes the file-type extension from the configuration node name.

This feature enables us to give configuration nodes arbritary names (based on the dtb file names). This is in my case needed to ensure consistent configuration names which where previously (walnascar) generated using a fitimage_emit_section_config:append() function.

---
 meta/classes-recipe/kernel-fit-image.bbclass | 1 +
 meta/conf/image-fitimage.conf                | 3 +++
 meta/lib/oe/fitimage.py                      | 4 ++++
 meta/lib/oeqa/selftest/cases/fitimage.py     | 3 +++
 4 files changed, 11 insertions(+)
meta/classes-recipe/kernel-fit-image.bbclass +1 -0
index fd0d21ceee..6f78016e14 100644
@@ -54,6 +54,7 @@ python do_compile() {
     root_node = oe.fitimage.ItsNodeRootKernel(
         d.getVar("FIT_DESC"), d.getVar("FIT_ADDRESS_CELLS"),
         d.getVar('HOST_PREFIX'), d.getVar('UBOOT_ARCH'),  d.getVar("FIT_CONF_PREFIX"),
+        oe.types.boolean(d.getVar('FIT_CONF_STRIP_EXT')),
         oe.types.boolean(d.getVar('FIT_KERNEL_SIGN_ENABLE')), d.getVar("FIT_KERNEL_SIGN_KEYDIR"),
         d.getVar("UBOOT_MKIMAGE"), d.getVar("UBOOT_MKIMAGE_DTCOPTS"),
         d.getVar("UBOOT_MKIMAGE_SIGN"), d.getVar("UBOOT_MKIMAGE_SIGN_ARGS"),
meta/conf/image-fitimage.conf +3 -0
index 090ee148f4..6bf0dd1299 100644
@@ -35,6 +35,9 @@ FIT_SIGN_INDIVIDUAL ?= "0"
 FIT_CONF_PREFIX ?= "conf-"
 FIT_CONF_PREFIX[doc] = "Prefix to use for FIT configuration node name"
 
+FIT_CONF_STRIP_EXT ?= "0"
+FIT_CONF_STRIP_EXT[doc] = "Set true to strip a possible file-type extension from a FIT configuration node name"
+
 FIT_SUPPORTED_INITRAMFS_FSTYPES ?= "cpio.lz4 cpio.lzo cpio.lzma cpio.xz cpio.zst cpio.gz ext2.gz cpio"
 
 # Allow user to support special use cases where the kernel binary is
meta/lib/oe/fitimage.py +4 -0
index f303799155..bbd5e1843f 100644
@@ -154,6 +154,7 @@ class ItsNodeRootKernel(ItsNode):
     firt DTB. If there is no dtb present than the default configuation the kernel.
     """
     def __init__(self, description, address_cells, host_prefix, arch, conf_prefix,
+                 conf_strip_ext=False,
                  sign_enable=False, sign_keydir=None,
                  mkimage=None, mkimage_dtcopts=None,
                  mkimage_sign=None, mkimage_sign_args=None,
@@ -171,6 +172,7 @@ class ItsNodeRootKernel(ItsNode):
         self._host_prefix = host_prefix
         self._arch = arch
         self._conf_prefix = conf_prefix
+        self._conf_strip_ext = conf_strip_ext
 
         # Signature related properties
         self._sign_enable = sign_enable
@@ -468,6 +470,8 @@ class ItsNodeRootKernel(ItsNode):
                 dtb_name = dtb.name
                 if dtb.name.startswith("fdt-"):
                     dtb_name = dtb.name[len("fdt-"):]
+                if self._conf_strip_ext:
+                    dtb_name = dtb_name.rsplit(".", 1)[0]
                 self._fitimage_emit_one_section_config(self._conf_prefix + dtb_name, dtb)
             for dtb in self._dtb_alias:
                 self._fitimage_emit_one_section_config(self._conf_prefix + dtb.alias_name, dtb)
meta/lib/oeqa/selftest/cases/fitimage.py +3 -0
index 8df5e92a34..84741f10ae 100644
@@ -412,6 +412,7 @@ class KernelFitImageBase(FitImageTestCase):
             'DEPLOY_DIR_IMAGE',
             'FIT_CONF_DEFAULT_DTB',
             'FIT_CONF_PREFIX',
+            'FIT_CONF_STRIP_EXT',
             'FIT_DESC',
             'FIT_HASH_ALG',
             'FIT_KERNEL_COMP_ALG',
@@ -1070,6 +1071,7 @@ class FitImagePyTests(KernelFitImageBase):
             'FIT_ADDRESS_CELLS': "1",
             'FIT_CONF_DEFAULT_DTB': "",
             'FIT_CONF_PREFIX': "conf-",
+            'FIT_CONF_STRIP_EXT': "0",
             'FIT_DESC': "Kernel fitImage for a dummy distro",
             'FIT_GENERATE_KEYS': "0",
             'FIT_HASH_ALG': "sha256",
@@ -1115,6 +1117,7 @@ class FitImagePyTests(KernelFitImageBase):
         root_node = oe.fitimage.ItsNodeRootKernel(
             bb_vars["FIT_DESC"], bb_vars["FIT_ADDRESS_CELLS"],
             bb_vars['HOST_PREFIX'], bb_vars['UBOOT_ARCH'],  bb_vars["FIT_CONF_PREFIX"],
+            oe.types.boolean(bb_vars['FIT_CONF_STRIP_EXT']),
             oe.types.boolean(bb_vars['UBOOT_SIGN_ENABLE']), bb_vars["UBOOT_SIGN_KEYDIR"],
             bb_vars["UBOOT_MKIMAGE"], bb_vars["UBOOT_MKIMAGE_DTCOPTS"],
             bb_vars["UBOOT_MKIMAGE_SIGN"], bb_vars["UBOOT_MKIMAGE_SIGN_ARGS"],
Signature · 1 line
2.47.3
#1 lore raw
Quoted 10 lines · Richard Leitner via lists.openembedded.org

Introduce a configuration variable named FIT_CONF_STRIP_EXT which removes the file-type extension from the configuration node name.

This feature enables us to give configuration nodes arbritary names (based on the dtb file names). This is in my case needed to ensure consistent configuration names which where previously (walnascar) generated using a fitimage_emit_section_config:append() function.

---

Hi Richard,

Thanks for your patch.

It looks like this is making some selftest fail:

2026-01-08 18:18:47,312 - oe-selftest - INFO - fitimage.FitImagePyTests.test_fitimage_py_conf_extra_mappings_unused_error (subunit.RemotedTestCase)
2026-01-08 18:18:47,313 - oe-selftest - INFO -  ... ERROR
...
2026-01-08 18:18:47,313 - 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 1257, in test_fitimage_py_conf_extra_mappings_unused_error
    self._test_fitimage_py(bb_vars_overrides)
  File "/srv/pokybuild/yocto-worker/oe-selftest-debian/build/layers/openembedded-core/meta/lib/oeqa/selftest/cases/fitimage.py", line 1203, in _test_fitimage_py
    root_node.fitimage_emit_section_config(bb_vars['FIT_CONF_DEFAULT_DTB'], bb_vars.get('FIT_CONF_MAPPINGS'))
  File "/srv/pokybuild/yocto-worker/oe-selftest-debian/build/layers/openembedded-core/meta/lib/oe/fitimage.py", line 498, in fitimage_emit_section_config
    default_conf = self.configurations.sub_nodes[0].name
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^

IndexError: list index out of range

...

2026-01-08 18:18:47,317 - oe-selftest - INFO - fitimage.FitImagePyTests.test_fitimage_py_conf_mappings (subunit.RemotedTestCase)
2026-01-08 18:18:47,317 - oe-selftest - INFO -  ... ERROR
...
2026-01-08 18:18:47,322 - oe-selftest - INFO - fitimage.FitImagePyTests.test_fitimage_py_conf_mappings_unused_error (subunit.RemotedTestCase)
2026-01-08 18:18:47,322 - oe-selftest - INFO -  ... ERROR
...
2026-01-08 18:18:47,327 - oe-selftest - INFO - fitimage.FitImagePyTests.test_fitimage_py_conf_mappings_with_alias (subunit.RemotedTestCase)
2026-01-08 18:18:47,327 - oe-selftest - INFO -  ... ERROR
...
2026-01-08 18:18:47,338 - oe-selftest - INFO - fitimage.FitImagePyTests.test_fitimage_py_default_dtb (subunit.RemotedTestCase)
2026-01-08 18:18:47,339 - oe-selftest - INFO -  ... ERROR

I did not copy all the errors, as they are all similar to the first one.

https://autobuilder.yoctoproject.org/valkyrie/#/builders/35/builds/2989
https://autobuilder.yoctoproject.org/valkyrie/#/builders/48/builds/2880
https://autobuilder.yoctoproject.org/valkyrie/#/builders/23/builds/3127

Can you have a look at these issues?

Note, I had merge conflicts on your patch, so maybe my resolution was incorrect. If that's the case, can you rebase on master before sending the new version?

Thanks,
Mathieu

Signature · 3 lines
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

Hi Mathieu,

thanks for your reply!

Quoted 44 lines · Mathieu Dubois-Briand
Quoted 10 lines · Richard Leitner via lists.openembedded.org

Introduce a configuration variable named FIT_CONF_STRIP_EXT which removes the file-type extension from the configuration node name.

This feature enables us to give configuration nodes arbritary names (based on the dtb file names). This is in my case needed to ensure consistent configuration names which where previously (walnascar) generated using a fitimage_emit_section_config:append() function.

---

Hi Richard,

Thanks for your patch.

It looks like this is making some selftest fail:

2026-01-08 18:18:47,312 - oe-selftest - INFO - fitimage.FitImagePyTests.test_fitimage_py_conf_extra_mappings_unused_error (subunit.RemotedTestCase)
2026-01-08 18:18:47,313 - oe-selftest - INFO -  ... ERROR
...
2026-01-08 18:18:47,313 - 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 1257, in test_fitimage_py_conf_extra_mappings_unused_error
    self._test_fitimage_py(bb_vars_overrides)
  File "/srv/pokybuild/yocto-worker/oe-selftest-debian/build/layers/openembedded-core/meta/lib/oeqa/selftest/cases/fitimage.py", line 1203, in _test_fitimage_py
    root_node.fitimage_emit_section_config(bb_vars['FIT_CONF_DEFAULT_DTB'], bb_vars.get('FIT_CONF_MAPPINGS'))
  File "/srv/pokybuild/yocto-worker/oe-selftest-debian/build/layers/openembedded-core/meta/lib/oe/fitimage.py", line 498, in fitimage_emit_section_config
    default_conf = self.configurations.sub_nodes[0].name
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^

IndexError: list index out of range

...

2026-01-08 18:18:47,317 - oe-selftest - INFO - fitimage.FitImagePyTests.test_fitimage_py_conf_mappings (subunit.RemotedTestCase)
2026-01-08 18:18:47,317 - oe-selftest - INFO -  ... ERROR
...
2026-01-08 18:18:47,322 - oe-selftest - INFO - fitimage.FitImagePyTests.test_fitimage_py_conf_mappings_unused_error (subunit.RemotedTestCase)
2026-01-08 18:18:47,322 - oe-selftest - INFO -  ... ERROR
...
2026-01-08 18:18:47,327 - oe-selftest - INFO - fitimage.FitImagePyTests.test_fitimage_py_conf_mappings_with_alias (subunit.RemotedTestCase)
2026-01-08 18:18:47,327 - oe-selftest - INFO -  ... ERROR
...
2026-01-08 18:18:47,338 - oe-selftest - INFO - fitimage.FitImagePyTests.test_fitimage_py_default_dtb (subunit.RemotedTestCase)
2026-01-08 18:18:47,339 - oe-selftest - INFO -  ... ERROR
Quoted 7 lines

I did not copy all the errors, as they are all similar to the first one.

https://autobuilder.yoctoproject.org/valkyrie/#/builders/35/builds/2989
https://autobuilder.yoctoproject.org/valkyrie/#/builders/48/builds/2880
https://autobuilder.yoctoproject.org/valkyrie/#/builders/23/builds/3127

Can you have a look at these issues?

Oh. Sorry. Sure I will have a look at those and send an updated v2.

Quoted 4 lines

Note, I had merge conflicts on your patch, so maybe my resolution was incorrect. If that's the case, can you rebase on master before sending the new version?

Sure. I will rebase on master for v2.

Thanks again for your feedback!

regards;rl

Quoted 9 lines

Thanks,
Mathieu

Signature · 3 lines
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com