mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] bootm: filter out "<NULL>" rootopts to avoid kernel cmdline noise
@ 2026-04-16 12:55 Alexander Shiyan
  2026-04-17  8:44 ` Sascha Hauer
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Shiyan @ 2026-04-16 12:55 UTC (permalink / raw)
  To: barebox; +Cc: Alexander Shiyan

When rootopts is set to the literal string "<NULL>" (e.g., due to a
missing or invalid value in cdev_get_linux_root_and_opts), the resulting
kernel command line contains "root=/dev/... <NULL>", which is invalid
and may cause boot failures or confusion.

This patch checks for the "<NULL>" string in rootopts and replaces it
with NULL before calling format_root_bootarg(), effectively omitting
the erroneous token from the command line.

Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com>
---
 common/bootm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/common/bootm.c b/common/bootm.c
index d43079bb81..0f0774dc32 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -688,6 +688,9 @@ int bootm_boot(struct bootm_data *bootm_data)
 		} else {
 			char *rootarg;
 
+			if (rootopts && !strcmp(rootopts, "<NULL>"))
+				rootopts = NULL;
+
 			rootarg = format_root_bootarg(bootm_data->root_param, root, rootopts);
 			pr_info("Adding \"%s\" to Kernel commandline\n", rootarg);
 			globalvar_add_simple("linux.bootargs.bootm.appendroot",
-- 
2.52.0




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] bootm: filter out "<NULL>" rootopts to avoid kernel cmdline noise
  2026-04-16 12:55 [PATCH] bootm: filter out "<NULL>" rootopts to avoid kernel cmdline noise Alexander Shiyan
@ 2026-04-17  8:44 ` Sascha Hauer
  2026-04-17 11:03   ` Alexander Shiyan
  2026-04-17 11:11   ` Alexander Shiyan
  0 siblings, 2 replies; 5+ messages in thread
From: Sascha Hauer @ 2026-04-17  8:44 UTC (permalink / raw)
  To: Alexander Shiyan; +Cc: barebox

Hi Alexander,

On Thu, Apr 16, 2026 at 03:55:12PM +0300, Alexander Shiyan wrote:
> When rootopts is set to the literal string "<NULL>" (e.g., due to a
> missing or invalid value in cdev_get_linux_root_and_opts), the resulting
> kernel command line contains "root=/dev/... <NULL>", which is invalid
> and may cause boot failures or confusion.
> 
> This patch checks for the "<NULL>" string in rootopts and replaces it
> with NULL before calling format_root_bootarg(), effectively omitting
> the erroneous token from the command line.

I would rather avoid setting it to "<NULL>" in the first place.

Does the patch I just sent help or is there another place where this
happens?

Sascha

-- 
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 |



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] bootm: filter out "<NULL>" rootopts to avoid kernel cmdline noise
  2026-04-17  8:44 ` Sascha Hauer
@ 2026-04-17 11:03   ` Alexander Shiyan
  2026-04-20  7:58     ` Sascha Hauer
  2026-04-17 11:11   ` Alexander Shiyan
  1 sibling, 1 reply; 5+ messages in thread
From: Alexander Shiyan @ 2026-04-17 11:03 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

Hello, Sasha.

This does not work as expected.

barebox@Diasom DS-RK3568-SOM-EVB:/ global.boot.default=mmc1.2
barebox@Diasom DS-RK3568-SOM-EVB:/ boot
ext4 ext40: EXT2 rev 1, inode_size 256, descriptor size 64
Booting entry 'extlinux: linux'
extlinux: Booting extlinux label 'linux'
Adding "root=/dev/mmcblk1p3 <NULL>" to Kernel commandline

Loading ARM aarch64 Linux/EFI image '/mnt/mmc1.2/boot/extlinux/../vmlinuz'
Loaded initrd from GZIP compressed
/mnt/mmc1.2/boot/extlinux/../initrd.img to
0x000000000d390000-0x000000000fb48ca6
Camera IMX662 detected.
commandline: mem=0xef600000 root=/dev/mmcblk1p3 <NULL>
console=ttyS2,1500000n8 ro systemd.unit=setup.target quiet splash
systemd.machine_id=181af2816b4c6b0aef77068e0ccc69ad
Loaded kernel to 0x0a400000, devicetree at 0x000000000fb49000
nv variables modified, saving them

пт, 17 апр. 2026 г. в 11:44, Sascha Hauer <s.hauer@pengutronix.de>:
>
> Hi Alexander,
>
> On Thu, Apr 16, 2026 at 03:55:12PM +0300, Alexander Shiyan wrote:
> > When rootopts is set to the literal string "<NULL>" (e.g., due to a
> > missing or invalid value in cdev_get_linux_root_and_opts), the resulting
> > kernel command line contains "root=/dev/... <NULL>", which is invalid
> > and may cause boot failures or confusion.
> >
> > This patch checks for the "<NULL>" string in rootopts and replaces it
> > with NULL before calling format_root_bootarg(), effectively omitting
> > the erroneous token from the command line.
>
> I would rather avoid setting it to "<NULL>" in the first place.
>
> Does the patch I just sent help or is there another place where this
> happens?
>
> Sascha
>
> --
> 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 |



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] bootm: filter out "<NULL>" rootopts to avoid kernel cmdline noise
  2026-04-17  8:44 ` Sascha Hauer
  2026-04-17 11:03   ` Alexander Shiyan
@ 2026-04-17 11:11   ` Alexander Shiyan
  1 sibling, 0 replies; 5+ messages in thread
From: Alexander Shiyan @ 2026-04-17 11:11 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

Is dev_get_param() return NULL or empty string if missing?
Maybe we need to check (val && *val) ?

пт, 17 апр. 2026 г. в 11:44, Sascha Hauer <s.hauer@pengutronix.de>:
>
> Hi Alexander,
>
> On Thu, Apr 16, 2026 at 03:55:12PM +0300, Alexander Shiyan wrote:
> > When rootopts is set to the literal string "<NULL>" (e.g., due to a
> > missing or invalid value in cdev_get_linux_root_and_opts), the resulting
> > kernel command line contains "root=/dev/... <NULL>", which is invalid
> > and may cause boot failures or confusion.
> >
> > This patch checks for the "<NULL>" string in rootopts and replaces it
> > with NULL before calling format_root_bootarg(), effectively omitting
> > the erroneous token from the command line.
>
> I would rather avoid setting it to "<NULL>" in the first place.
>
> Does the patch I just sent help or is there another place where this
> happens?
>
> Sascha
>
> --
> 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 |



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] bootm: filter out "<NULL>" rootopts to avoid kernel cmdline noise
  2026-04-17 11:03   ` Alexander Shiyan
@ 2026-04-20  7:58     ` Sascha Hauer
  0 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2026-04-20  7:58 UTC (permalink / raw)
  To: Alexander Shiyan; +Cc: barebox

Hi Alexander,

On Fri, Apr 17, 2026 at 02:03:32PM +0300, Alexander Shiyan wrote:
> Hello, Sasha.
> 
> This does not work as expected.

Yeah, this patch was rubbish. Let's try again, I've sent another patch.

Sascha


-- 
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 |



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-04-20  7:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-04-16 12:55 [PATCH] bootm: filter out "<NULL>" rootopts to avoid kernel cmdline noise Alexander Shiyan
2026-04-17  8:44 ` Sascha Hauer
2026-04-17 11:03   ` Alexander Shiyan
2026-04-20  7:58     ` Sascha Hauer
2026-04-17 11:11   ` Alexander Shiyan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox