* [PATCH 1/4] bootm: define LINUX_BOOTARGS_BOOTM_EARLY/LATE in <bootm.h>
@ 2026-10-02 11:26 Ahmad Fatoum
2026-10-02 11:26 ` [PATCH 2/4] amend! FIT: add cmdline to whitelist of non-hashed properties Ahmad Fatoum
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2026-10-02 11:26 UTC (permalink / raw)
To: barebox; +Cc: Thomas Bonnefille, Ahmad Fatoum
We had previously laid out a prefix convention for the Linux command
line options added by bootm, but only the late variant was added as
nothing yet needed the early one.
The FIT cmdline support will need it and lives outside bootm.c, so let's
introduce LINUX_BOOTARGS_BOOTM_EARLY and move both prefixes into the
header.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
Please reorder before Thomas' FIT command-line series
---
Documentation/user/booting-linux.rst | 4 ++++
common/bootm.c | 14 +-------------
include/bootm.h | 14 ++++++++++++++
3 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/Documentation/user/booting-linux.rst b/Documentation/user/booting-linux.rst
index 529d4de5c5b8..de40b6a57dc0 100644
--- a/Documentation/user/booting-linux.rst
+++ b/Documentation/user/booting-linux.rst
@@ -112,6 +112,10 @@ their ``linux.bootargs.``-prefixed parameter names.
Kernel command line arguments that barebox generates internally are not
interleaved with externally provided command-line arguments:
+* Following arguments will be concatenated **before** all other options:
+
+ * the ``cmdline`` property of the booted FIT image configuration
+
* Following arguments will be concatenated **after** all other options:
* ``root=`` and ``rootwait=`` controlled by :ref:`global.bootm.appendroot <magicvar_global_bootm_appendroot>`
diff --git a/common/bootm.c b/common/bootm.c
index 27da1a590bf1..90b99d62b01e 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -22,19 +22,6 @@
#include <security/config.h>
#include <security/policy.h>
-/*
- * All device parameter iteration happens in lexicographical order.
- * To ensure that bootm options are consistently applied before or after
- * other options from the environment or boot configuration files, we
- * employ following convention for the prefix:
- *
- * ! 0x21 is less than any non-space printable character
- * ~ 0x7e is greater than any printable character
- *
- * Users will never see those as bootm_boot_cleanup() will delete them again.
- */
-#define LINUX_BOOTARGS_BOOTM_LATE "linux.bootargs.~bootm."
-
static LIST_HEAD(handler_list);
static struct sconfig_notifier_block sconfig_notifier;
@@ -803,6 +790,7 @@ void bootm_boot_cleanup(struct image_data *data)
if (data->of_root_node)
of_delete_node(data->of_root_node);
+ globalvar_remove(LINUX_BOOTARGS_BOOTM_EARLY "*");
globalvar_remove(LINUX_BOOTARGS_BOOTM_LATE "*");
free(data->os_header);
free(data->os_file);
diff --git a/include/bootm.h b/include/bootm.h
index 946713971eb5..8e574040f497 100644
--- a/include/bootm.h
+++ b/include/bootm.h
@@ -7,6 +7,20 @@
#include <linux/list.h>
#include <loadable.h>
+/*
+ * All device parameter iteration happens in lexicographical order.
+ * To ensure that bootm options are consistently applied before or after
+ * other options from the environment or boot configuration files, we
+ * employ following convention for the prefix:
+ *
+ * ! 0x21 is less than any non-space printable character
+ * ~ 0x7e is greater than any printable character
+ *
+ * Users will never see those as bootm_boot_cleanup() will delete them again.
+ */
+#define LINUX_BOOTARGS_BOOTM_EARLY "linux.bootargs.!bootm."
+#define LINUX_BOOTARGS_BOOTM_LATE "linux.bootargs.~bootm."
+
enum bootm_verify {
BOOTM_VERIFY_NONE,
BOOTM_VERIFY_HASH,
--
2.47.3
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 2/4] amend! FIT: add cmdline to whitelist of non-hashed properties 2026-10-02 11:26 [PATCH 1/4] bootm: define LINUX_BOOTARGS_BOOTM_EARLY/LATE in <bootm.h> Ahmad Fatoum @ 2026-10-02 11:26 ` Ahmad Fatoum 2026-10-02 11:26 ` [PATCH 3/4] amend! bootm: add fitimage command line to bootargs Ahmad Fatoum 2026-10-02 11:26 ` [PATCH 4/4] test: py: add test for fit cmdline parameter order Ahmad Fatoum 2 siblings, 0 replies; 4+ messages in thread From: Ahmad Fatoum @ 2026-10-02 11:26 UTC (permalink / raw) To: barebox; +Cc: Thomas Bonnefille, Ahmad Fatoum FIT: add cmdline to whitelist of non-hashed properties The cmdline parameter of the fitimage is an additional optional property in a configuration node that is used to transmit information to the next bootstage. Just like description, compatible and default, this property doesn't reference an image (e.g. a kernel, a ramdisk or an fdt) and so it is hashed as property within the node and not as part of the list of hashed images. Add `cmdline` to the whitelist of property in a configuration node that aren't images. Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com> Link: https://lore.barebox.org/20260924-add-cmdline-fitimage-v2-3-4a665e165002@bootlin.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> [ahmad: point out that the property is hashed, just not as an image] Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> -- 2.47.3 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 3/4] amend! bootm: add fitimage command line to bootargs 2026-10-02 11:26 [PATCH 1/4] bootm: define LINUX_BOOTARGS_BOOTM_EARLY/LATE in <bootm.h> Ahmad Fatoum 2026-10-02 11:26 ` [PATCH 2/4] amend! FIT: add cmdline to whitelist of non-hashed properties Ahmad Fatoum @ 2026-10-02 11:26 ` Ahmad Fatoum 2026-10-02 11:26 ` [PATCH 4/4] test: py: add test for fit cmdline parameter order Ahmad Fatoum 2 siblings, 0 replies; 4+ messages in thread From: Ahmad Fatoum @ 2026-10-02 11:26 UTC (permalink / raw) To: barebox; +Cc: Thomas Bonnefille, Ahmad Fatoum From: Ahmad Fatoum <a.fatoum@barebox.org> bootm: add fitimage command line to bootargs 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. Create a new bootm-scope global variable that will be appended to the command line when CONFIG_FLEXIBLE_BOOTARGS is enabled. Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com> Link: https://lore.barebox.org/20260924-add-cmdline-fitimage-v2-1-4a665e165002@bootlin.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> [ahmad: use LINUX_BOOTARGS_BOOTM_EARLY to fix bootargs order and cleanup] Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org> --- common/bootm-fit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/bootm-fit.c b/common/bootm-fit.c index c7142f490fa5..f0a4c83f5950 100644 --- a/common/bootm-fit.c +++ b/common/bootm-fit.c @@ -108,7 +108,7 @@ static void bootm_fit_config_cmdline(struct device_node *config) if (of_property_read_string(config, "cmdline", &cmdline)) return; - globalvar_add_simple("linux.bootargs.dyn.bootentries.fit", cmdline); + globalvar_add_simple(LINUX_BOOTARGS_BOOTM_EARLY "fit", cmdline); pr_info("Using command line from FIT configuration: %s\n", cmdline); } -- 2.47.3 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 4/4] test: py: add test for fit cmdline parameter order 2026-10-02 11:26 [PATCH 1/4] bootm: define LINUX_BOOTARGS_BOOTM_EARLY/LATE in <bootm.h> Ahmad Fatoum 2026-10-02 11:26 ` [PATCH 2/4] amend! FIT: add cmdline to whitelist of non-hashed properties Ahmad Fatoum 2026-10-02 11:26 ` [PATCH 3/4] amend! bootm: add fitimage command line to bootargs Ahmad Fatoum @ 2026-10-02 11:26 ` Ahmad Fatoum 2 siblings, 0 replies; 4+ messages in thread From: Ahmad Fatoum @ 2026-10-02 11:26 UTC (permalink / raw) To: barebox; +Cc: Thomas Bonnefille, Ahmad Fatoum The order of the FIT cmdline is important as we want boot scripts and boot entry files (blspec, EXTLINUX) to be able to robustly append options after it. Extend the test to check that this is the case and while at it, also verify that it doesn't survive beyond the bootm call. Cc: Thomas Bonnefille <thomas.bonnefille@bootlin.com> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- test/py/test_fit.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/py/test_fit.py b/test/py/test_fit.py index b4c01459924e..2e866a28266a 100644 --- a/test/py/test_fit.py +++ b/test/py/test_fit.py @@ -87,6 +87,13 @@ def test_fit_dryrun(barebox, strategy, fitimage): # If we actually did boot, this variable would be undefined barebox.run_check('[ "$global.dryrun_attempts" = 5 ]') + # Apply fixups and check the FIT's cmdline did not outlive bootm -d + stdout = barebox.run_check("of_dump -F -p /chosen") + for line in stdout: + if line.startswith("bootargs"): + assert "fit.param" not in line, \ + f"FIT cmdline survived bootm dry run: {line}" + def test_fit(barebox, strategy, fitimage): # Sanity check, this is only fixed up on first boot @@ -112,6 +119,7 @@ def test_fit(barebox, strategy, fitimage): actual_size = int(fileinfo.split()[1]) boottarget = generate_bootscript(barebox, fitimage) + barebox.run_check("global linux.bootargs.dyn.bootentries=entry.param") with strategy.boot_barebox(boottarget) as barebox: assert of_get_property(barebox, "/chosen/barebox-version") == ver, \ @@ -125,6 +133,12 @@ def test_fit(barebox, strategy, fitimage): assert "barebox.chainloaded" in bootargs assert "fit.param" in bootargs + # The FIT's cmdline comes first, so everything else can override it + assert bootargs.index("fit.param") < bootargs.index("barebox.chainloaded"), \ + "fit.param found later than bootargs set by scripts" + assert bootargs.index("fit.param") < bootargs.index("entry.param"), \ + "fit.param found later than bootargs set by boot entries" + initrd_start = of_get_property(barebox, "/chosen/linux,initrd-start", ncells=0) initrd_end = of_get_property(barebox, "/chosen/linux,initrd-end", ncells=0) initrd_size = initrd_end - initrd_start -- 2.47.3 ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-10-02 11:28 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2026-10-02 11:26 [PATCH 1/4] bootm: define LINUX_BOOTARGS_BOOTM_EARLY/LATE in <bootm.h> Ahmad Fatoum 2026-10-02 11:26 ` [PATCH 2/4] amend! FIT: add cmdline to whitelist of non-hashed properties Ahmad Fatoum 2026-10-02 11:26 ` [PATCH 3/4] amend! bootm: add fitimage command line to bootargs Ahmad Fatoum 2026-10-02 11:26 ` [PATCH 4/4] test: py: add test for fit cmdline parameter order Ahmad Fatoum
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox