From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>,
BAREBOX <barebox@lists.infradead.org>
Subject: Re: [PATCH 3/5] boot: hand overrides on to nested boots and the bootm command
Date: Fri, 13 Nov 2026 09:52:43 +0100 [thread overview]
Message-ID: <966d4f5d-41a1-47a7-8c08-2ef74bddf0fb@pengutronix.de> (raw)
In-Reply-To: <20261030-devboot-v1-3-ab9dd3a92c66@pengutronix.de>
Hello,
On 10/30/26 15:13, Sascha Hauer wrote:
> Overrides are stored in the boot entry they are given for and only
> applied by bootm_entry(). They get lost when a boot entry boots something
> else, like a boot script calling boot, or calling the bootm command.
>
> Keep track of the overrides of the boot entry being booted. Hand them on
> to boot entries booted from there, with the ones of the outer entry
> taking precedence, and apply them in the bootm command.
I think the current design grew out of compressed kernels inside FIT calling
bootm_boot from within bootm_boot. As this has been changed now, some
simplification may be possible.
> bootchooser no longer needs to merge the overrides into its targets itself.
That's a nice side effect.
>
> This is done in do_bootm() and not in bootm_boot(), which the Android
> image handler calls while a bootm is already running, so it would apply
> the overrides a second time.
1) That's not a pre-existng issue though, because there was no
global.boot.devboot yet, right?
2) Would an override with Android boot images even work with these changes?
It seems as if the overrides would not matter. I am not advocating for them
to work, but the commit message suggests they do. I am fine with them failing
with devboot enabled.
>
> Assisted-by: Claude:claude-opus-5-5
S-o-b missing.
> - ret = bootm_boot(&data);
> + ret = bootm_boot_overrides(&data, boot_get_active_overrides());
> if (ret) {
> printf("handler failed with: %pe\n", ERR_PTR(ret));
> goto err_out;
> diff --git a/common/boot.c b/common/boot.c
> index b993cabf65..271cfd3a29 100644
> --- a/common/boot.c
> +++ b/common/boot.c
> @@ -187,8 +187,23 @@ BAREBOX_MAGICVAR(global.boot.watchdog_timeout,
> BAREBOX_MAGICVAR(global.user,
> "Username used by the default environment to construct network boot paths");
>
> +/* The overrides of the boot entry currently being booted */
> +static const struct bootm_overrides *boot_active_overrides;
I am not a fan of this global. I think it makes it harder to reason about
things, which is unfortunate when we must avoid this development feature
introducing a backdoor to override a verified boot further down the line..
> int bootm_entry(struct bootentry *be, const struct bootm_data *bootm_data)
> {
> - struct image_data *data;
> - int ret;
> -
> - data = bootm_boot_prep(bootm_data);
> - if (IS_ERR(data))
> - return PTR_ERR(data);
> -
> - ret = bootm_apply_overrides(data, &be->overrides);
> - if (ret)
> - goto out;
> -
> - ret = bootm_boot_handler(data);
> -
> -out:
> - bootm_boot_cleanup(data);
> - return ret;
> + return bootm_boot_overrides(bootm_data, &be->overrides);
> }
I am wondering if FIT being booted by bootm instead of boot is the actual
problem here. Conceptually, a FIT should generate boot entries like blspec
and then one of them can be booted. If that were the case, bootm
would become really about booting the images that go into it and would
not extract loadables from images. If we had that, overrides could be cleanly
implemented by changing the loadables that go into bootm instead:
1) boot generates entries
2) overrides affect loadables
3) bootm processes loadables
I admit that will be a bigger rework though.
> diff --git a/common/bootm.c b/common/bootm.c
> index 2ad8c34bb4..2ed377da18 100644
> --- a/common/bootm.c
> +++ b/common/bootm.c
> @@ -785,7 +785,15 @@ void bootm_boot_cleanup(struct image_data *data)
> /*
> * bootm_boot - Boot an application image described by bootm_data
> */
Orphan comment
Thanks,
Ahmad
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2026-11-13 8:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-30 14:13 [PATCH 0/5] boot: implement devboot in C Sascha Hauer
2026-10-30 14:13 ` [PATCH 1/5] boot: report the exit status of failing boot scripts Sascha Hauer
2026-11-12 8:50 ` Ahmad Fatoum
2026-10-30 14:13 ` [PATCH 2/5] hush: export source_script() Sascha Hauer
2026-11-12 8:47 ` Ahmad Fatoum
2026-10-30 14:13 ` [PATCH 3/5] boot: hand overrides on to nested boots and the bootm command Sascha Hauer
2026-11-13 8:52 ` Ahmad Fatoum [this message]
2026-10-30 14:13 ` [PATCH 4/5] boot: implement devboot in C Sascha Hauer
2026-11-13 7:51 ` Ahmad Fatoum
2026-11-13 9:48 ` Sascha Hauer
2026-10-30 14:13 ` [PATCH 5/5] sandbox: defconfig: enable boot overrides and devboot Sascha Hauer
2026-11-12 8:48 ` Ahmad Fatoum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=966d4f5d-41a1-47a7-8c08-2ef74bddf0fb@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=s.hauer@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox