@@ -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'),
@@ -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
@@ -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:
@@ -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"""
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 <nora.schiffer@ew.tq-group.com> --- 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(-)