diff mbox series

[wrynose] kernel-fit-image: reference the boot script as "script"

Message ID 20261020091814.62136-1-bastien.curutchet@bootlin.com
State Under Review
Delegated to: Yoann Congal
Headers show
Series [wrynose] kernel-fit-image: reference the boot script as "script" | expand

Commit Message

Bastien Curutchet Oct. 20, 2026, 9:18 a.m. UTC
From: Sergio Prado <sergio.prado@e-labworks.com>

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>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 6bb0775e6ca56eb50119e9ad618dc5b865252f72)
Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
---
Hi all,

I hadn't subscribed to the oe-core ML, that's why I resend it, sorry.

Best regards,
Bastien
---
 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 a1040181a2..2304119902 100644
--- a/meta/lib/oe/fitimage.py
+++ b/meta/lib/oe/fitimage.py
@@ -453,9 +453,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 84e21346ab..822b8c22c7 100644
--- a/meta/lib/oeqa/selftest/cases/fitimage.py
+++ b/meta/lib/oeqa/selftest/cases/fitimage.py
@@ -697,7 +697,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"'
         req_sigvalues_config = {
             'algo': '"%s,%s"' % (bb_vars['FIT_HASH_ALG'], bb_vars['FIT_SIGN_ALG']),
             'key-name-hint': '"%s"' % bb_vars['UBOOT_SIGN_KEYNAME'],