Modifying the L4TConfiguration dts

I am trying to add “KernelCommandLine” to my L4TConfiguration.dts to include some new default kernel bootargs. The problem is that KernelCommandLine is define as uint16 since it is unicode. If I set data = “string value”; then it appears that the individual characters are somehow transformed to unicode characters and I get a kernel command line with Asian characters in place of “string value”. If I use data = [0072 006f]; to try to force 2 unicode characters for example. I get the same result where the characters are similarly misinterpreted into 4 unicode characters of unknown progeny. What is the syntax in the device tree to pass a unicode string or at least somehow get the characters I want transferred to the kernel command line?

This is what I am using now (that isn’t working):

KernelCommandLine {
data = “root=/dev/mmcblk0p1 rauc.slot=A”;
runtime;
non-volatile;
}

The device tree has node “chosen->bootloader” (on a running system check “cat /proc/device-tree/chosen/bootloader”). This is appended to kernel boot command line. Can you add the “rauc.slot=A” there? Also, when this fails, what do you see from “cat /proc/cmdline”?

On the computer you work from, what do you see from “echo $LANG”?

Thanks for your response. On my system I have /proc/device-tree/chosen/bootargs - I do not have bootloader (this is an Orin system and uses UEFI FWIW) - and the content is:

mminit_loglevel=4 console=tty0 console=ttyTCU0,115200 firmware_class.path=/etc/firmware fbcon=map:0 net.ifnames=0 潲瑯⼽敤⽶浭扣歬瀰‱慲捵献潬㵴A

I cannot modify the contents of this ‘file’

cat /proc/cmdline yields:
mminit_loglevel=4 console=tty0 console=ttyTCU0,115200 firmware_class.path=/etc/firmware fbcon=map:0 net.ifnames=0 潲瑯⼽敤⽶浭扣歬瀰‱慲捵献潬㵴A

And echo $LANG on my work computer (where I generate the dtb) is:
en_US.UTF-8

Hi neil30,

Are you using the devkit or custom board?

Have you tried to modify “/boot/extlinux/extlinux.conf” for kernel cmdline?
Please also try with sudo permission.

Hi @KevinFFF

Thanks for your response. It is a yocto-generated kernel and file system (core-image-minimal) running on a standard NVIDIA Orin dev kit. I am logged in as root so I don’t need sudo and there is nothing at all in the /boot directory.

Sorry, we don’t support and maintain yocto project due to also not verified by us.

This question has nothing to do with yocto. The question is “What is the syntax in the device tree L4TConfiguration.dts for specifying a value for “KernelCommandLine” given that it is defined as unicode characters?”

Please try to use chosen for bootargs as following:

chosen {
    bootargs = "root=/dev/mmcblk0p1 rauc.slot=A";
};

Unfortunately, that yielded the same result. Asian characters appended to the boot arg list. The magic here is most definitely knowing the device tree syntax that allows specification of unicode characters

Is it possible that the Yocto software itself is not en_US? The possibilities are:

  • The character is preserved correctly, but being displayed with another $LANG.
  • The character is altered during conversion of dts to dtb.

We know that your software, where you are reading it, is en_US. But we don’t know if Yocto itself is 100% en_US. For example, “cat /proc/cmdline” might be altered during read or during creation.

My money is currently on the device tree compiler turning the string into a standard ASCII encoded string rather than a unicode string because every other string in the device tree is ASCII-encoded and NOT unicode. I don’t see a way to flag a unicode string to the device tree compiler. If there is some magic way to define a 16 bit word array to the device tree compiler that could be a work around too, I suppose. The few attempts I have made at that have seen the compiler break every array into 8 bit bytes that once again are mangled by the code that reads this particular device tree entry (it reads each byte and expands it to 16 bits)

How are you editing the device tree? I’m curious about the tools.

Let’s say you have a starting .dts file you are going to turn into a .dtb file. Let’s put these through xxd to see hex dumps, and then compare.

# The original source .dts file:
grep 'chosen ' file.dts | xxd
# From the kernel's idea after boot:
cat /proc/device-tree/chosen/bootargs | xxd
# Just an echo test on the same computer which edits the device tree:
echo 'rauc.slot=A' | xxd

Here are the results

dts:

000000e0: 2020 6368 6f73 656e 207b 0a20 2020 2020 chosen {.
000000f0: 2020 2020 2020 2020 2020 626f 6f74 6172 bootar
00000100: 6773 203d 2022 726f 6f74 3d2f 6465 762f gs = “root=/dev/
00000110: 6d6d 6362 6c6b 3070 3120 7261 7563 2e73 mmcblk0p1 rauc.s
00000120: 6c6f 743d 4122 3b0a 2020 2020 2020 2020 lot=A”;.
00000130: 7d3b 0a0a 0966 7261 676d 656e 7440 3020 };…fragment@0

echo:

00000000: 7261 7563 2e73 6c6f 743d 410a rauc.slot=A.

chosen/bootargs

00000000: 6d6d 696e 6974 5f6c 6f67 6c65 7665 6c3d mminit_loglevel=
00000010: 3420 636f 6e73 6f6c 653d 7474 7930 2063 4 console=tty0 c
00000020: 6f6e 736f 6c65 3d74 7479 5443 5530 2c31 onsole=ttyTCU0,1
00000030: 3135 3230 3020 6669 726d 7761 7265 5f63 15200 firmware_c
00000040: 6c61 7373 2e70 6174 683d 2f65 7463 2f66 lass.path=/etc/f
00000050: 6972 6d77 6172 6520 6662 636f 6e3d 6d61 irmware fbcon=ma
00000060: 703a 3020 6e65 742e 6966 6e61 6d65 733d p:0 net.ifnames=
00000070: 3020 e6bd b2e7 91af e2bc bde6 95a4 e2bd 0 …
00000080: b6e6 b5ad e689 a3e6 adac e780 b0e2 80b1 …
00000090: e685 b2e6 8db5 e78c aee6 bdac e3b5 b441 …A
000000a0: 0100 …

To make this easier I’ll suggest marking that output as “code” in the forum. This will cause whitespace to be preserved. You can click the “pencil” icon in the lower right of your existing post to start editing, and then highlight the output, then click the “code” icon (looks like “</>”) in the upper tool bar of the post, and then save. Output will then be easier to read (I copied this to an editor though so I see it cleaned up).

I see in the dts that the content is exactly as expected in ASCII. However, the “chosen->bootargs” has something going on (probably from the procedure of looking at it rather than the content being bad). I’m going to repost that here, and then comment on why I say this:

chosen/bootargs

00000000: 6d6d 696e 6974 5f6c 6f67 6c65 7665 6c3d mminit_loglevel=
00000010: 3420 636f 6e73 6f6c 653d 7474 7930 2063 4 console=tty0 c
00000020: 6f6e 736f 6c65 3d74 7479 5443 5530 2c31 onsole=ttyTCU0,1
00000030: 3135 3230 3020 6669 726d 7761 7265 5f63 15200 firmware_c
00000040: 6c61 7373 2e70 6174 683d 2f65 7463 2f66 lass.path=/etc/f
00000050: 6972 6d77 6172 6520 6662 636f 6e3d 6d61 irmware fbcon=ma
00000060: 703a 3020 6e65 742e 6966 6e61 6d65 733d p:0 net.ifnames=
00000070: 3020 e6bd b2e7 91af e2bc bde6 95a4 e2bd 0 …
00000080: b6e6 b5ad e689 a3e6 adac e780 b0e2 80b1 …
00000090: e685 b2e6 8db5 e78c aee6 bdac e3b5 b441 …A
000000a0: 0100 …

Note that the right hand column of xxd output should show either actual characters or a stand-in for non-printable characters. This is as expected up to and including the line which ends with “p:0 net.ifnames=”. After this it seems corrupted.

Also, when you manually echo the content, this also comes out as expected. So there is a break somewhere in reading this, but your terminal would in theory be correctly creating “rauc.slot=A” if this is where you are making the edits.

Can you carefully create a log of the “chosen->bootargs” like this, and attach to the forum?

cat /proc/device-tree/chosen/bootargs | xxd | tee log_chosen_bootargs.txt

I want to see if eliminating the copy and paste solves the device tree read through “cat”.

I will do as you suggest shortly but I would note that when I manually echo

chosen/bootargs

I do not in fact see what I expect. I see Asian characters printed out

Try this variation on the command, and see if anything changes:

LANG=en_US.UTF-8 cat /proc/device-tree/chosen/bootargs

This will manually set the LANG for just this command by prefixing it at the start of “cat”. It is still important to get this log file without corruption:

cat /proc/device-tree/chosen/bootargs | xxd | tee log_chosen_bootargs.txt

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.