Set Kernel commandline from userspace

currently our cmline looks like below

root@jetson-xavier-nx-devkit:~# cat /proc/cmdline 
console=ttyTCU0,115200 console=ttyTCU0,115200 console=tty0 fbcon=map:0 video=tegrafb no_console_suspend=1 earlycon=tegra_comb_uart,mmio32,0x0c168000 gpt tegra_fbmem=0x800000@0xa069c000 lut_mem=0x2008@0xa0696000 usbcore.old_scheme_first=1 tegraid= maxcpus=6 boot.slot_suffix= boot.ratchetvalues=0.4.2 vpr_resize sdhci_tegra.en_boot_part_access=1

For our use case we want to be able to add/update a new entry to the Linux command line. Is there a tool to do that ?

Background: We are using RAUC for OTA updates and it detects the active rootfs by reading rauc.slot=<slot> from /proc/cmdline.

Try to modify the /boot/extlinux/extlinux.conf to modify the cmdline.

FYI, the mentioned extlinux.conf has an “APPEND” key/value pair, which is where you’d add content. You could create a second boot entry instead of modifying the first entry if you want some safety. In that case you’d be able to use serial console to pick an entry at boot time. Although this is not something you’d want to use for remote use you could make your modified entry the default. If there is a problem, then you’d still have the other entry for worst case.

Also note that the “${cbootargs}” is content inherited from earlier in boot. That content is mainly from the device tree node “chosen->bootargs”. Those entries are used by earlier boot stages, and could in fact have edits before being passed to later stages, so you would not necessarily want to edit the device tree, but there are cases when you would.

In newer releases I think you can add a new device tree as a file by adding an FDT key/value pair entry within extlinux.conf. Without the FDT entry it should pull device tree from a partition, but if you want to test and avoid flashing partitions, then the way to do this would be with the FDT entry. If the original entry is left in place and you use FDT in a different entry, then you have a back up plan if the FDT edits fail.