From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Thomas Bonnefille <thomas.bonnefille@bootlin.com>,
Sascha Hauer <s.hauer@pengutronix.de>,
"open list:BAREBOX" <barebox@lists.infradead.org>
Cc: "Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
"Miquèl Raynal" <miquel.raynal@bootlin.com>,
"Hervé Codina" <herve.codina@bootlin.com>
Subject: Re: [PATCH] bootm: add fitimage command line to bootargs
Date: Thu, 27 Aug 2026 16:16:53 +0200 [thread overview]
Message-ID: <0705aef2-bcd6-4f8a-8150-89b2283840af@pengutronix.de> (raw)
In-Reply-To: <20260827-add-cmdline-fitimage-v1-1-56701e1f0093@bootlin.com>
Hello Thomas,
On 8/27/26 2:16 PM, Thomas Bonnefille wrote:
> Since FIT image specification v0.9, it is now possible to pass command
> line arguments for the next boot stage in FIT images.
>
> Add parsing of the cmdline optional property when reading the fitimage.
> This create a `linux.bootargs.fit` global variable that will be appended
> to the command line when CONFIG_FLEXIBLE_BOOTARGS is enabled.
Thanks for your patch! I find this much cleaner than the current way of
injecting command-line arguments via FIT (set fdt /chosen/bootargs and
set global.linux.bootargs_append=1).
It appears to me barebox would be the first user of this? I couldn't
find an implementation in U-Boot. I guess most people are happy with
setting bootargs in their boot scripts instead.
Some comments below.
> +static void bootm_fit_config_cmdline(struct device_node *config)
> +{
> + const char *cmdline;
if (!IS_ENABLED(CONFIG_FLEXIBLE_BOOTARGS))
return;
I never had a project without it myself, but just so the pr_info below
is skipped.
> +
> + if (of_property_read_string(config, "cmdline", &cmdline))
> + return;
> +
> + globalvar_add_simple("linux.bootargs.fit", cmdline);
Once you set a global variable, it stays set for the duration of
barebox's execution. So if you have global.boot.default="fit recovery"
and the fit boot aborts prematurely, you may end up with fit's
command-line while your recovery target runs.
Variables that start with linux.bootargs.dyn. workaround this: They are
reset if a boot target fails (or returns because it's a dry run).
Another thing you need to account for here is the order of bootargs. All
bootargs are concatenated lexicographically, but what would a user
expect that points a bootloader spec or extlinux file at a FIT?
I think it makes more sense that bootloader spec would take precedence
over FIT as it's easier to change by the user.
So my idea is that you would set the global variable
linux.bootargs.dyn.bootentries.fit instead.
This should then be naturally concatenated before
linux.bootargs.dyn.bootentries.
This also takes care of possible compatibility problems. We wouldn't
want to clobber a linux.bootargs.dyn.fit (especially without an entry in
the migration notes) that an out-of-tree boot script is setting, but I
think the namespace linux.bootargs.dyn.bootentries.* is fair game,
because barebox has been using it for years already.
It also should be fairly easy to add a test for this:
In ./test/testdata/*.its add a cmdline property and then in
test_fit.py::test_fit add a check for /chosen/bootargs inside the with:
clause.
Above test doesn't verify signatures though and I believe it would
actually break. You can verify by setting global.bootm.verify=signature
after having built with CONFIG_CRYPTO_BUILTIN_DEVELOPMENT_KEYS=y.
I will Cc you on a RFC patch shortly.
Cheers,
Ahmad
> +
> + pr_info("Using command line from FIT configuration: %s\n", cmdline);
> +}
> +
> static enum filetype bootm_fit_update_os_header(struct image_data *data)
> {
> size_t size;
> @@ -146,6 +159,8 @@ int bootm_open_fit(struct image_data *data, bool override)
> goto err;
> }
>
> + bootm_fit_config_cmdline(fit_config);
> +
> loadable_from_fit_os(data, fit, fit_config);
> if (override)
> data->is_override.os = true;
>
> ---
> base-commit: df1055a2e0ddd3f96939327f2f0eb9db13a2bdc6
> change-id: 20260827-add-cmdline-fitimage-42f6b2e930c1
>
> Best regards,
> --
> Thomas Bonnefille <thomas.bonnefille@bootlin.com>
>
>
--
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-08-27 14:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 12:16 Thomas Bonnefille
2026-08-27 14:16 ` Ahmad Fatoum [this message]
2026-08-27 15:08 ` 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=0705aef2-bcd6-4f8a-8150-89b2283840af@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=herve.codina@bootlin.com \
--cc=miquel.raynal@bootlin.com \
--cc=s.hauer@pengutronix.de \
--cc=thomas.bonnefille@bootlin.com \
--cc=thomas.petazzoni@bootlin.com \
/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