How to copy DTS and Image file to USB Drive rootfs directly or is there any method to do that

Hello,

I’m using TX2i our customize board with JetPack 4.4 and l4t tag is 32.4.
Followed steps for USB drive boot
1. Made USB drive ext4 format
2. echo ‘PARTUUID’ > bootloader/l4t-rootfs-uuid.txt
3.Copied the rootfs folder into USB drive (/dev/sdb1)
4.Flashed TX2i with sudo ./flash.sh jetson-tx2i sda1
5.TX2i is booted from a USB drive is successful.

In our custom board, there is no USB OTG mode so I can’t flash EMMC every time. I can do it only one or two times using the EV kit changing the TX2i module and flashing.
Whenever I made changes in DTS and Drivers. Generating Image and dtb files.
how to copy or is there any method reflect my changes in a USB drive.
So that can be helpful for me if changes are reflecting through USB drive.

please help me.

Thanks
Parashuram

There are exceptions to what follows, but for the most part the following should work…

When booting the “/boot/extlinux/extlinux.conf” will name where the Image file is (by default “/boot/Image”) via the “LINUX” key/value pair. I generally suggest that people do not overwrite the original Image, but instead add a duplicate entry, use serial console to pick that entry while testing, and after that make the new entry the default. Example extlinux.conf:

TIMEOUT 30
DEFAULT primary

MENU TITLE p2771-0000 eMMC boot options

TIMEOUT 30
DEFAULT test

MENU TITLE p2771-0000 eMMC boot options

LABEL primary
      MENU LABEL original kernel
      LINUX /boot/Image
      APPEND ${cbootargs} root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4

LABEL test
      MENU LABEL usb test
      LINUX /boot/Image-4.9.140-tegra-test
      APPEND ${cbootargs} root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4

(and then add the Image file as a file copy to “/boot/Image-4.9.140-test-tegra”; I have conveniently named this after what I think my new “uname -r” will be)

Here is the trick: Depending on flash parameters, the extlinux.conf might be the one in eMMC, or it might be the one on the USB drive. I’ve purposely renamed the “MENU LABEL” to reflect this, and if I don’t see it on serial console, then it implies I edited the wrong extlinux.conf. If you’ve flashed and set the USB drive correctly, then you would only need to edit on the USB drive.

There is also an additional “FDT” parameter. For awhile this was not used on some of the Jetsons, but for the most part it should work on anything recent. This key/value pair is for naming the kernel device tree (note that there is other device tree content in a partition which might be used by earlier boot stages). For the most part naming a device tree binary in “/boot” should work (exceptions might exist if you are set up for signed content in partitions instead of direct device tree file load).

An example device tree, if it is file name “tegra186-quill-p3310-1000-c03-00-base.dtb”, would be:

LABEL test
      MENU LABEL usb test
      FDT /boot/tegra186-quill-p3310-1000-c03-00-custom.dtb
      LINUX /boot/Image-4.9.140-tegra-test
      APPEND ${cbootargs} root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4

In that example I named the file “tegra186-quill-p3310-1000-c03-00-custom.dtb”, with “custom” since it is not the original. You would then copy this to “/boot/tegra186-quill-p3310-1000-c03-00-custom.dtb” of the correct partition (USB or eMMC, depending on flash parameters).

Note that if you use a new Image which changes the output of “uname -r” that you must also add all modules in built for that “uname -r”. Modules are searched for in “/lib/modules/$(uname -r)/kernel/”.

Thanks for your reply. working on USB drive boot.
will update the status .

Hi,
We have followed the above steps and the TX2i is booting from USB drive. We made some changes in the base dts file, re-generated the dtb files and copied to usb drive (/boot directory). Once we re-start the system, the changes made into dts file is not reflecting into the system behaviour. Can you please help to resolve this isuse?

Regards
Parashuram

When you have two drives (eMMC and USB), then you have to make sure the new device tree and the extlinux.conf of that drive are correct. You might be booting with edits to the wrong extlinux.conf.

During boot you can add clues by changing the “MENU LABEL” on the USB disk and the eMMC to be unique to that disk. Serial console would then tell you if you are using the correct extlinux.conf. Example, intended to go to extlinux.conf of the eMMC:

LABEL primary
      MENU LABEL eMMC internal original kernel
      LINUX /boot/Image
      APPEND ${cbootargs} root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4

LABEL test
      MENU LABEL eMMC usb internal test
      LINUX /boot/Image-4.9.140-tegra-test
      APPEND ${cbootargs} root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4

…then make a similar edit to the extlinux.conf on the USB drive:

LABEL primary
      MENU LABEL usb external original kernel
      LINUX /boot/Image
      APPEND ${cbootargs} root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4

LABEL test
      MENU LABEL usb external usb kernel
      LINUX /boot/Image-4.9.140-tegra-test
      APPEND ${cbootargs} root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4

With serial console you will then see either “internal” or “external” in the labels depending on which extlinux.conf is actually booting. Make sure the actual dtb file and “FDT” key/value pair entry are complete on the correct device.