Where can I change default cmdline/cbootargs and other questions regarding jetson nano boot process.

Hello,

I’d like to change the default cmdline / cbootargs that are passed to kernel when loading it.
Even before customization, I’d like to understand the process and clean the quite ugly (imho) version that is the default on r32.2.1 :

tegraid=21.1.2.0.0 ddr_die=4096M@2048M section=512M memtype=0 vpr_resize usb_port_owner_info=0 lane_owner_info=0 emc_max_dvfs=0 touch_id=0@63 video=tegrafb no_console_suspend=1 console=ttyS0,115200n8 debug_uartport=lsport,2 earlyprintk=uart8250-32bit,0x70006000 maxcpus=4 usbcore.old_scheme_first=1 lp0_vec=0x1000@0xff780000 core_edp_mv=1125 core_edp_ma=4000 tegra_fbmem=0x800000@0x92cb7000 is_hdmi_initialised=1  root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0    root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0

wich contains a lot of redundant variables.

I’m able to change this from u-boot at runtime but as the saveenv is not enabled on the default image ( I’ve seen this : https://devtalk.nvidia.com/default/topic/1052348/-u-boot-saveenv-command-/ ) so this cannot be used to permanently change the image settings at runtime.

I’ve been searching around the forum around those cbootargs / cmdline but did not found a complete answer (e.g. I found this

https://devtalk.nvidia.com/default/topic/1056391/jetson-nano/changing-kernel-bootargs/

). Most of those threads explain how to add args with the /boot/extlinux/extlinux.conf file, but as far as I understand, this only allows to add arguments to the already existing cbootargs. This indeed works (as the quiet arg added throught this mecanism on the stock r32.2.1 image). Other thread reports that this is done through DTB customization, but I have not seen any cbootargs entry in the .dts files that I believe are used for building my .dtb file.

Any help / tutorial / good resources to get hands deeper on the u-boot configuration (compilation/installation) would really be welcome. I’ve been searching the u-boot source, but did not found where/how to configure the default cbootarg.

As an extra request, do you think it’s possible to completely disable the boot / OS usage of the console uart, in order to use it a second uart, without transmitting any chars on that line at boot time ? (somethng similar to

https://wiki.odroid.com/odroid-xu4/troubleshooting/odroid-hc1_disable_console

on other platforms). I understand that the boot process has several additionnal stages before u-boot, and that those stages should also have their console output disabled, so is this achievable ?

PS : I’m using the Nano DevKit and I have the sdkmanager installed ad usable on a ubuntu 18.04 host (already have compiled custom kernel and DTB with /dev/pps0 and kernel GPIO pps support)

After some extra digging in the week-end, I found that most of the cmdline args comes from cboot.bin

, which if I trust this thread https://devtalk.nvidia.com/default/topic/1048753/r32-1-cboot-source/ has not be source code released yet for Jetson Nano (and thus not documented yet I guess)

I also found fragments in p3448-0000.conf.common as well as in flash.sh but as I’m mostly using the sd card image creation method for now, I don’t understand well how to take advantage of those entry points for modifying the kernel cmdline arguments.

Last, I found

bootargs = "kmemleak=on earlycon=uart8250,mmio32,0x70006000";

in /home/mathieu/nvidia/nvidia_sdk/JetPack_4.2.2_Linux_GA_P3448/Linux_for_Tegra/sources/hardware/nvidia/platform/t210/porg/tegra210-porg-p3448-common.dtsi. This last entry is quite puzzling because the dts fragment is actually used (at least I strongly believe it does) to create the dtb on the board, but this particular cmdline parameters do not show up in the actual cmdline seen from

/proc/cmdline

or

/proc/device-tree/chosen/bootargs

I now have feeling that all infos to properly understand how to set this cmdline variable are not available (at least I’ve not been able to find usefull bits matching my understanding level yet).
I also fear that being able to use the devkit second uart will also require modified nvtboot.bin and cboot.bin (in addition to u-boot.bin) because those 2 stages are also spitting on the console from early stage as far as I can see.

[0000.126] [TegraBoot] (version 00.00.2018.01-l4t-89b97a49)
....
[0001.531] welcome to cboot
[0001.533]
[0001.534] Cboot Version: 00.00.2018.01-t210-3a168c35
...
U-Boot 2016.07-gd917e08cec (Aug 12 2019 - 21:10:20 -0700)

TEGRA210
Model: NVIDIA P3450-Porg
Board: NVIDIA P3450-PORG
DRAM:  4 GiB
MMC:   Tegra SD/MMC: 0, Tegra SD/MMC: 1
Using default environment
...

Any help/additionnal info from NVIDIA team here would be really appreciated !

1 Like

I don’t know all of the details for Nano, but the device tree is the usual method for changing this. The “chosen” node “bootargs” line (which you’ve already discovered) is the correct place to begin. There is more than one way to work with device trees, and the official docs have a section on customization which should contain this.

I also found fragments in p3448-0000.conf.common as well as in flash.sh but as I’m mostly using the sd card image creation method for now, I don’t understand well how to take advantage of those entry points for modifying the kernel cmdline arguments.

I think it is better using p3448-0000.conf.common to change the default kernel cmdline or try to put it in ./kernel-dts/tegra210-porg-p3448-common.dtsi → bootargs.

Hello, thank you for your answers.

I have not tried modifying p3448-0000.conf.common yet, but I think this will only allow to add arguments to command line as those transferred from earlier boot stages (also this may allow for some clean-up of the redundant args). I’ll try this and let you know.

As for the device tree way, the bootargs given in platform/t210/porg/tegra210-porg-p3448-common.dtsi are not found in the final cmdline, although the file is actually used (I’m sure it is because I’m adding a /dev/pps0 entry and this works)

Could it be a typo bootargs vs. cbootargs that prevents this art from actually being used ?

There are a few places that CBoot (and the flash tools) pick up the kernel cmdline args - the config file (p3448-0000.conf.common, in CMDLINE_ADD=), in the DTB chosen/bootargs, and in the extlinux.conf file in the rootfs:

/boot/extlinux/extlinux.conf:

APPEND ${cbootargs}

By default, this just picks up the (concatenated) bootargs from CBoot (from the U-Boot environment). If you want to add args, this is the best place. If you need to change or remove kernel args (console=, etc.), you’ll have to track where it’s set in the above files and change it there.

Note, too, that /proc/cmdline and /proc/device-tree/chosen/bootargs should be identical.

And, if you don’t use flash.sh, but instead use an SD-card image, you skip the step where flash.sh uses mkbootimg to place the ‘cmdline’ args into the DTB that’s flashed to the device (i.e. your DTB in the SD-card image will be static). So I’d recommend that all devs that want to modify the bootargs always use flash.sh to flash both QSPI and SD.

HTH,

Tom