Before you start debug
  • 20 Sep 2022
  • 8 Minutes to read
  • Dark
    Light
  • PDF

Before you start debug

  • Dark
    Light
  • PDF

Article summary

Nano change file

A very convenient way for changing file for Nano by using u-boot ums command.

U-Boot 2020.04-00006-gcc26e27576 (Aug 30 2022 - 18:00:28 +0800)

SoC: tegra210
Model: NVIDIA Jetson Nano Developer Kit
Board: NVIDIA P3450-0000
DRAM:  4 GiB
MMC:   sdhci@700b0000: 1, sdhci@700b0600: 0
Loading Environment from MMC... *** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   No ethernet found.
Hit any key to stop autoboot:  0 
Tegra210 (P3450-0000) # 
Tegra210 (P3450-0000) # mmc list
sdhci@700b0000: 1
sdhci@700b0600: 0 (eMMC)
Tegra210 (P3450-0000) # ums 0 0
UMS: LUN 0, dev 0, hwpart 0, sector 0x0, count 0x1d5a000
/
# plug the recovery cable, and see the block on host.
joezhang@home:~/workspace$ lsblk
NAME    MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0     7:0    0     4K  1 loop /snap/bare/5
loop1     7:1    0   114M  1 loop /snap/core/13425
loop2     7:2    0  63.2M  1 loop /snap/core20/1623
loop3     7:3    0 346.3M  1 loop /snap/gnome-3-38-2004/115
loop4     7:4    0  81.3M  1 loop /snap/gtk-common-themes/1534
loop5     7:5    0    48M  1 loop /snap/snapd/16778
loop6     7:6    0  49.8M  1 loop /snap/snap-store/467
loop7     7:7    0 400.8M  1 loop /snap/gnome-3-38-2004/112
loop8     7:8    0    62M  1 loop /snap/core20/1611
loop9     7:9    0    47M  1 loop /snap/snapd/16292
loop10    7:10   0  54.2M  1 loop /snap/snap-store/558
loop11    7:11   0  91.7M  1 loop /snap/gtk-common-themes/1535
loop12    7:12   0 114.9M  1 loop /snap/core/13741
loop13    7:13   0  55.6M  1 loop /snap/core18/2566
loop14    7:14   0  55.6M  1 loop /snap/core18/2560
loop15    7:15   0 255.6M  1 loop /snap/gnome-3-34-1804/36
loop16    7:16   0   219M  1 loop /snap/gnome-3-34-1804/77
loop17    7:17   0    14G  0 loop 
sda       8:0    0   1.8T  0 disk 
└─sda1    8:1    0   1.8T  0 part /home
sdb       8:16   0 232.9G  0 disk 
└─sdb1    8:17   0 232.9G  0 part /home/joezhang/extra_disk
sdc       8:32   0 931.5G  0 disk 
├─sdc1    8:33   0 119.2G  0 part [SWAP]
└─sdc2    8:34   0 812.3G  0 part /
sdf       8:80   1  14.7G  0 disk 
├─sdf1    8:81   1    14G  0 part 
├─sdf2    8:82   1     1M  0 part 
├─sdf3    8:83   1     6M  0 part 
├─sdf4    8:84   1    80K  0 part 
├─sdf5    8:85   1    64M  0 part 
├─sdf6    8:86   1     1M  0 part 
├─sdf7    8:87   1     6M  0 part 
├─sdf8    8:88   1    80K  0 part 
├─sdf9    8:89   1    64M  0 part 
├─sdf10   8:90   1   192K  0 part 
├─sdf11   8:91   1   256K  0 part 
├─sdf12   8:92   1    63M  0 part 
├─sdf13   8:93   1   512K  0 part 
├─sdf14   8:94   1   256K  0 part 
├─sdf15   8:95   1   256K  0 part 
├─sdf16 259:0    1   300M  0 part 
└─sdf17 259:1    1 185.4M  0 part 

Add another boot config

For Xavier-NX with emmc, it's risk for changing kernel Image and kernel device-tree.
There's no way to change single file in emmc when Xavier-NX can't boot into login prompt.

We highly recommend you to add another boot config for it.

So when you make mistake, you can boot by another boot config.
(Re-create system.img or flash whole system.img take a lot of time.)
And rename your test file before you copy into target folder.

$ vi /boot/extlinux/extlinux.conf
LABEL primary
      MENU LABEL primary kernel
      LINUX /boot/Image
      INITRD /boot/initrd
      FDT /boot/<target>.dtb
      APPEND ${cbootargs} ...

+ LABEL TEST_KERNEL
+      MENU LABEL TEST kernel
+      LINUX /boot/Image_test
+      INITRD /boot/initrd
+      FDT /boot/<target>_test.dtb
+      APPEND ${cbootargs} ...

When booting, select the TEST_KERNEL boot config by typing '2'

[0009.979] I> ########## Fixed storage boot ##########
[0009.984] I> Loading kernel-bootctrl from partition
[0009.989] I> Loading partition kernel-bootctrl at 0xa4b60000 from device(0x1)
[0010.003] W> tegrabl_get_kernel_bootctrl: magic number(0x00000000) is invalid
[0010.004] W> tegrabl_get_kernel_bootctrl: use default dummy boot control data
[0010.010] I> Already published: 00010003
[0010.013] I> Look for boot partition
[0010.017] I> Fallback: assuming 0th partition is boot partition
[0010.023] I> Detect filesystem
[0010.050] I> Loading extlinux.conf ...
[0010.050] I> Loading extlinux.conf binary from rootfs ...
[0010.050] I> rootfs path: /sdmmc_user/boot/extlinux/extlinux.conf
[0010.087] I> Loading extlinux.conf sig file from rootfs ...
[0010.088] I> rootfs path: /sdmmc_user/boot/extlinux/extlinux.conf.sig
[0010.118] I> overload load_size to 896 (from 1197)
[0010.119] I> Validate extlinux.conf ...
[0010.119] I> T19x: Authenticate extlinux.conf (bin_type: 54), max size 0x2000
[0010.120] E> digest on binary did not match!!
[0010.120] C> OEM authentication of extlinux.conf payload failed!
[0010.120] W> Failed to validate extlinux.conf binary from rootfs (err=1077936152, fail=0)
[0010.127] W> Security fuse not burned, ignore validation failure
[0010.133] I> restore load_size to 1197
[0010.136] I> L4T boot options
[0010.139] I> [1]: "primary kernel"
[0010.142] I> [2]: "TEST kernel"
[0012.493] I> Enter choice: 
[0160.445] I> Selected option: 2
[0160.445] I> Loading kernel ...
[0160.446] I> Loading kernel binary from rootfs ...
[0160.446] I> rootfs path: /sdmmc_user/boot/Image_test
[0160.869] I> Loading kernel sig file from rootfs ...
[0160.870] I> rootfs path: /sdmmc_user/boot/Image_test.sig
[0167.069] I> lookup_linear_dir:447: Invalid file block num
[0167.069] I> ext2_walk:142: 'Image_test.sig' lookup failed
[0167.070] I> ext4_open_file:666: '/boot/Image_test.sig' lookup failed
[0167.070] E> file /sdmmc_user/boot/Image_test.sig open failed!!
[0167.071] W> Failed to load kernel sig file (err=202113041)
[0167.072] I> Validate kernel ...
[0167.075] I> T19x: Authenticate kernel (bin_type: 37), max size 0x5000000
[0167.081] E> Stage2Signature validation failed with SHA2!!
[0167.087] C> OEM authentication of kernel header failed!
[0167.092] W> Failed to validate kernel binary from rootfs (err=1077936152, fail=1)
[0167.099] W> Security fuse not burned, ignore validation failure
[0167.105] I> restore load_size to 34861064
[0167.126] I> Loading kernel-dtb ...
[0167.126] I> Loading kernel-dtb binary from rootfs ...
[0167.127] I> rootfs path: /sdmmc_user/boot/tegra194-p3668-tek8-nx210v-a1_test.dtb
[0167.153] I> Loading kernel-dtb sig file from rootfs ...
[0167.154] I> rootfs path: /sdmmc_user/boot/tegra194-p3668-tek8-nx210v-a1_test.dtb.sig
[0173.351] I> lookup_linear_dir:447: Invalid file block num
[0173.351] I> ext2_walk:142: 'tegra194-p3668-tek8-nx210v-a1_test.dtb.sig' lookup failed
[0173.352] I> ext4_open_file:666: '/boot/tegra194-p3668-tek8-nx210v-a1_test.dtb.sig' lookup failed
[0173.352] E> file /sdmmc_user/boot/tegra194-p3668-tek8-nx210v-a1_test.dtb.sig open failed!!
[0173.357] W> Failed to load kernel-dtb sig file (err=202113041)
[0173.362] I> Validate kernel-dtb ...

Boot from SD card rootfs

# Formate SD card
# sbx is the your SD device showing by 'lsblk'
$ sudo parted /dev/<sdx> mklabel gpt
$ sudo parted /dev/<sdx> mkpart APP 0GB 32GB
$ sudo mkfs.ext4 /dev/<sdx>1

# sync the files with system.img.raw
$ sudo mkdir tmp_system
$ sudo mkdir mnt
$ sudo mount /dev/<sdx>1 mnt
$ sudo mount bootloader/system.img.raw ./tmp_system
$ sudo rsync -axHAWX --numeric-ids --info=progress2 --exclude=/proc ./tmp_system/ ./mnt
$ sudo umount ./mnt
$ sudo umount ./tmp_system

Add new default rootfs to sd card, add plug the sd card you jush flash.
(/dev/mmcblk1p1)

$ vi /boot/extlinux/extlinux.conf
LABEL primary
      MENU LABEL primary kernel
      LINUX /boot/Image
      INITRD /boot/initrd
      FDT /boot/<target>.dtb
      APPEND ${cbootargs} root=/dev/mmcblk0p1 ...

+ LABEL TEST_ROOTFS
+      MENU LABEL TEST rootfs
+      LINUX /boot/Image
+      INITRD /boot/initrd
+      FDT /boot/<target>.dtb
+      APPEND ${cbootargs} root=/dev/mmcblk1p1 ...

After select the boot option for '2', it select the rootfs from /dev/mmcblk1p1, which is sd card.

[0010.123] I> L4T boot options
[0010.126] I> [1]: "primary kernel"
[0010.129] I> [2]: "TEST rootfs"
[0010.132] I> Enter choice: 
[0010.135] I> Selected option: 2
....
[    9.848232] Root device found: mmcblk1p1
[    9.850335] Found dev node: /dev/mmcblk1p1
[   10.592586] EXT4-fs (mmcblk1p1): recovery complete
[   10.593872] EXT4-fs (mmcblk1p1): mounted filesystem with ordered data mode. Opts: (null)
[   10.597043] Rootfs mounted over mmcblk1p1
[   10.612833] Switching from initrd to actual rootfs
[   10.834485] ip_tables: (C) 2000-2006 Netfilter Core Team

Boot from USB stick

Another way for safety boot is using USB stick boot.

# Formate USB stick
# sbx is the your USB device showing by 'lsblk'
$ sudo parted /dev/<sdx> mklabel gpt
$ sudo parted /dev/<sdx> mkpart APP 0GB 32GB
$ sudo mkfs.ext4 /dev/<sdx>1

# create system.img with USB boot config
$ sudo BOOTDEV=sda1 ./flash.sh --no-flash jetson-xavier-nx-devkit sda1

# sync the files with system.img.raw
$ sudo mkdir tmp_system
$ sudo mkdir mnt
$ sudo mount /dev/<sdx>1 mnt
$ sudo mount bootloader/system.img.raw ./tmp_system
$ sudo rsync -axHAWX --numeric-ids --info=progress2 --exclude=/proc ./tmp_system/ ./mnt
$ sudo umount ./mnt
$ sudo umount ./tmp_system

Plug USB stick and you can see it goes to booting USB, and success.
When Changing rootfs file, we recommend you to use USB rootfs rather than emmc rootfs.

I> ########## USB (0) boot ##########
W> No valid slot number is found in scratch register
W> Return default slot: _a
I> Validate XUSB-FW ...
I> T19x: Authenticate XUSB-FW (bin_type: 11), max size 0x30000
I> Encryption fuse is not ON
I> USB Firmware Version: 60.09 release
I> regulator of usb2-0 already enabled
I> regulator of usb2-1 already enabled
I> regulator of usb2-2 already enabled
I> USB 2.0 port 2 new high-speed USB device detected
W> WARNING: event and command not matching, cmd_trb_ptr = 0xa4ad8000, cmd_ring.dma = 0xa4ad80c0
I> Start to enumerate device
W> WARNING: event and command not matching, cmd_trb_ptr = 0xa4ad8000, cmd_ring.dma = 0xa4ad80c0
I> 
I> Enumerated USB Device 0424:2807
I> 
I> Hub:
I>      Downstream ports        : 7
I>      Power switching         : Ganged
I>      Compound device         : No
I>      Over-current protection : Global
I>      Hub avg delay           : 4 ns
I> Set interface = 1 (alt setting)
I> Enable hub ports
I> Device detected on port 6
I> Reset port 6
W> WARNING: event and command not matching, cmd_trb_ptr = 0xa4ad8000, cmd_ring.dma = 0xa4ad80c0
I> Start to enumerate device
W> WARNING: event and command not matching, cmd_trb_ptr = 0xa4ad8000, cmd_ring.dma = 0xa4ad80c0
W> WARNING: event and command not matching, cmd_trb_ptr = 0xa4ad8100, cmd_ring.dma = 0xa4ad80c0
I> 
I> Enumerated USB Device 8564:1000
I> 
I> Max LUN = 0
I> Vendor Identification   :  JetFlash
I> Product Identification  :  Transcend 32GB  
I> Product Revision Level  :  1100
I> READ CAPACITY - last LBA = 61132800, 29850MB
I> -0 params source = 
I> Found 1 partitions in USB_MS (instance 0)
I> Look for boot partition
I> Fallback: assuming 0th partition is boot partition
I> Detect filesystem
I> Loading kernel-bootctrl from partition
I> Loading partition kernel-bootctrl at 0xa4b80000 from device(0x1)
W> tegrabl_get_kernel_bootctrl: magic number(0x00000000) is invalid
W> tegrabl_get_kernel_bootctrl: use default dummy boot control data
I> Loading extlinux.conf ...
I> Loading extlinux.conf binary from rootfs ...
I> rootfs path: /usb/boot/extlinux/extlinux.conf
I> Loading extlinux.conf sig file from rootfs ...
I> rootfs path: /usb/boot/extlinux/extlinux.conf.sig
I> Validate extlinux.conf ...
I> T19x: Authenticate extlinux.conf (bin_type: 54), max size 0x2000
I> Encryption fuse is not ON
I> L4T boot options
I> [1]: "primary kernel"
I> Enter choice: 
[0011.000] I> Continuing with default option: 1

Was this article helpful?