[PATCH 4/4] test: py: add test for fit cmdline parameter order

Ahmad Fatoum a.fatoum at pengutronix.de
Fri Oct 2 04:26:34 PDT 2026


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 at bootlin.com>
Signed-off-by: Ahmad Fatoum <a.fatoum at 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




More information about the barebox mailing list