* [PATCH v2 0/3] FIT: parse and use the cmdline property of FIT images
@ 2026-09-24 17:59 Thomas Bonnefille
2026-09-24 17:59 ` [PATCH v2 1/3] bootm: add fitimage command line to bootargs Thomas Bonnefille
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Thomas Bonnefille @ 2026-09-24 17:59 UTC (permalink / raw)
To: Sascha Hauer, Ahmad Fatoum, open list:BAREBOX
Cc: Thomas Petazzoni, Miquèl Raynal, Hervé Codina,
Thomas Bonnefille
As of FIT v0.9, it is possible to pass cmdline parameters to the
bootloader via a special property in the fitimage.
This series adds support for this feature in Barebox.
It also adds some tests to avoid any regression on this feature.
As `cmdline` is a property in a configuration that isn't a reference to
an image, it needs to be whitelisted by fit_config_build_hash_nodes() to
not be hashed.
Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
---
Changes in v2:
- Skip bootargs configuration if CONFIG_FLEXIBLE_BOOTARGS isn't enabled
- Use a dynamic bootargs
- Added a test for the fit image command line parameter
- Whitelisted the cmdline property in fit image hashing
- Link to v1: https://patch.msgid.link/20260827-add-cmdline-fitimage-v1-1-56701e1f0093@bootlin.com
To: Sascha Hauer <s.hauer@pengutronix.de>
To: "open list:BAREBOX" <barebox@lists.infradead.org>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Miquèl Raynal <miquel.raynal@bootlin.com>
---
Thomas Bonnefille (3):
bootm: add fitimage command line to bootargs
test: py: add test for fit cmdline parameter
FIT: add cmdline to whitelist of non-hashed properties
common/bootm-fit.c | 18 ++++++++++++++++++
common/image-fit.c | 1 +
test/py/test_fit.py | 1 +
test/testdata/multi_v7_defconfig-gzipped.its | 1 +
test/testdata/multi_v8_defconfig-gzipped.its | 1 +
5 files changed, 22 insertions(+)
---
base-commit: 75819f9e196e2da048e96c8589898fdc38ef8e7a
change-id: 20260827-add-cmdline-fitimage-42f6b2e930c1
Best regards,
--
Thomas Bonnefille <thomas.bonnefille@bootlin.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 1/3] bootm: add fitimage command line to bootargs
2026-09-24 17:59 [PATCH v2 0/3] FIT: parse and use the cmdline property of FIT images Thomas Bonnefille
@ 2026-09-24 17:59 ` Thomas Bonnefille
2026-09-24 17:59 ` [PATCH v2 2/3] test: py: add test for fit cmdline parameter Thomas Bonnefille
2026-09-24 17:59 ` [PATCH v2 3/3] FIT: add cmdline to whitelist of non-hashed properties Thomas Bonnefille
2 siblings, 0 replies; 4+ messages in thread
From: Thomas Bonnefille @ 2026-09-24 17:59 UTC (permalink / raw)
To: Sascha Hauer, Ahmad Fatoum, open list:BAREBOX
Cc: Thomas Petazzoni, Miquèl Raynal, Hervé Codina,
Thomas Bonnefille
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 `linux.bootargs.dyn.bootentries.fit` 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>
---
common/bootm-fit.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/common/bootm-fit.c b/common/bootm-fit.c
index f7742b8717..c7142f490f 100644
--- a/common/bootm-fit.c
+++ b/common/bootm-fit.c
@@ -3,6 +3,7 @@
#include <bootm.h>
#include <image-fit.h>
#include <bootm-fit.h>
+#include <globalvar.h>
#include <memory.h>
#include <string.h>
#include <zero_page.h>
@@ -97,6 +98,21 @@ static bool bootm_fit_config_valid(struct fit_handle *fit,
return !!fit_has_image(fit, config, "kernel");
}
+static void bootm_fit_config_cmdline(struct device_node *config)
+{
+ const char *cmdline;
+
+ if (!IS_ENABLED(CONFIG_FLEXIBLE_BOOTARGS))
+ return;
+
+ if (of_property_read_string(config, "cmdline", &cmdline))
+ return;
+
+ globalvar_add_simple("linux.bootargs.dyn.bootentries.fit", cmdline);
+
+ 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 +162,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;
--
2.55.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 2/3] test: py: add test for fit cmdline parameter
2026-09-24 17:59 [PATCH v2 0/3] FIT: parse and use the cmdline property of FIT images Thomas Bonnefille
2026-09-24 17:59 ` [PATCH v2 1/3] bootm: add fitimage command line to bootargs Thomas Bonnefille
@ 2026-09-24 17:59 ` Thomas Bonnefille
2026-09-24 17:59 ` [PATCH v2 3/3] FIT: add cmdline to whitelist of non-hashed properties Thomas Bonnefille
2 siblings, 0 replies; 4+ messages in thread
From: Thomas Bonnefille @ 2026-09-24 17:59 UTC (permalink / raw)
To: Sascha Hauer, Ahmad Fatoum, open list:BAREBOX
Cc: Thomas Petazzoni, Miquèl Raynal, Hervé Codina,
Thomas Bonnefille
Now that the FIT boot logic supports getting new command line arguments
from the FIT image, add a test to ensure this doesn't regress.
Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
---
test/py/test_fit.py | 1 +
test/testdata/multi_v7_defconfig-gzipped.its | 1 +
test/testdata/multi_v8_defconfig-gzipped.its | 1 +
3 files changed, 3 insertions(+)
diff --git a/test/py/test_fit.py b/test/py/test_fit.py
index 51afbba876..b4c0145992 100644
--- a/test/py/test_fit.py
+++ b/test/py/test_fit.py
@@ -123,6 +123,7 @@ def test_fit(barebox, strategy, fitimage):
# Check that command line arguments were fixed up
bootargs = of_get_property(barebox, "/chosen/bootargs")
assert "barebox.chainloaded" in bootargs
+ assert "fit.param" in bootargs
initrd_start = of_get_property(barebox, "/chosen/linux,initrd-start", ncells=0)
initrd_end = of_get_property(barebox, "/chosen/linux,initrd-end", ncells=0)
diff --git a/test/testdata/multi_v7_defconfig-gzipped.its b/test/testdata/multi_v7_defconfig-gzipped.its
index 1cb84fd415..0ae0e5b609 100644
--- a/test/testdata/multi_v7_defconfig-gzipped.its
+++ b/test/testdata/multi_v7_defconfig-gzipped.its
@@ -68,6 +68,7 @@
fdt = "fdt-qemu-virt32.dtb";
ramdisk = "ramdisk-1", "ramdisk-2", "ramdisk-3";
compatible = "linux,dummy-virt";
+ cmdline = "fit.param";
signature-1 {
algo = "sha256,rsa2048";
sign-images = "kernel", "fdt", "ramdisk";
diff --git a/test/testdata/multi_v8_defconfig-gzipped.its b/test/testdata/multi_v8_defconfig-gzipped.its
index 3786d0f121..2728c545d1 100644
--- a/test/testdata/multi_v8_defconfig-gzipped.its
+++ b/test/testdata/multi_v8_defconfig-gzipped.its
@@ -68,6 +68,7 @@
fdt = "fdt-qemu-virt64.dtb";
ramdisk = "ramdisk-1", "ramdisk-2", "ramdisk-3";
compatible = "linux,dummy-virt";
+ cmdline = "fit.param";
signature-1 {
algo = "sha256,rsa2048";
sign-images = "kernel", "fdt", "ramdisk";
--
2.55.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 3/3] FIT: add cmdline to whitelist of non-hashed properties
2026-09-24 17:59 [PATCH v2 0/3] FIT: parse and use the cmdline property of FIT images Thomas Bonnefille
2026-09-24 17:59 ` [PATCH v2 1/3] bootm: add fitimage command line to bootargs Thomas Bonnefille
2026-09-24 17:59 ` [PATCH v2 2/3] test: py: add test for fit cmdline parameter Thomas Bonnefille
@ 2026-09-24 17:59 ` Thomas Bonnefille
2 siblings, 0 replies; 4+ messages in thread
From: Thomas Bonnefille @ 2026-09-24 17:59 UTC (permalink / raw)
To: Sascha Hauer, Ahmad Fatoum, open list:BAREBOX
Cc: Thomas Petazzoni, Miquèl Raynal, Hervé Codina,
Thomas Bonnefille
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 isn't
hashed and shouldn't be added to 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>
---
common/image-fit.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/common/image-fit.c b/common/image-fit.c
index 635f63c9e2..cd477911cc 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -333,6 +333,7 @@ static int fit_config_build_hash_nodes(struct fit_handle *handle,
for_each_property_of_node(conf_node, prop) {
if (!strcmp(prop->name, "description") ||
!strcmp(prop->name, "compatible") ||
+ !strcmp(prop->name, "cmdline") ||
!strcmp(prop->name, "default"))
continue;
--
2.55.0
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-09-24 18:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-24 17:59 [PATCH v2 0/3] FIT: parse and use the cmdline property of FIT images Thomas Bonnefille
2026-09-24 17:59 ` [PATCH v2 1/3] bootm: add fitimage command line to bootargs Thomas Bonnefille
2026-09-24 17:59 ` [PATCH v2 2/3] test: py: add test for fit cmdline parameter Thomas Bonnefille
2026-09-24 17:59 ` [PATCH v2 3/3] FIT: add cmdline to whitelist of non-hashed properties Thomas Bonnefille
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox