Kernel command line bootargs being ignored despite kernel_menuconfig settings

I'm upgrading an existing system (custom).

The new kernel (rampis/mt7620) will not use the uboot bootargs no matter what I do.
The bootlog always shows the command from the device tree dts:
[0.000000] Kernel command line: console=ttyS0,57600,
and never the uboot command line.

I have set the option in kernel_menuconfig (MIPS_CMDLINE_FROM_BOOTLOADER [=y]) to use the uboot command line when available. It doesn't seem to change anything.

See this

There is a certain point in OpenWRT history where they decided that kernel command line should never take arguments from a bootloader, period, no matter what. However, the option still lingers in the menu, but doesn't effectively change anything. You can try to play with other menu options but I don't recommend it and it can break your build config easily.

If you need to change bootargs you need to make a build yourself, where you would add a patch or adjust the default command line on your copy of the source code. Unfortunately this isn't really explained anywhere else as far as I know...other than commit messages and bug report pages...

Yes, each architecture has its own way of dealing with "unruly" OEM boot args potentially patched in as well as compiled into the architecture's kernel. Some accept them, some ignore them completely, others munge them in subtle ways, such as when they are needed to select version in dual-firmware devices.

You'd have to look through the kernel patches to determine just how it is being done for your architecture.

target/linux/ramips/patches-4.14/0007-MIPS-ralink-copy-the-commandline-from-the-devicetree.patch might be interesting to examine...


For someone finding this in the future, the patch above is (April, 2019):

--- a/arch/mips/ralink/of.c
+++ b/arch/mips/ralink/of.c
@@ -82,6 +82,8 @@ void __init plat_mem_setup(void)
+       strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE);
        of_scan_flat_dt(early_init_dt_find_memory, NULL);
        if (memory_dtb)
                of_scan_flat_dt(early_init_dt_scan_memory, NULL);

Thanks all, looking into it. I took over maintenance of a custom wifi bridge module for a home appliance, that was made with openwrt in 2013ish. It uses two image/rootfs partitions and swaps back and forth each time there is an ota, so i need the bootloader to tell it which partition to mount as rootfs.

1 Like

@jeff Do you understand what this patch is doing? I tried simply eliminating it but that did not restore the use of boot commands.

Please post output of;

cat "kerneldir"/.config | grep CMDLINE

In root/.config


in /target/linux/ramips/mt7620$ cat config-4.14 | grep CMDLINE


If I do cat /proc/cmdline it shows the command line from the DTS chosen block.

If i delete chosen->bootargs from the dtsi and dts, then I get this on boot (still ignoring uboot cmdline):

Kernel command line: console=ttyS0,57600

make menuconfig  # your target
make target/linux/{clean,prepare}

Then look at the patched sources under ./build_dir/

Yeah, it turns out that both patches 0007 and 0100 are adding that strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE); line. So it is getting inserted into the source twice.

I'm trying to manually delete that whole block, compile, and see what happens.

Thanks all. Created a local patch and was able to boot via uboot commands. Someone more knowledgeable might be able to add config vars to this patch to make it respect the settings chosen in kernel_menuconfig.

--- a/arch/mips/ralink/of.c
+++ b/arch/mips/ralink/of.c
@@ -98,10 +98,6 @@ void __init plat_mem_setup(void)
 	of_scan_flat_dt(early_init_dt_find_chosen, NULL);
-	if (chosen_dtb)
-		strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE);
-	strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE);
 	of_scan_flat_dt(early_init_dt_find_memory, NULL);
 	if (memory_dtb)