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:
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.
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?”
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
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:
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”.
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