diff mbox series

kernel-fit-image: reference the boot script as "script"

Message ID 20260817192923.4159278-1-sergio.prado@e-labworks.com
State New
Headers show
Series kernel-fit-image: reference the boot script as "script" | expand

Commit Message

Sergio Prado Aug. 17, 2026, 7:29 p.m. UTC
The boot script added to a fitImage through FIT_UBOOT_ENV is referenced
from the configuration nodes with a "bootscr" property. U-Boot does not
know that name. It looks the boot script up through the "script"
property, defined as FIT_SCRIPT_PROP in include/image.h and used by
image_locate_script() in boot/image-board.c. The same name is used in
the example image tree source in the documentation of the source
command in [1]:

    configurations {
        default = "conf-2";
        conf-1 { script = "script-1"; };
        conf-2 { script = "script-2"; };
    };

As a result the boot script cannot be reached through a configuration:

    source <addr>#<conf>   fails with "Could not find script in <conf>"

    source <addr>          falls back to the image named by the "default"
                           property of the /images node, which is not
                           generated either, and fails with "No FIT
                           subimage unit name"

    source <addr>:<image>  works, as the name of the image node is not
                           affected, but addresses the script directly
                           and therefore cannot tie it to a configuration,
                           which is a problem when one wants to boot
                           exclusively from a signed configuration as
                           part of a verified boot chain.

To fix it, rename the property to "script". The entries of "sign-images"
are property names of the configuration node, so rename that entry as well
to keep the boot script covered by the configuration signature, and update
the expected value in the fitimage selftest to match.

Verified on an i.MX95 board with U-Boot 2025.04 booting a fitImage built
with FIT_UBOOT_ENV. Before the change, 'source <addr>#conf-<dtb>' stopped
at "Could not find script in conf-<dtb>". With the change, the
configuration form runs the script and boots.

[1] https://docs.u-boot.org/en/latest/usage/cmd/source.html#fit-image

Signed-off-by: Sergio Prado <sergio.prado@e-labworks.com>
---
 meta/lib/oe/fitimage.py                  | 4 ++--
 meta/lib/oeqa/selftest/cases/fitimage.py | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/meta/lib/oe/fitimage.py b/meta/lib/oe/fitimage.py
index d4dacdd508c8..c84eda4672e6 100644
--- a/meta/lib/oe/fitimage.py
+++ b/meta/lib/oe/fitimage.py
@@ -458,9 +458,9 @@  class ItsNodeRootKernel(ItsNode):
 
         if self._bootscr:
             conf_desc.append("u-boot script")
-            opt_props["bootscr"] = self._bootscr.name
+            opt_props["script"] = self._bootscr.name
             if self._sign_enable:
-                sign_entries.append("bootscr")
+                sign_entries.append("script")
 
         if self._setup:
             conf_desc.append("setup")
diff --git a/meta/lib/oeqa/selftest/cases/fitimage.py b/meta/lib/oeqa/selftest/cases/fitimage.py
index 451878aafd85..4b7407282c7f 100644
--- a/meta/lib/oeqa/selftest/cases/fitimage.py
+++ b/meta/lib/oeqa/selftest/cases/fitimage.py
@@ -965,7 +965,7 @@  class KernelFitImageBase(FitImageTestCase):
         if bb_vars['INITRAMFS_IMAGE'] and bb_vars['INITRAMFS_IMAGE_BUNDLE'] != "1":
             sign_images += ', "ramdisk"'
         if bb_vars['FIT_UBOOT_ENV']:
-            sign_images += ', "bootscr"'
+            sign_images += ', "script"'
         if bb_vars.get('KERNEL_SETUP_BIN'):
             sign_images += ', "setup"'
         req_sigvalues_config = {