Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/3] kernel-fit-image: allow replacing kernel, handle compression in FIT recipe
@ 2026-07-23 12:49 Nora Schiffer
  2026-07-23 12:49 ` [PATCH 1/3] kernel-uboot: move FIT_KERNEL_COMP_ALG to image-fitimage.conf Nora Schiffer
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Nora Schiffer @ 2026-07-23 12:49 UTC (permalink / raw)
  To: openembedded-core; +Cc: oss, Nora Schiffer

Add support for building alternative kernel images into a FIT image instead of
using linux.bin. An incomplete solution with a similar goal was added in in
commit 9c8ef2119949 ("kernel-fit-image: control kernel section with
FIT_LINUX_BIN") and subsequently reverted in commit 6eae261b6f52 ("Revert
"kernel-fit-image: control kernel section with FIT_LINUX_BIN"") due to missing
features, lack of tests and the submitter having abandoned their approach.

With the new approach, compression is now either handled as part of the
FIT image (KERNEL_FILENAME) or the image is considered to be compressed already
(KERNEL_FILENAME_COMPRESSED). The option to let the kernel recipe do the
compression and store the result in the image deploydir as linux.bin is
preserved for backwards compatibility, but will result in a deprecation warning.

Our main use case for this is to support building a FIT image with an EFI
application as kernel (with FIT_OS = "efi").

Nora Schiffer (3):
  kernel-uboot: move FIT_KERNEL_COMP_ALG to image-fitimage.conf
  kernel-fit-image: reintroduce option to replace kernel image
  kernel-fit-extra-artifacts: skip building linux.bin if unneeded

 .../kernel-fit-extra-artifacts.bbclass        |  4 +-
 meta/classes-recipe/kernel-fit-image.bbclass  | 53 ++++++++--
 meta/classes-recipe/kernel-uboot.bbclass      |  3 +-
 meta/conf/image-fitimage.conf                 | 27 +++++-
 meta/lib/oeqa/selftest/cases/fitimage.py      | 97 ++++++++++++++++++-
 5 files changed, 167 insertions(+), 17 deletions(-)

-- 
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
https://www.tq-group.com/


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/3] kernel-uboot: move FIT_KERNEL_COMP_ALG to image-fitimage.conf
  2026-07-23 12:49 [PATCH 0/3] kernel-fit-image: allow replacing kernel, handle compression in FIT recipe Nora Schiffer
@ 2026-07-23 12:49 ` Nora Schiffer
  2026-07-23 12:49 ` [PATCH 2/3] kernel-fit-image: reintroduce option to replace kernel image Nora Schiffer
  2026-07-23 12:49 ` [PATCH 3/3] kernel-fit-extra-artifacts: skip building linux.bin if unneeded Nora Schiffer
  2 siblings, 0 replies; 8+ messages in thread
From: Nora Schiffer @ 2026-07-23 12:49 UTC (permalink / raw)
  To: openembedded-core; +Cc: oss, Nora Schiffer

Move the default setting to the config with the other FIT_* variables.

It is a bit weird that FIT_KERNEL_COMP_ALG also affects uImage creation,
as kernel-uboot.bbclass is used for both, but fixing that would
unnecessarily break backwards compatibility.

Signed-off-by: Nora Schiffer <nora.schiffer@ew.tq-group.com>
---
 meta/classes-recipe/kernel-uboot.bbclass | 3 +--
 meta/conf/image-fitimage.conf            | 3 +++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/meta/classes-recipe/kernel-uboot.bbclass b/meta/classes-recipe/kernel-uboot.bbclass
index fa28be1715..9beccc2dff 100644
--- a/meta/classes-recipe/kernel-uboot.bbclass
+++ b/meta/classes-recipe/kernel-uboot.bbclass
@@ -4,8 +4,7 @@
 # SPDX-License-Identifier: MIT
 #
 
-# fitImage kernel compression algorithm
-FIT_KERNEL_COMP_ALG ?= "gzip"
+require conf/image-fitimage.conf
 
 # Kernel image type passed to mkimage (i.e. kernel kernel_noload...)
 UBOOT_MKIMAGE_KERNEL_TYPE ?= "kernel"
diff --git a/meta/conf/image-fitimage.conf b/meta/conf/image-fitimage.conf
index a06d30e494..abb17186a5 100644
--- a/meta/conf/image-fitimage.conf
+++ b/meta/conf/image-fitimage.conf
@@ -48,6 +48,9 @@ FIT_OS ?= "linux"
 # DTBs are provided separately in a FIT image.
 FIT_LINUX_BIN ?= "linux.bin"
 
+# fitImage kernel compression algorithm
+FIT_KERNEL_COMP_ALG ?= "gzip"
+
 # Additional mkimage options for FIT image creation
 FIT_MKIMAGE_EXTRA_OPTS ?= ""
 
-- 
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
https://www.tq-group.com/



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/3] kernel-fit-image: reintroduce option to replace kernel image
  2026-07-23 12:49 [PATCH 0/3] kernel-fit-image: allow replacing kernel, handle compression in FIT recipe Nora Schiffer
  2026-07-23 12:49 ` [PATCH 1/3] kernel-uboot: move FIT_KERNEL_COMP_ALG to image-fitimage.conf Nora Schiffer
@ 2026-07-23 12:49 ` Nora Schiffer
  2026-07-25 13:02   ` [OE-core] " Mathieu Dubois-Briand
  2026-07-23 12:49 ` [PATCH 3/3] kernel-fit-extra-artifacts: skip building linux.bin if unneeded Nora Schiffer
  2 siblings, 1 reply; 8+ messages in thread
From: Nora Schiffer @ 2026-07-23 12:49 UTC (permalink / raw)
  To: openembedded-core; +Cc: oss, Nora Schiffer

A similar feature was added in commit 9c8ef2119949 ("kernel-fit-image:
control kernel section with FIT_LINUX_BIN") and subsequently reverted in
commit 6eae261b6f52 ("Revert "kernel-fit-image: control kernel section
with FIT_LINUX_BIN"") due to its incomplete implementation and lack of
tests. Reintroduce an improved version:

- The FIT_LINUX_BIN variable (which had been left unused) is renamed to
  FIT_KERNEL_FILENAME. It can now actually be used to select a different
  file from DEPLOY_DIR_IMAGE. The file will be compressed using
  FIT_KERNEL_COMP_ALG as part of the FIT image recipe, rather than than
  letting the kernel recipe handle this through
  kernel-fit-extra-artifacts.bbclass.
- Alternatively, FIT_KERNEL_FILENAME_COMPRESSED can be used to select a
  pre-compressed file from DEPLOY_DIR_IMAGE. In this case,
  FIT_KERNEL_COMP_ALG only controls the "compression" field of the
  generated FIT image.
- To preserve backwards compatibility, FIT_KERNEL_FILENAME_COMPRESSED
  defaults to "linux.bin". As a special case, the compression algorithm
  will be read from "linux_comp" for linux.bin. This behavior is
  considered deprecated and relying on it results in a warning.
- Add tests.

To resolve the new deprecation warning, it is usually sufficient to set
KERNEL_IMAGETYPE to the desired type ("Image" on many archs) and set
FIT_KERNEL_FILENAME to the same value.

Signed-off-by: Nora Schiffer <nora.schiffer@ew.tq-group.com>
---
 meta/classes-recipe/kernel-fit-image.bbclass | 53 +++++++++--
 meta/conf/image-fitimage.conf                | 24 ++++-
 meta/lib/oeqa/selftest/cases/fitimage.py     | 97 +++++++++++++++++++-
 3 files changed, 160 insertions(+), 14 deletions(-)

diff --git a/meta/classes-recipe/kernel-fit-image.bbclass b/meta/classes-recipe/kernel-fit-image.bbclass
index 3ace09ef5c..4ace6871f8 100644
--- a/meta/classes-recipe/kernel-fit-image.bbclass
+++ b/meta/classes-recipe/kernel-fit-image.bbclass
@@ -64,6 +64,7 @@ def apply_dtbvendored(d,dtb):
 
 python do_compile() {
     import shutil
+    import subprocess
     import oe.fitimage
 
     itsfile = "fit-image.its"
@@ -88,12 +89,52 @@ python do_compile() {
     )
 
     # Prepare a kernel image section.
-    shutil.copyfile(os.path.join(kernel_deploydir, "linux.bin"), "linux.bin")
-    with open(os.path.join(kernel_deploydir, "linux_comp")) as linux_comp_f:
-        linux_comp = linux_comp_f.read()
-    root_node.fitimage_emit_section_kernel("kernel-1", "linux.bin", linux_comp,
-        d.getVar('UBOOT_LOADADDRESS'), d.getVar('UBOOT_ENTRYPOINT'),
-        d.getVar('UBOOT_MKIMAGE_KERNEL_TYPE'), d.getVar("UBOOT_ENTRYSYMBOL"))
+    kernel = d.getVar('FIT_KERNEL_FILENAME')
+    kernel_compressed = d.getVar('FIT_KERNEL_FILENAME_COMPRESSED')
+    kernel_comp_alg = d.getVar('FIT_KERNEL_COMP_ALG')
+
+    COMP_ALGS = {
+        'gzip': ['gzip', '-9', '--stdout'],
+        'lzo': ['lzop', '-9', '--stdout'],
+        'lzma': ['xz', '--format=lzma', '-f', '-6', '--stdout'],
+    }
+
+    if kernel and kernel_comp_alg == 'none':
+        kernel_compressed = kernel
+        kernel = None
+    elif not kernel and kernel_compressed == 'linux.bin':
+        # Backwards compatibility
+        bb.warn('FIT_KERNEL_FILENAME_COMPRESSED = "linux.bin" is deprecated. Set FIT_KERNEL_FILENAME or FIT_KERNEL_FILENAME_COMPRESSED explicitly.')
+        with open(os.path.join(kernel_deploydir, "linux_comp")) as linux_comp_f:
+            kernel_comp_alg = linux_comp_f.read()
+
+    if kernel:
+        kernel_path = os.path.join(kernel_deploydir, kernel)
+        kernel_name = os.path.basename(kernel) + '.compressed'
+
+        try:
+            cmd = COMP_ALGS[kernel_comp_alg] + [kernel_path]
+        except KeyError:
+            bb.fatal(f"Unknown algorithm {kernel_comp_alg} in FIT_KERNEL_COMP_ALG.")
+
+        with open(kernel_name, 'wb') as f:
+            try:
+                subprocess.run(cmd, check=True, stdout=f, stderr=subprocess.PIPE)
+            except subprocess.CalledProcessError as e:
+                bb.fatal(f"Command '{' '.join(cmd)}' failed with return code {e.returncode}\nstderr: {e.stderr.decode()}")
+
+    elif kernel_compressed:
+        kernel_path = os.path.join(kernel_deploydir, kernel_compressed)
+        kernel_name = os.path.basename(kernel_compressed)
+        shutil.copyfile(kernel_path, kernel_name)
+
+    # FIT_KERNEL_FILENAME or FIT_KERNEL_FILENAME_COMPRESSED was set
+    if kernel_name:
+        root_node.fitimage_emit_section_kernel("kernel-1", kernel_name, kernel_comp_alg,
+                                               d.getVar('UBOOT_LOADADDRESS'),
+                                               d.getVar('UBOOT_ENTRYPOINT'),
+                                               d.getVar('UBOOT_MKIMAGE_KERNEL_TYPE'),
+                                               d.getVar("UBOOT_ENTRYSYMBOL"))
 
     # Prepare a DTB image section
     kernel_devicetree = d.getVar('KERNEL_DEVICETREE')
diff --git a/meta/conf/image-fitimage.conf b/meta/conf/image-fitimage.conf
index abb17186a5..f7b1ffdfd5 100644
--- a/meta/conf/image-fitimage.conf
+++ b/meta/conf/image-fitimage.conf
@@ -41,12 +41,28 @@ FIT_SUPPORTED_INITRAMFS_FSTYPES ?= "cpio.lz4 cpio.lzo cpio.lzma cpio.xz cpio.zst
 # to load a kernel with EFI stub as an EFI application.
 FIT_OS ?= "linux"
 
-# Allow user to support special use cases where the kernel binary is
-# not included in the FIT image itself.
+# Select the binary included as kernel image in the FIT image.
+# This allows the user to support special use cases where the kernel binary is
+# not included in the FIT image itself or a different image is used as kernel.
 # This is particularly useful for UKI-based setups, where the kernel
 # and initramfs are bundled into a Unified Kernel Image (UKI), and
-# DTBs are provided separately in a FIT image.
-FIT_LINUX_BIN ?= "linux.bin"
+# DTBs are provided separately in a FIT image, as well as providing the option
+# to include an EFI application as the kernel.
+#
+# Will be compressed using FIT_KERNEL_COMP_ALG. See also
+# FIT_KERNEL_FILENAME_COMPRESSED.
+FIT_KERNEL_FILENAME ?= ""
+
+# Precompressed kernel image. FIT_KERNEL_COMP_ALG is used to fill the
+# "compression" property in the FIT image, so it must match the used
+# compression algorithm. As a special case, if FIT_KERNEL_FILENAME_COMPRESSED
+# is set to "linux.bin", the compression algorithm is read from the "linux_comp"
+# file instead for backwards compatiblity; this behavior is deprecated.
+#
+# If both FIT_KERNEL_FILENAME and FIT_KERNEL_FILENAME_COMPRESSED are set,
+# FIT_KERNEL_FILENAME takes precedence. Unset both to generate a FIT image
+# without kernel section.
+FIT_KERNEL_FILENAME_COMPRESSED ?= "linux.bin"
 
 # fitImage kernel compression algorithm
 FIT_KERNEL_COMP_ALG ?= "gzip"
diff --git a/meta/lib/oeqa/selftest/cases/fitimage.py b/meta/lib/oeqa/selftest/cases/fitimage.py
index 451878aafd..7b699f4b1a 100644
--- a/meta/lib/oeqa/selftest/cases/fitimage.py
+++ b/meta/lib/oeqa/selftest/cases/fitimage.py
@@ -677,6 +677,8 @@ class KernelFitImageBase(FitImageTestCase):
             'FIT_DESC',
             'FIT_HASH_ALG',
             'FIT_KERNEL_COMP_ALG',
+            'FIT_KERNEL_FILENAME',
+            'FIT_KERNEL_FILENAME_COMPRESSED',
             'FIT_LOADABLES',
             'FIT_LOADABLE_ENTRYPOINT',
             'FIT_LOADABLE_LOADADDRESS',
@@ -909,17 +911,39 @@ class KernelFitImageBase(FitImageTestCase):
         uboot_rd_loadaddress = bb_vars.get('UBOOT_RD_LOADADDRESS')
         uboot_rd_entrypoint = bb_vars.get('UBOOT_RD_ENTRYPOINT')
 
+        kernel_filename = bb_vars.get('FIT_KERNEL_FILENAME')
+        kernel_filename_compressed = bb_vars.get('FIT_KERNEL_FILENAME_COMPRESSED')
+        kernel_comp_alg = bb_vars['FIT_KERNEL_COMP_ALG']
+
+        if kernel_filename:
+            kernel_name = os.path.basename(kernel_filename)
+            if kernel_comp_alg != 'none':
+                kernel_name += '.compressed'
+        elif kernel_filename_compressed:
+            kernel_name = os.path.basename(kernel_filename_compressed)
+
         its_field_check = [
             'description = "%s";' % bb_vars['FIT_DESC'],
             'description = "Linux kernel";',
             'type = "' + str(bb_vars['UBOOT_MKIMAGE_KERNEL_TYPE']) + '";',
-            # 'compression = "' + str(bb_vars['FIT_KERNEL_COMP_ALG']) + '";', defined based on files in TMPDIR, not ideal...
-            'data = /incbin/("linux.bin");',
+        ]
+
+        # Compression test skipped for deprecated linux.bin handling, as that
+        # would be based on files in TMPDIR
+        if kernel_filename or kernel_filename_compressed != 'linux.bin':
+            its_field_check.append('compression = "%s";' % kernel_comp_alg)
+
+        if kernel_name:
+            its_field_check.append('data = /incbin/("%s");' % kernel_name)
+
+        # Field order of its_field_check and the generated ITS must match
+        its_field_check += [
             'arch = "' + str(bb_vars['UBOOT_ARCH']) + '";',
             'os = "%s";' % bb_vars['FIT_OS'],
             'load = <' + str(bb_vars['UBOOT_LOADADDRESS']) + '>;',
             'entry = <' + str(bb_vars['UBOOT_ENTRYPOINT']) + '>;',
         ]
+
         if initramfs_image and initramfs_image_bundle != "1":
             its_field_check.append('type = "ramdisk";')
             if uboot_rd_loadaddress:
@@ -1272,6 +1296,24 @@ PREFERRED_PROVIDER_virtual/dtb = "test-dtbs-as-ext"
         self._gen_atf_tee_dummy_images(bb_vars)
         self._test_fitimage(bb_vars)
 
+    def test_fit_image_kernel_filename(self):
+        """
+        Summary:     Check if FIT image and Image Tree Source (its) are built
+                     and the Image Tree Source has the correct fields.
+        Expected:    1. fitImage and Image Tree Source can be built
+                     2. Filename and compression are as expected in the ITS
+                     3. Filename is as expected in the fitImage
+        """
+        config = """
+KERNEL_IMAGETYPE = "bzImage"
+FIT_KERNEL_FILENAME = "bzImage"
+FIT_KERNEL_COMP_ALG = "none"
+"""
+        config = self._config_add_kernel_classes(config)
+        self.write_config(config)
+        bb_vars = self._fit_get_bb_vars()
+        self._test_fitimage(bb_vars)
+
 
     def test_sign_fit_image_configurations(self):
         """
@@ -1506,11 +1548,12 @@ class FitImagePyTests(KernelFitImageBase):
             'FIT_DESC': "Kernel fitImage for a dummy distro",
             'FIT_GENERATE_KEYS': "0",
             'FIT_HASH_ALG': "sha256",
+            'FIT_KERNEL_COMP_ALG': "gzip",
+            'FIT_KERNEL_FILENAME_COMPRESSED': "linux.bin",
             'FIT_KEY_GENRSA_ARGS': "-F4",
             'FIT_KEY_REQ_ARGS': "-batch -new",
             'FIT_KEY_SIGN_PKCS': "-x509",
             'FIT_LOADABLES': "",
-            'FIT_LINUX_BIN': "linux.bin",
             'FIT_OS': "linux",
             'FIT_PAD_ALG': "pkcs-1.5",
             'FIT_SIGN_ALG': "rsa2048",
@@ -1549,6 +1592,19 @@ class FitImagePyTests(KernelFitImageBase):
                 debug_output = "\n".join([f"{key} = {value}" for key, value in bb_vars_overrides.items()])
                 self.logger.debug("bb_vars overrides:\n%s" % debug_output)
 
+        kernel = bb_vars.get('FIT_KERNEL_FILENAME')
+        kernel_compressed = bb_vars.get('FIT_KERNEL_FILENAME_COMPRESSED')
+        kernel_comp_alg = bb_vars.get('FIT_KERNEL_COMP_ALG')
+
+        if kernel and kernel_comp_alg == 'none':
+            kernel_compressed = kernel
+            kernel = None
+
+        if kernel:
+            kernel_name = os.path.basename(kernel) + '.compressed'
+        elif kernel_compressed:
+            kernel_name = os.path.basename(kernel_compressed)
+
         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_OS'],
@@ -1561,7 +1617,8 @@ class FitImagePyTests(KernelFitImageBase):
             oe.types.boolean(bb_vars['FIT_SIGN_INDIVIDUAL']), bb_vars['UBOOT_SIGN_IMG_KEYNAME']
         )
 
-        root_node.fitimage_emit_section_kernel("kernel-1", "linux.bin", "none",
+        root_node.fitimage_emit_section_kernel("kernel-1",
+            kernel_name, kernel_comp_alg,
             bb_vars.get('UBOOT_LOADADDRESS'), bb_vars.get('UBOOT_ENTRYPOINT'),
             bb_vars.get('UBOOT_MKIMAGE_KERNEL_TYPE'), bb_vars.get("UBOOT_ENTRYSYMBOL")
         )
@@ -1651,6 +1708,38 @@ class FitImagePyTests(KernelFitImageBase):
         with self.assertRaises(BBHandledException):
             self._test_fitimage_py(bb_vars_overrides)
 
+    def test_fitimage_py_conf_kernel_filename_compression(self):
+        """Test FIT_KERNEL_FILENAME and FIT_KERNEL_COMP_ALG functionality"""
+        bb_vars_overrides = {
+            'FIT_KERNEL_FILENAME': "path/to/my/Image",
+            'FIT_KERNEL_COMP_ALG': "gzip",
+        }
+        self._test_fitimage_py(bb_vars_overrides)
+
+    def test_fitimage_py_conf_kernel_filename_compression_none(self):
+        """Test FIT_KERNEL_FILENAME and FIT_KERNEL_COMP_ALG functionality"""
+        bb_vars_overrides = {
+            'FIT_KERNEL_FILENAME': "path/to/my/Image",
+            'FIT_KERNEL_COMP_ALG': "none",
+        }
+        self._test_fitimage_py(bb_vars_overrides)
+
+    def test_fitimage_py_conf_kernel_filename_compressed(self):
+        """Test FIT_KERNEL_FILENAME_COMPRESSED functionality"""
+        bb_vars_overrides = {
+            'FIT_KERNEL_FILENAME_COMPRESSED': "path/to/my/Image",
+            'FIT_KERNEL_COMP_ALG': "gzip",
+        }
+        self._test_fitimage_py(bb_vars_overrides)
+
+    def test_fitimage_py_conf_kernel_filename_compressed_none(self):
+        """Test FIT_KERNEL_FILENAME_COMPRESSED functionality"""
+        bb_vars_overrides = {
+            'FIT_KERNEL_FILENAME_COMPRESSED': "path/to/my/Image",
+            'FIT_KERNEL_COMP_ALG': "none",
+        }
+        self._test_fitimage_py(bb_vars_overrides)
+
     def test_fitimage_py_conf_loadables(self):
         """Test FIT_LOADABLES basic functionality"""
         bb_vars_overrides = {
-- 
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
https://www.tq-group.com/



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/3] kernel-fit-extra-artifacts: skip building linux.bin if unneeded
  2026-07-23 12:49 [PATCH 0/3] kernel-fit-image: allow replacing kernel, handle compression in FIT recipe Nora Schiffer
  2026-07-23 12:49 ` [PATCH 1/3] kernel-uboot: move FIT_KERNEL_COMP_ALG to image-fitimage.conf Nora Schiffer
  2026-07-23 12:49 ` [PATCH 2/3] kernel-fit-image: reintroduce option to replace kernel image Nora Schiffer
@ 2026-07-23 12:49 ` Nora Schiffer
  2 siblings, 0 replies; 8+ messages in thread
From: Nora Schiffer @ 2026-07-23 12:49 UTC (permalink / raw)
  To: openembedded-core; +Cc: oss, Nora Schiffer

With the introduction of FIT_KERNEL_FILENAME[_COMPRESSED], building
linux.bin can be skipped if any of the two variables is set to a
non-default value, as kernel-fit-image.bbclass will handle the
compression itself.

Signed-off-by: Nora Schiffer <nora.schiffer@ew.tq-group.com>
---
 meta/classes-recipe/kernel-fit-extra-artifacts.bbclass | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/meta/classes-recipe/kernel-fit-extra-artifacts.bbclass b/meta/classes-recipe/kernel-fit-extra-artifacts.bbclass
index 385fe9895a..02e7d1273f 100644
--- a/meta/classes-recipe/kernel-fit-extra-artifacts.bbclass
+++ b/meta/classes-recipe/kernel-fit-extra-artifacts.bbclass
@@ -11,7 +11,9 @@ inherit kernel-uboot
 
 kernel_do_deploy:append() {
 	# Provide the kernel artifacts to post processing recipes e.g. for creating a FIT image
-	uboot_prep_kimage "$deployDir"
+	if [ -z "${FIT_KERNEL_FILENAME}" ] && [ "${FIT_KERNEL_FILENAME_COMPRESSED}" = 'linux.bin' ]; then
+		uboot_prep_kimage "$deployDir"
+	fi
 	# For x86 a setup.bin needs to be include"d in a fitImage as well
 	if [ -e ${KERNEL_OUTPUT_DIR}/setup.bin ]; then
 		install -D "${B}/${KERNEL_OUTPUT_DIR}/setup.bin" "$deployDir/"
-- 
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
https://www.tq-group.com/



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [OE-core] [PATCH 2/3] kernel-fit-image: reintroduce option to replace kernel image
  2026-07-23 12:49 ` [PATCH 2/3] kernel-fit-image: reintroduce option to replace kernel image Nora Schiffer
@ 2026-07-25 13:02   ` Mathieu Dubois-Briand
  2026-07-27  8:03     ` Nora Schiffer
  0 siblings, 1 reply; 8+ messages in thread
From: Mathieu Dubois-Briand @ 2026-07-25 13:02 UTC (permalink / raw)
  To: nora.schiffer, openembedded-core; +Cc: oss

On Thu Jul 23, 2026 at 2:49 PM CEST, Nora Schiffer via lists.openembedded.org wrote:
> A similar feature was added in commit 9c8ef2119949 ("kernel-fit-image:
> control kernel section with FIT_LINUX_BIN") and subsequently reverted in
> commit 6eae261b6f52 ("Revert "kernel-fit-image: control kernel section
> with FIT_LINUX_BIN"") due to its incomplete implementation and lack of
> tests. Reintroduce an improved version:
>
> - The FIT_LINUX_BIN variable (which had been left unused) is renamed to
>   FIT_KERNEL_FILENAME. It can now actually be used to select a different
>   file from DEPLOY_DIR_IMAGE. The file will be compressed using
>   FIT_KERNEL_COMP_ALG as part of the FIT image recipe, rather than than
>   letting the kernel recipe handle this through
>   kernel-fit-extra-artifacts.bbclass.
> - Alternatively, FIT_KERNEL_FILENAME_COMPRESSED can be used to select a
>   pre-compressed file from DEPLOY_DIR_IMAGE. In this case,
>   FIT_KERNEL_COMP_ALG only controls the "compression" field of the
>   generated FIT image.
> - To preserve backwards compatibility, FIT_KERNEL_FILENAME_COMPRESSED
>   defaults to "linux.bin". As a special case, the compression algorithm
>   will be read from "linux_comp" for linux.bin. This behavior is
>   considered deprecated and relying on it results in a warning.
> - Add tests.
>
> To resolve the new deprecation warning, it is usually sufficient to set
> KERNEL_IMAGETYPE to the desired type ("Image" on many archs) and set
> FIT_KERNEL_FILENAME to the same value.
>
> Signed-off-by: Nora Schiffer <nora.schiffer@ew.tq-group.com>
> ---

Hi Nora,

Thanks for your patch.

It looks like the test_fit_image_kernel_filename selftest is failing on
arm hosts:

2026-07-24 21:31:27,684 - oe-selftest - INFO - fitimage.KernelFitImageRecipeTests.test_fit_image_kernel_filename (subunit.RemotedTestCase)
2026-07-24 21:31:27,685 - oe-selftest - INFO -  ... FAIL
...
ERROR: linux-yocto-fitimage-1.0-r0 do_compile: Error executing a python function in exec_func_python() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
     0001:
 *** 0002:do_compile(d)
     0003:
File: '/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/layers/openembedded-core/meta/classes-recipe/kernel-fit-image.bbclass', lineno: 129, function: do_compile
     0125:
     0126:    elif kernel_compressed:
     0127:        kernel_path = os.path.join(kernel_deploydir, kernel_compressed)
     0128:        kernel_name = os.path.basename(kernel_compressed)
 *** 0129:        shutil.copyfile(kernel_path, kernel_name)
     0130:
     0131:    # FIT_KERNEL_FILENAME or FIT_KERNEL_FILENAME_COMPRESSED was set
     0132:    if kernel_name:
     0133:        root_node.fitimage_emit_section_kernel("kernel-1", kernel_name, kernel_comp_alg,
File: '/usr/lib/python3.14/shutil.py', lineno: 313, function: copyfile
     0309:
     0310:    if not follow_symlinks and _islink(src):
     0311:        os.symlink(os.readlink(src), dst)
     0312:    else:
 *** 0313:        with open(src, 'rb') as fsrc:
     0314:            try:
     0315:                with open(dst, 'wb') as fdst:
     0316:                    # macOS
     0317:                    if _HAS_FCOPYFILE:
Exception: FileNotFoundError: [Errno 2] No such file or directory: '/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/build-st-1142023/tmp/deploy/images/qemuarm64/bzImage'

https://autobuilder.yoctoproject.org/valkyrie/#/builders/23/builds/4420

Can you have a look at the issue?

Thanks,
Mathieu

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



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [OE-core] [PATCH 2/3] kernel-fit-image: reintroduce option to replace kernel image
  2026-07-25 13:02   ` [OE-core] " Mathieu Dubois-Briand
@ 2026-07-27  8:03     ` Nora Schiffer
  2026-07-27  8:11       ` Yoann Congal
  2026-07-27  8:33       ` Mathieu Dubois-Briand
  0 siblings, 2 replies; 8+ messages in thread
From: Nora Schiffer @ 2026-07-27  8:03 UTC (permalink / raw)
  To: Mathieu Dubois-Briand; +Cc: oss, openembedded-core

On Sat, 2026-07-25 at 15:02 +0200, Mathieu Dubois-Briand wrote:
> On Thu Jul 23, 2026 at 2:49 PM CEST, Nora Schiffer via lists.openembedded.org wrote:
> > A similar feature was added in commit 9c8ef2119949 ("kernel-fit-image:
> > control kernel section with FIT_LINUX_BIN") and subsequently reverted in
> > commit 6eae261b6f52 ("Revert "kernel-fit-image: control kernel section
> > with FIT_LINUX_BIN"") due to its incomplete implementation and lack of
> > tests. Reintroduce an improved version:
> > 
> > - The FIT_LINUX_BIN variable (which had been left unused) is renamed to
> >   FIT_KERNEL_FILENAME. It can now actually be used to select a different
> >   file from DEPLOY_DIR_IMAGE. The file will be compressed using
> >   FIT_KERNEL_COMP_ALG as part of the FIT image recipe, rather than than
> >   letting the kernel recipe handle this through
> >   kernel-fit-extra-artifacts.bbclass.
> > - Alternatively, FIT_KERNEL_FILENAME_COMPRESSED can be used to select a
> >   pre-compressed file from DEPLOY_DIR_IMAGE. In this case,
> >   FIT_KERNEL_COMP_ALG only controls the "compression" field of the
> >   generated FIT image.
> > - To preserve backwards compatibility, FIT_KERNEL_FILENAME_COMPRESSED
> >   defaults to "linux.bin". As a special case, the compression algorithm
> >   will be read from "linux_comp" for linux.bin. This behavior is
> >   considered deprecated and relying on it results in a warning.
> > - Add tests.
> > 
> > To resolve the new deprecation warning, it is usually sufficient to set
> > KERNEL_IMAGETYPE to the desired type ("Image" on many archs) and set
> > FIT_KERNEL_FILENAME to the same value.
> > 
> > Signed-off-by: Nora Schiffer <nora.schiffer@ew.tq-group.com>
> > ---
> 
> Hi Nora,
> 
> Thanks for your patch.
> 
> It looks like the test_fit_image_kernel_filename selftest is failing on
> arm hosts:

Hi Mathieu,

I believe I know how to fix this, but it is unclear to me what exact
configuration is built here. Is there any way I can replicate the same
autobuilder configuration, so I can run the tests myself before submitting v2?

Best,
Nora



> 
> 2026-07-24 21:31:27,684 - oe-selftest - INFO - fitimage.KernelFitImageRecipeTests.test_fit_image_kernel_filename (subunit.RemotedTestCase)
> 2026-07-24 21:31:27,685 - oe-selftest - INFO -  ... FAIL
> ...
> ERROR: linux-yocto-fitimage-1.0-r0 do_compile: Error executing a python function in exec_func_python() autogenerated:
> 
> The stack trace of python calls that resulted in this exception/failure was:
> File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
>      0001:
>  *** 0002:do_compile(d)
>      0003:
> File: '/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/layers/openembedded-core/meta/classes-recipe/kernel-fit-image.bbclass', lineno: 129, function: do_compile
>      0125:
>      0126:    elif kernel_compressed:
>      0127:        kernel_path = os.path.join(kernel_deploydir, kernel_compressed)
>      0128:        kernel_name = os.path.basename(kernel_compressed)
>  *** 0129:        shutil.copyfile(kernel_path, kernel_name)
>      0130:
>      0131:    # FIT_KERNEL_FILENAME or FIT_KERNEL_FILENAME_COMPRESSED was set
>      0132:    if kernel_name:
>      0133:        root_node.fitimage_emit_section_kernel("kernel-1", kernel_name, kernel_comp_alg,
> File: '/usr/lib/python3.14/shutil.py', lineno: 313, function: copyfile
>      0309:
>      0310:    if not follow_symlinks and _islink(src):
>      0311:        os.symlink(os.readlink(src), dst)
>      0312:    else:
>  *** 0313:        with open(src, 'rb') as fsrc:
>      0314:            try:
>      0315:                with open(dst, 'wb') as fdst:
>      0316:                    # macOS
>      0317:                    if _HAS_FCOPYFILE:
> Exception: FileNotFoundError: [Errno 2] No such file or directory: '/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/build-st-1142023/tmp/deploy/images/qemuarm64/bzImage'
> 
> https://autobuilder.yoctoproject.org/valkyrie/#/builders/23/builds/4420
> 
> Can you have a look at the issue?
> 
> Thanks,
> Mathieu
> 

-- 
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
https://www.tq-group.com/


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [OE-core] [PATCH 2/3] kernel-fit-image: reintroduce option to replace kernel image
  2026-07-27  8:03     ` Nora Schiffer
@ 2026-07-27  8:11       ` Yoann Congal
  2026-07-27  8:33       ` Mathieu Dubois-Briand
  1 sibling, 0 replies; 8+ messages in thread
From: Yoann Congal @ 2026-07-27  8:11 UTC (permalink / raw)
  To: nora.schiffer; +Cc: Mathieu Dubois-Briand, oss, openembedded-core

[-- Attachment #1: Type: text/plain, Size: 5429 bytes --]

Le lun. 27 juil. 2026 à 10:03, Nora Schiffer via lists.openembedded.org
<nora.schiffer=ew.tq-group.com@lists.openembedded.org> a écrit :

> On Sat, 2026-07-25 at 15:02 +0200, Mathieu Dubois-Briand wrote:
> > On Thu Jul 23, 2026 at 2:49 PM CEST, Nora Schiffer via
> lists.openembedded.org wrote:
> > > A similar feature was added in commit 9c8ef2119949 ("kernel-fit-image:
> > > control kernel section with FIT_LINUX_BIN") and subsequently reverted
> in
> > > commit 6eae261b6f52 ("Revert "kernel-fit-image: control kernel section
> > > with FIT_LINUX_BIN"") due to its incomplete implementation and lack of
> > > tests. Reintroduce an improved version:
> > >
> > > - The FIT_LINUX_BIN variable (which had been left unused) is renamed to
> > >   FIT_KERNEL_FILENAME. It can now actually be used to select a
> different
> > >   file from DEPLOY_DIR_IMAGE. The file will be compressed using
> > >   FIT_KERNEL_COMP_ALG as part of the FIT image recipe, rather than than
> > >   letting the kernel recipe handle this through
> > >   kernel-fit-extra-artifacts.bbclass.
> > > - Alternatively, FIT_KERNEL_FILENAME_COMPRESSED can be used to select a
> > >   pre-compressed file from DEPLOY_DIR_IMAGE. In this case,
> > >   FIT_KERNEL_COMP_ALG only controls the "compression" field of the
> > >   generated FIT image.
> > > - To preserve backwards compatibility, FIT_KERNEL_FILENAME_COMPRESSED
> > >   defaults to "linux.bin". As a special case, the compression algorithm
> > >   will be read from "linux_comp" for linux.bin. This behavior is
> > >   considered deprecated and relying on it results in a warning.
> > > - Add tests.
> > >
> > > To resolve the new deprecation warning, it is usually sufficient to set
> > > KERNEL_IMAGETYPE to the desired type ("Image" on many archs) and set
> > > FIT_KERNEL_FILENAME to the same value.
> > >
> > > Signed-off-by: Nora Schiffer <nora.schiffer@ew.tq-group.com>
> > > ---
> >
> > Hi Nora,
> >
> > Thanks for your patch.
> >
> > It looks like the test_fit_image_kernel_filename selftest is failing on
> > arm hosts:
>
> Hi Mathieu,
>
> I believe I know how to fix this, but it is unclear to me what exact
> configuration is built here. Is there any way I can replicate the same
> autobuilder configuration, so I can run the tests myself before submitting
> v2?
>

Hello,

You can find the generated config in the "Write Config" step just above the
failing step. In this case:
https://autobuilder.yoctoproject.org/valkyrie/#/builders/23/builds/4420/steps/14/logs/stdio

Regards,


>
> Best,
> Nora
>
>
>
> >
> > 2026-07-24 21:31:27,684 - oe-selftest - INFO -
> fitimage.KernelFitImageRecipeTests.test_fit_image_kernel_filename
> (subunit.RemotedTestCase)
> > 2026-07-24 21:31:27,685 - oe-selftest - INFO -  ... FAIL
> > ...
> > ERROR: linux-yocto-fitimage-1.0-r0 do_compile: Error executing a python
> function in exec_func_python() autogenerated:
> >
> > The stack trace of python calls that resulted in this exception/failure
> was:
> > File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
> >      0001:
> >  *** 0002:do_compile(d)
> >      0003:
> > File:
> '/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/layers/openembedded-core/meta/classes-recipe/kernel-fit-image.bbclass',
> lineno: 129, function: do_compile
> >      0125:
> >      0126:    elif kernel_compressed:
> >      0127:        kernel_path = os.path.join(kernel_deploydir,
> kernel_compressed)
> >      0128:        kernel_name = os.path.basename(kernel_compressed)
> >  *** 0129:        shutil.copyfile(kernel_path, kernel_name)
> >      0130:
> >      0131:    # FIT_KERNEL_FILENAME or FIT_KERNEL_FILENAME_COMPRESSED
> was set
> >      0132:    if kernel_name:
> >      0133:        root_node.fitimage_emit_section_kernel("kernel-1",
> kernel_name, kernel_comp_alg,
> > File: '/usr/lib/python3.14/shutil.py', lineno: 313, function: copyfile
> >      0309:
> >      0310:    if not follow_symlinks and _islink(src):
> >      0311:        os.symlink(os.readlink(src), dst)
> >      0312:    else:
> >  *** 0313:        with open(src, 'rb') as fsrc:
> >      0314:            try:
> >      0315:                with open(dst, 'wb') as fdst:
> >      0316:                    # macOS
> >      0317:                    if _HAS_FCOPYFILE:
> > Exception: FileNotFoundError: [Errno 2] No such file or directory:
> '/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/build-st-1142023/tmp/deploy/images/qemuarm64/bzImage'
> >
> > https://autobuilder.yoctoproject.org/valkyrie/#/builders/23/builds/4420
> >
> > Can you have a look at the issue?
> >
> > Thanks,
> > Mathieu
> >
>
> --
> TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
> Amtsgericht München, HRB 105018
> Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
> https://www.tq-group.com/
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#242059):
> https://lists.openembedded.org/g/openembedded-core/message/242059
> Mute This Topic: https://lists.openembedded.org/mt/120409821/4316185
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> yoann.congal@smile.fr]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>

-- 
Yoann Congal
Smile ECS

[-- Attachment #2: Type: text/html, Size: 7948 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [OE-core] [PATCH 2/3] kernel-fit-image: reintroduce option to replace kernel image
  2026-07-27  8:03     ` Nora Schiffer
  2026-07-27  8:11       ` Yoann Congal
@ 2026-07-27  8:33       ` Mathieu Dubois-Briand
  1 sibling, 0 replies; 8+ messages in thread
From: Mathieu Dubois-Briand @ 2026-07-27  8:33 UTC (permalink / raw)
  To: Nora Schiffer; +Cc: oss, openembedded-core

On Mon Jul 27, 2026 at 10:03 AM CEST, Nora Schiffer wrote:
> On Sat, 2026-07-25 at 15:02 +0200, Mathieu Dubois-Briand wrote:
>> On Thu Jul 23, 2026 at 2:49 PM CEST, Nora Schiffer via lists.openembedded.org wrote:
>> > A similar feature was added in commit 9c8ef2119949 ("kernel-fit-image:
>> > control kernel section with FIT_LINUX_BIN") and subsequently reverted in
>> > commit 6eae261b6f52 ("Revert "kernel-fit-image: control kernel section
>> > with FIT_LINUX_BIN"") due to its incomplete implementation and lack of
>> > tests. Reintroduce an improved version:
>> > 
>> > - The FIT_LINUX_BIN variable (which had been left unused) is renamed to
>> >   FIT_KERNEL_FILENAME. It can now actually be used to select a different
>> >   file from DEPLOY_DIR_IMAGE. The file will be compressed using
>> >   FIT_KERNEL_COMP_ALG as part of the FIT image recipe, rather than than
>> >   letting the kernel recipe handle this through
>> >   kernel-fit-extra-artifacts.bbclass.
>> > - Alternatively, FIT_KERNEL_FILENAME_COMPRESSED can be used to select a
>> >   pre-compressed file from DEPLOY_DIR_IMAGE. In this case,
>> >   FIT_KERNEL_COMP_ALG only controls the "compression" field of the
>> >   generated FIT image.
>> > - To preserve backwards compatibility, FIT_KERNEL_FILENAME_COMPRESSED
>> >   defaults to "linux.bin". As a special case, the compression algorithm
>> >   will be read from "linux_comp" for linux.bin. This behavior is
>> >   considered deprecated and relying on it results in a warning.
>> > - Add tests.
>> > 
>> > To resolve the new deprecation warning, it is usually sufficient to set
>> > KERNEL_IMAGETYPE to the desired type ("Image" on many archs) and set
>> > FIT_KERNEL_FILENAME to the same value.
>> > 
>> > Signed-off-by: Nora Schiffer <nora.schiffer@ew.tq-group.com>
>> > ---
>> 
>> Hi Nora,
>> 
>> Thanks for your patch.
>> 
>> It looks like the test_fit_image_kernel_filename selftest is failing on
>> arm hosts:
>
> Hi Mathieu,
>
> I believe I know how to fix this, but it is unclear to me what exact
> configuration is built here. Is there any way I can replicate the same
> autobuilder configuration, so I can run the tests myself before submitting v2?
>
> Best,
> Nora
>

Hi Nora,

In addition to Yoann reply, keep in mind this is showing on arm host
machine and not on the x86 ones. So it might be a bit tricky to
reproduce.

If you fail to reproduce it locally but want to test some particular
change, please tell me, I can launch a build for that.

Thanks,
Mathieu

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



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-07-27  8:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-23 12:49 [PATCH 0/3] kernel-fit-image: allow replacing kernel, handle compression in FIT recipe Nora Schiffer
2026-07-23 12:49 ` [PATCH 1/3] kernel-uboot: move FIT_KERNEL_COMP_ALG to image-fitimage.conf Nora Schiffer
2026-07-23 12:49 ` [PATCH 2/3] kernel-fit-image: reintroduce option to replace kernel image Nora Schiffer
2026-07-25 13:02   ` [OE-core] " Mathieu Dubois-Briand
2026-07-27  8:03     ` Nora Schiffer
2026-07-27  8:11       ` Yoann Congal
2026-07-27  8:33       ` Mathieu Dubois-Briand
2026-07-23 12:49 ` [PATCH 3/3] kernel-fit-extra-artifacts: skip building linux.bin if unneeded Nora Schiffer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox