kernel-fit-image: optional addresses for kernel_noload, OS override
cover kernel-fit-image: optional addresses for kernel_noload, OS override
These patches are preparation for giving Yocto the ability to create FIT images containing an EFI application as kernel (so U-Boot can give the OS access to its EFI services while preserving other benefits of FIT image boot).
I'm working on a third patch that reintroduces the option to replace the kernel image itself (instead of using linux.bin), but while it is working locally, that one is a bit more complex and I'm inclined to post it as an RFC rather than a final patch once I have given it a bit more polish. I consider these first 2 patches ready and useful on their own.
Nora Schiffer (2):
kernel-fit-image: make kernel entry point and load address optional
kernel-fit-image: introduce FIT_OS variable to override 'os' field
meta/classes-recipe/kernel-fit-image.bbclass | 3 ++- meta/conf/image-fitimage.conf | 4 +++ meta/lib/oe/fitimage.py | 27 ++++++++++++-------- meta/lib/oeqa/selftest/cases/fitimage.py | 13 ++++++++-- 4 files changed, 33 insertions(+), 14 deletions(-)
Signature · 4 lines
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/
PATCH 1/2 kernel-fit-image: make kernel entry point and load address optional
With image type kernel_noload, these are not used, and with [1] and [2], U-Boot will not require them anymore for this image type. Allow omitting them from image generation.
[1] https://source.denx.de/u-boot/u-boot/-/commit/c2abc606653e7eb1e8dbdbaaf1eac392689875ea
[2] https://source.denx.de/u-boot/u-boot/-/commit/c63051237f2bc79838a27473709948408acdf38b
--- meta/lib/oe/fitimage.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
meta/lib/oe/fitimage.py +11 -7
@@ -276,18 +276,22 @@ class ItsNodeRootKernel(ItsNode): if len(parts) == 3 and parts[2] == entrysymbol: entrypoint = "<0x%s>" % parts[0] break + opt_props = { + "data": '/incbin/("' + kernel_path + '")', + "arch": self._arch, + "os": "linux", + } + if load: + opt_props["load"] = f"<{load}>" + if entrypoint: + opt_props["entry"] = f"<{entrypoint}>" + kernel_node = self.its_add_node_image( kernel_id, "Linux kernel", mkimage_kernel_type, compression, - { - "data": '/incbin/("' + kernel_path + '")', - "arch": self._arch, - "os": "linux", - "load": f"<{load}>", - "entry": f"<{entrypoint}>" - } + opt_props, ) self._kernel = kernel_node
Signature · 4 lines
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/
PATCH 2/2 kernel-fit-image: introduce FIT_OS variable to override 'os' field
In reply to Nora SchifferU-Boot can load an EFI application from a FIT image; this requires setting the OS to "efi" (usually in combination with type "kernel_noload"). Doing so is a convenient approach for giving the OS access to EFI services while preserving other benefits of FIT image boot.
--- meta/classes-recipe/kernel-fit-image.bbclass | 3 ++- meta/conf/image-fitimage.conf | 4 ++++ meta/lib/oe/fitimage.py | 11 ++++++----- meta/lib/oeqa/selftest/cases/fitimage.py | 13 +++++++++++-- 4 files changed, 23 insertions(+), 8 deletions(-)
meta/classes-recipe/kernel-fit-image.bbclass +2 -1
@@ -69,7 +69,8 @@ python do_compile() { # Collect all the its nodes before the its file is generated and mkimage gets executed 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"), + d.getVar('HOST_PREFIX'), d.getVar('UBOOT_ARCH'), d.getVar('FIT_OS'), + d.getVar("FIT_CONF_PREFIX"), 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('FIT_MKIMAGE_EXTRA_OPTS'),
meta/conf/image-fitimage.conf +4 -0
@@ -37,6 +37,10 @@ FIT_CONF_PREFIX[doc] = "Prefix to use for FIT configuration node name" FIT_SUPPORTED_INITRAMFS_FSTYPES ?= "cpio.lz4 cpio.lzo cpio.lzma cpio.xz cpio.zst cpio.gz ext2.gz cpio" +# os field of the kernel and various other images in the FIT image. Set to "efi" +# 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. # This is particularly useful for UKI-based setups, where the kernel
meta/lib/oe/fitimage.py +6 -5
@@ -153,7 +153,7 @@ class ItsNodeRootKernel(ItsNode): If a device tree included in the FIT image, the default configuration is the 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, + def __init__(self, description, address_cells, host_prefix, arch, os, conf_prefix, sign_enable=False, sign_keydir=None, mkimage=None, mkimage_dtcopts=None, mkimage_extra_opts=None,
@@ -171,6 +171,7 @@ class ItsNodeRootKernel(ItsNode): self._host_prefix = host_prefix self._arch = arch + self._os = os self._conf_prefix = conf_prefix # Signature related properties
@@ -279,7 +280,7 @@ class ItsNodeRootKernel(ItsNode): opt_props = { "data": '/incbin/("' + kernel_path + '")', "arch": self._arch, - "os": "linux", + "os": self._os, } if load: opt_props["load"] = f"<{load}>"
@@ -370,7 +371,7 @@ class ItsNodeRootKernel(ItsNode): { "data": '/incbin/("' + setup_path + '")', "arch": self._arch, - "os": "linux", + "os": self._os, "load": load, "entry": entry }
@@ -385,7 +386,7 @@ class ItsNodeRootKernel(ItsNode): "data": '/incbin/("' + ramdisk_path + '")', "type": "ramdisk", "arch": self._arch, - "os": "linux" + "os": self._os, } if load: opt_props["load"] = f"<{load}>"
@@ -406,7 +407,7 @@ class ItsNodeRootKernel(ItsNode): opt_props = { "data": '/incbin/("' + filepath + '")', "arch": arch if arch is not None else self._arch, - "os": os if os is not None else "linux", + "os": os if os is not None else self._os, } if load:
meta/lib/oeqa/selftest/cases/fitimage.py +11 -2
@@ -670,6 +670,7 @@ class KernelFitImageBase(FitImageTestCase): 'FIT_LOADABLES', 'FIT_LOADABLE_ENTRYPOINT', 'FIT_LOADABLE_LOADADDRESS', + 'FIT_OS', 'FIT_SIGN_ALG', 'FIT_SIGN_INDIVIDUAL', 'FIT_UBOOT_ENV',
@@ -904,7 +905,7 @@ class KernelFitImageBase(FitImageTestCase): # 'compression = "' + str(bb_vars['FIT_KERNEL_COMP_ALG']) + '";', defined based on files in TMPDIR, not ideal... 'data = /incbin/("linux.bin");', 'arch = "' + str(bb_vars['UBOOT_ARCH']) + '";', - 'os = "linux";', + 'os = "%s";' % bb_vars['FIT_OS'], 'load = <' + str(bb_vars['UBOOT_LOADADDRESS']) + '>;', 'entry = <' + str(bb_vars['UBOOT_ENTRYPOINT']) + '>;', ]
@@ -1463,6 +1464,7 @@ class FitImagePyTests(KernelFitImageBase): '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", 'FIT_SIGN_INDIVIDUAL': "0",
@@ -1503,7 +1505,8 @@ 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"], + bb_vars['HOST_PREFIX'], bb_vars['UBOOT_ARCH'], bb_vars['FIT_OS'], + bb_vars["FIT_CONF_PREFIX"], 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"],
@@ -1609,6 +1612,12 @@ class FitImagePyTests(KernelFitImageBase): } self._test_fitimage_py(bb_vars_overrides) + def test_fitimage_py_conf_os(self): + """Test FIT_OS functionality""" + bb_vars_overrides = { + 'FIT_OS': "efi", + } + self._test_fitimage_py(bb_vars_overrides) class UBootFitImageTests(FitImageTestCase): """Test cases for the uboot-sign bbclass"""
Signature · 4 lines
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/
Re: [OE-core] [PATCH 2/2] kernel-fit-image: introduce FIT_OS variable to override 'os' field
Quoted 59 lines · Nora Schiffer via lists.openembedded.org
U-Boot can load an EFI application from a FIT image; this requires setting the OS to "efi" (usually in combination with type "
kernel_noload"). Doing so is a convenient approach for giving the OS access to EFI services while preserving other benefits of FIT image boot.Signed-off-by Nora Schiffer <[email protected]>---
meta/classes-recipe/kernel-fit-image.bbclass | 3 ++- meta/conf/image-fitimage.conf | 4 ++++ meta/lib/oe/fitimage.py | 11 ++++++----- meta/lib/oeqa/selftest/cases/fitimage.py | 13 +++++++++++--4 files changed, 23 insertions(+), 8 deletions(-)meta/classes-recipe/kernel-fit-image.bbclass +0
-0@@ -69,7 +69,8 @@ python do_compile() { # Collect all the its nodes before the its file is generated andmkimage gets executed
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"),
+d.getVar('HOST_PREFIX'),d.getVar('UBOOT_ARCH'),d.getVar('FIT_OS'),
+d.getVar("FIT_CONF_PREFIX"), 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('FIT_MKIMAGE_EXTRA_OPTS'),meta/conf/image- renamed from meta/conf/image-fitimage.conf +0
-0fitimage.conf
index2fdb816d55..a06d30e494100644meta/conf/image-fitimage.conf +0
-0@@ -37,6 +37,10 @@ FIT_CONF_PREFIX[doc] = "Prefix to use for FITconfiguration node name"
FIT_SUPPORTED_INITRAMFS_FSTYPES ?= "cpio.lz4 cpio.lzo cpio.lzma cpio.xz cpio.zst cpio.gz ext2.gz cpio"
+# os field of the kernel and various other images in the FIT image. Set to "efi"meta/conf/image-fitimage.conf +3
-0+# 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. # This is particularly useful for UKI-based setups, where the kernelmeta/lib/oe/fitimage.py +0
-0@@ -153,7 +153,7 @@ class ItsNodeRootKernel(ItsNode):If a device tree included in the FIT image, the default
Quoted 8 lines
configuration is the
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,
+ def __init__(self, description,address_cells,host_prefix, arch, os,conf_prefix,
Should we use "os" as a variable name? What happens if
import os
os = "efi" ?
os.path.join(...)
To be on the save side, I would suggest to use fit_os, for example.
Thank you for the patch. I think this needs a v2 because of this detail. But otherwise it looks good to me.
Sorry for the late response,
Adrian
Quoted 118 lines
sign_enable=False, sign_keydir=None, mkimage=None, mkimage_dtcopts=None, mkimage_extra_opts=None,
meta/lib/oe/fitimage.py +0
-0@@ -171,6 +171,7 @@ class ItsNodeRootKernel(ItsNode):
self._host_prefix =host_prefix
self._arch = arch
+ self._os = os
self._conf_prefix =conf_prefix
# Signature related propertiesmeta/lib/oe/fitimage.py +1
-1@@ -279,7 +280,7 @@ class ItsNodeRootKernel(ItsNode): opt_props = { "data": '/incbin/("' + kernel_path + '")', "arch": self._arch, - "os": "linux", + "os": self._os, }if load:
opt_props["load"] = f"<{load}>"meta/lib/oe/fitimage.py +1
-1@@ -370,7 +371,7 @@ class ItsNodeRootKernel(ItsNode): { "data": '/incbin/("' + setup_path + '")', "arch": self._arch, - "os": "linux", + "os": self._os, "load": load,"entry": entry
}meta/lib/oe/fitimage.py +1
-1@@ -385,7 +386,7 @@ class ItsNodeRootKernel(ItsNode): "data": '/incbin/("' + ramdisk_path + '")', "type": "ramdisk", "arch": self._arch, - "os": "linux" + "os": self._os, }if load:
opt_props["load"] = f"<{load}>"meta/lib/oe/fitimage.py +1
-1@@ -406,7 +407,7 @@ class ItsNodeRootKernel(ItsNode): opt_props = { "data": '/incbin/("' + filepath + '")', "arch": arch if arch is not None else self._arch, - "os": os if os is not None else "linux", + "os": os if os is not None else self._os, }
if load:meta/lib/oeqa/selftest/cases/fitimage.py +1
-0@@ -670,6 +670,7 @@ class KernelFitImageBase(FitImageTestCase): 'FIT_LOADABLES', 'FIT_LOADABLE_ENTRYPOINT', 'FIT_LOADABLE_LOADADDRESS', + 'FIT_OS', 'FIT_SIGN_ALG', 'FIT_SIGN_INDIVIDUAL', 'FIT_UBOOT_ENV',@@ -904,7 +905,7 @@ class KernelFitImageBase(FitImageTestCase): # 'compression = "' +
str(bb_vars['FIT_KERNEL_COMP_ALG'])+ '";', defined based on files in TMPDIR, not ideal...
'data = /incbin/("linux.bin");',
'arch = "' +str(bb_vars['UBOOT_ARCH'])+ '";', - 'os = "linux";',
+ 'os = "%s";' % bb_vars['FIT_OS'],
'load = <' +str(bb_vars['UBOOT_LOADADDRESS'])+ '>;', 'entry = <' +str(bb_vars['UBOOT_ENTRYPOINT'])+ '>;', ]meta/lib/oeqa/selftest/cases/fitimage.py +1
-0@@ -1463,6 +1464,7 @@ class FitImagePyTests(KernelFitImageBase): '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", 'FIT_SIGN_INDIVIDUAL': "0",@@ -1503,7 +1505,8 @@ 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"],
+ bb_vars['HOST_PREFIX'], bb_vars['UBOOT_ARCH'], bb_vars['FIT_OS'],
+ bb_vars["FIT_CONF_PREFIX"],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"],meta/lib/oeqa/selftest/cases/fitimage.py +0
-0@@ -1609,6 +1612,12 @@ class FitImagePyTests(KernelFitImageBase): } self._test_fitimage_py(bb_vars_overrides)
+ deftest_fitimage_py_conf_os(self):
+ """TestFIT_OSfunctionality"""
+bb_vars_overrides= {
+ 'FIT_OS': "efi",
+ }
+self._test_fitimage_py(bb_vars_overrides)
class UBootFitImageTests(FitImageTestCase):
"""Test cases for the uboot-sign bbclass"""-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#240383):
https://lists.openembedded.org/g/openembedded-core/message/240383
Mute This Topic: https://lists.openembedded.org/mt/120154469/4454582
Group Owner: [email protected] Unsubscribe:
https://lists.openembedded.org/g/openembedded-core/unsub [
[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [OE-core] [PATCH 2/2] kernel-fit-image: introduce FIT_OS variable to override 'os' field
Quoted 78 lines · On Sun, 2026-07-19 at 21:37 +0200, [email protected] wrote:
Quoted 59 lines · Nora Schiffer via lists.openembedded.org
U-Boot can load an EFI application from a FIT image; this requires setting the OS to "efi" (usually in combination with type "
kernel_noload"). Doing so is a convenient approach for giving the OS access to EFI services while preserving other benefits of FIT image boot.Signed-off-by Nora Schiffer <[email protected]>---
meta/classes-recipe/kernel-fit-image.bbclass | 3 ++- meta/conf/image-fitimage.conf | 4 ++++ meta/lib/oe/fitimage.py | 11 ++++++----- meta/lib/oeqa/selftest/cases/fitimage.py | 13 +++++++++++--4 files changed, 23 insertions(+), 8 deletions(-)meta/classes-recipe/kernel-fit-image.bbclass +0
-0@@ -69,7 +69,8 @@ python do_compile() { # Collect all the its nodes before the its file is generated andmkimage gets executed
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"),
+d.getVar('HOST_PREFIX'),d.getVar('UBOOT_ARCH'),d.getVar('FIT_OS'),
+d.getVar("FIT_CONF_PREFIX"), 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('FIT_MKIMAGE_EXTRA_OPTS'),meta/conf/image- renamed from meta/conf/image-fitimage.conf +0
-0fitimage.conf
index2fdb816d55..a06d30e494100644meta/conf/image-fitimage.conf +0
-0@@ -37,6 +37,10 @@ FIT_CONF_PREFIX[doc] = "Prefix to use for FITconfiguration node name"
FIT_SUPPORTED_INITRAMFS_FSTYPES ?= "cpio.lz4 cpio.lzo cpio.lzma cpio.xz cpio.zst cpio.gz ext2.gz cpio"
+# os field of the kernel and various other images in the FIT image. Set to "efi"meta/conf/image-fitimage.conf +3
-0+# 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. # This is particularly useful for UKI-based setups, where the kernelmeta/lib/oe/fitimage.py +0
-0@@ -153,7 +153,7 @@ class ItsNodeRootKernel(ItsNode):If a device tree included in the FIT image, the default
Quoted 8 lines
configuration is the
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,
+ def __init__(self, description,address_cells,host_prefix, arch, os,conf_prefix,Should we use "os" as a variable name? What happens if
import os
os = "efi" ?
os.path.join(...)
Quoted 7 lines
To be on the save side, I would suggest to use
fit_os, for example.Thank you for the patch. I think this needs a v2 because of this detail. But otherwise it looks good to me.
Sorry for the late response,
Adrian
Hi Adrian,
thanks for the review. Changing the identifier to fit_os makes sense to me, will update in v2 or a follow-up patch (depending on whether the v1 currently in master-next makes it to master or not).
Best,
Nora
Quoted 120 lines
Quoted 120 lines
sign_enable=False, sign_keydir=None, mkimage=None, mkimage_dtcopts=None, mkimage_extra_opts=None,
meta/lib/oe/fitimage.py +0
-0@@ -171,6 +171,7 @@ class ItsNodeRootKernel(ItsNode):
self._host_prefix =host_prefix
self._arch = arch
+ self._os = os
self._conf_prefix =conf_prefix
# Signature related propertiesmeta/lib/oe/fitimage.py +1
-1@@ -279,7 +280,7 @@ class ItsNodeRootKernel(ItsNode): opt_props = { "data": '/incbin/("' + kernel_path + '")', "arch": self._arch, - "os": "linux", + "os": self._os, }if load:
opt_props["load"] = f"<{load}>"meta/lib/oe/fitimage.py +1
-1@@ -370,7 +371,7 @@ class ItsNodeRootKernel(ItsNode): { "data": '/incbin/("' + setup_path + '")', "arch": self._arch, - "os": "linux", + "os": self._os, "load": load,"entry": entry
}meta/lib/oe/fitimage.py +1
-1@@ -385,7 +386,7 @@ class ItsNodeRootKernel(ItsNode): "data": '/incbin/("' + ramdisk_path + '")', "type": "ramdisk", "arch": self._arch, - "os": "linux" + "os": self._os, }if load:
opt_props["load"] = f"<{load}>"meta/lib/oe/fitimage.py +1
-1@@ -406,7 +407,7 @@ class ItsNodeRootKernel(ItsNode): opt_props = { "data": '/incbin/("' + filepath + '")', "arch": arch if arch is not None else self._arch, - "os": os if os is not None else "linux", + "os": os if os is not None else self._os, }
if load:meta/lib/oeqa/selftest/cases/fitimage.py +1
-0@@ -670,6 +670,7 @@ class KernelFitImageBase(FitImageTestCase): 'FIT_LOADABLES', 'FIT_LOADABLE_ENTRYPOINT', 'FIT_LOADABLE_LOADADDRESS', + 'FIT_OS', 'FIT_SIGN_ALG', 'FIT_SIGN_INDIVIDUAL', 'FIT_UBOOT_ENV',@@ -904,7 +905,7 @@ class KernelFitImageBase(FitImageTestCase): # 'compression = "' +
str(bb_vars['FIT_KERNEL_COMP_ALG'])+ '";', defined based on files in TMPDIR, not ideal...
'data = /incbin/("linux.bin");',
'arch = "' +str(bb_vars['UBOOT_ARCH'])+ '";', - 'os = "linux";',
+ 'os = "%s";' % bb_vars['FIT_OS'],
'load = <' +str(bb_vars['UBOOT_LOADADDRESS'])+ '>;', 'entry = <' +str(bb_vars['UBOOT_ENTRYPOINT'])+ '>;', ]meta/lib/oeqa/selftest/cases/fitimage.py +1
-0@@ -1463,6 +1464,7 @@ class FitImagePyTests(KernelFitImageBase): '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", 'FIT_SIGN_INDIVIDUAL': "0",@@ -1503,7 +1505,8 @@ 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"],
+ bb_vars['HOST_PREFIX'], bb_vars['UBOOT_ARCH'], bb_vars['FIT_OS'],
+ bb_vars["FIT_CONF_PREFIX"],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"],meta/lib/oeqa/selftest/cases/fitimage.py +0
-0@@ -1609,6 +1612,12 @@ class FitImagePyTests(KernelFitImageBase): } self._test_fitimage_py(bb_vars_overrides)
+ deftest_fitimage_py_conf_os(self):
+ """TestFIT_OSfunctionality"""
+bb_vars_overrides= {
+ 'FIT_OS': "efi",
+ }
+self._test_fitimage_py(bb_vars_overrides)
class UBootFitImageTests(FitImageTestCase):
"""Test cases for the uboot-sign bbclass"""-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#240383):
https://lists.openembedded.org/g/openembedded-core/message/240383
Mute This Topic: https://lists.openembedded.org/mt/120154469/4454582
Group Owner: [email protected] Unsubscribe:
https://lists.openembedded.org/g/openembedded-core/unsub [
[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 4 lines
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/
Re: [OE-core] [PATCH 2/2] kernel-fit-image: introduce FIT_OS variable to override 'os' field
Quoted 87 lines · Nora Schiffer
Quoted 78 lines · On Sun, 2026-07-19 at 21:37 +0200, [email protected] wrote:
Quoted 59 lines · Nora Schiffer via lists.openembedded.org
U-Boot can load an EFI application from a FIT image; this requires setting the OS to "efi" (usually in combination with type "
kernel_noload"). Doing so is a convenient approach for giving the OS access to EFI services while preserving other benefits of FIT image boot.Signed-off-by Nora Schiffer <[email protected]>---
meta/classes-recipe/kernel-fit-image.bbclass | 3 ++- meta/conf/image-fitimage.conf | 4 ++++ meta/lib/oe/fitimage.py | 11 ++++++----- meta/lib/oeqa/selftest/cases/fitimage.py | 13 +++++++++++--4 files changed, 23 insertions(+), 8 deletions(-)meta/classes-recipe/kernel-fit-image.bbclass +0
-0@@ -69,7 +69,8 @@ python do_compile() { # Collect all the its nodes before the its file is generated andmkimage gets executed
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"),
+d.getVar('HOST_PREFIX'),d.getVar('UBOOT_ARCH'),d.getVar('FIT_OS'),
+d.getVar("FIT_CONF_PREFIX"), 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('FIT_MKIMAGE_EXTRA_OPTS'),meta/conf/image- renamed from meta/conf/image-fitimage.conf +0
-0fitimage.conf
index2fdb816d55..a06d30e494100644meta/conf/image-fitimage.conf +0
-0@@ -37,6 +37,10 @@ FIT_CONF_PREFIX[doc] = "Prefix to use for FITconfiguration node name"
FIT_SUPPORTED_INITRAMFS_FSTYPES ?= "cpio.lz4 cpio.lzo cpio.lzma cpio.xz cpio.zst cpio.gz ext2.gz cpio"
+# os field of the kernel and various other images in the FIT image. Set to "efi"meta/conf/image-fitimage.conf +3
-0+# 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. # This is particularly useful for UKI-based setups, where the kernelmeta/lib/oe/fitimage.py +0
-0@@ -153,7 +153,7 @@ class ItsNodeRootKernel(ItsNode):If a device tree included in the FIT image, the default
Quoted 8 lines
configuration is the
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,
+ def __init__(self, description,address_cells,host_prefix, arch, os,conf_prefix,Should we use "os" as a variable name? What happens if
import os
os = "efi" ?
os.path.join(...)Quoted 7 lines
To be on the save side, I would suggest to use
fit_os, for example.Thank you for the patch. I think this needs a v2 because of this detail. But otherwise it looks good to me.
Sorry for the late response,
Adrian
Quoted 8 lines
Hi Adrian,
thanks for the review. Changing the identifier to
fit_osmakes sense to me, will update in v2 or a follow-up patch (depending on whether the v1 currently in master-next makes it to master or not).Best,
Nora
Ah, I copied this from fitimage_emit_section_loadable(), which already has an argument named os. Will fix both in a follow-up.
Best,
Nora
Quoted 123 lines
Quoted 122 lines
Quoted 122 lines
sign_enable=False, sign_keydir=None, mkimage=None, mkimage_dtcopts=None, mkimage_extra_opts=None,
meta/lib/oe/fitimage.py +0
-0@@ -171,6 +171,7 @@ class ItsNodeRootKernel(ItsNode):
self._host_prefix =host_prefix
self._arch = arch
+ self._os = os
self._conf_prefix =conf_prefix
# Signature related propertiesmeta/lib/oe/fitimage.py +1
-1@@ -279,7 +280,7 @@ class ItsNodeRootKernel(ItsNode): opt_props = { "data": '/incbin/("' + kernel_path + '")', "arch": self._arch, - "os": "linux", + "os": self._os, }if load:
opt_props["load"] = f"<{load}>"meta/lib/oe/fitimage.py +1
-1@@ -370,7 +371,7 @@ class ItsNodeRootKernel(ItsNode): { "data": '/incbin/("' + setup_path + '")', "arch": self._arch, - "os": "linux", + "os": self._os, "load": load,"entry": entry
}meta/lib/oe/fitimage.py +1
-1@@ -385,7 +386,7 @@ class ItsNodeRootKernel(ItsNode): "data": '/incbin/("' + ramdisk_path + '")', "type": "ramdisk", "arch": self._arch, - "os": "linux" + "os": self._os, }if load:
opt_props["load"] = f"<{load}>"meta/lib/oe/fitimage.py +1
-1@@ -406,7 +407,7 @@ class ItsNodeRootKernel(ItsNode): opt_props = { "data": '/incbin/("' + filepath + '")', "arch": arch if arch is not None else self._arch, - "os": os if os is not None else "linux", + "os": os if os is not None else self._os, }
if load:meta/lib/oeqa/selftest/cases/fitimage.py +1
-0@@ -670,6 +670,7 @@ class KernelFitImageBase(FitImageTestCase): 'FIT_LOADABLES', 'FIT_LOADABLE_ENTRYPOINT', 'FIT_LOADABLE_LOADADDRESS', + 'FIT_OS', 'FIT_SIGN_ALG', 'FIT_SIGN_INDIVIDUAL', 'FIT_UBOOT_ENV',@@ -904,7 +905,7 @@ class KernelFitImageBase(FitImageTestCase): # 'compression = "' +
str(bb_vars['FIT_KERNEL_COMP_ALG'])+ '";', defined based on files in TMPDIR, not ideal...
'data = /incbin/("linux.bin");',
'arch = "' +str(bb_vars['UBOOT_ARCH'])+ '";', - 'os = "linux";',
+ 'os = "%s";' % bb_vars['FIT_OS'],
'load = <' +str(bb_vars['UBOOT_LOADADDRESS'])+ '>;', 'entry = <' +str(bb_vars['UBOOT_ENTRYPOINT'])+ '>;', ]meta/lib/oeqa/selftest/cases/fitimage.py +1
-0@@ -1463,6 +1464,7 @@ class FitImagePyTests(KernelFitImageBase): '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", 'FIT_SIGN_INDIVIDUAL': "0",@@ -1503,7 +1505,8 @@ 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"],
+ bb_vars['HOST_PREFIX'], bb_vars['UBOOT_ARCH'], bb_vars['FIT_OS'],
+ bb_vars["FIT_CONF_PREFIX"],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"],meta/lib/oeqa/selftest/cases/fitimage.py +0
-0@@ -1609,6 +1612,12 @@ class FitImagePyTests(KernelFitImageBase): } self._test_fitimage_py(bb_vars_overrides)
+ deftest_fitimage_py_conf_os(self):
+ """TestFIT_OSfunctionality"""
+bb_vars_overrides= {
+ 'FIT_OS': "efi",
+ }
+self._test_fitimage_py(bb_vars_overrides)
class UBootFitImageTests(FitImageTestCase):
"""Test cases for the uboot-sign bbclass"""-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#240383):
https://lists.openembedded.org/g/openembedded-core/message/240383
Mute This Topic: https://lists.openembedded.org/mt/120154469/4454582
Group Owner: [email protected] Unsubscribe:
https://lists.openembedded.org/g/openembedded-core/unsub [
[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 4 lines
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/