Howto update DTB on Jetson Nano

How do you update the DTB on the Jetson Nano?

From what I can gather, when I re-build the kernel for the Nano, it is using this top level dts file:
<nvidia_install>/nvidia_sdk/JetPack_4.2_Linux_P3448/Linux_for_Tegra/sources/hardware/nvidia/platform/t210/porg/kernel-dts/tegra210-p3448-0000-p3449-0000-a02.dts

I added another dtsi fragment to this dts file and re-build the kernel. After re-building the kernel the updated dtb files appear in:
<kernel_build>/arch/arm64/boot/dts

It looks like sda10 is the DTB partition. So I tried to do the following:
dd if=tegra210-p3448-0000-p3449-0000-a02.dtb of=/dev/sdb10

Now the unit won’t boot. Tegraboot complains the DTB file doesn’t exist. This page talks about the various partitions. It looks like in the DTB partition there are 2 DTB files. One for the Tegraboot and one for the Kernel.

Any ideas?

It appears there are some headers in front of the DTB when in the partition. I just need to find a tool to generate this block.

00000000  00 00 00 00 44 54 42 00  00 15 03 00 00 00 00 00  |....DTB.........|
00000010  b1 ba ef be ad de ed fe  aa aa aa aa aa aa aa aa  |................|
00000020  aa aa aa aa aa aa aa aa  aa aa aa aa aa aa aa aa  |................|
*
00000110  aa aa aa aa aa aa aa aa  92 06 87 fe 95 b8 30 e7  |..............0.|
00000120  7a 7d db d1 0a 3e fe 13  ee ee ee ee ee ee ee ee  |z}...>..........|
00000130  ee ee ee ee ee ee ee ee  ee ee ee ee ee ee ee ee  |................|
*
00000220  ee ee ee ee ee ee ee ee  00 00 00 00 00 00 00 00  |................|
00000230  cc cc cc cc cc cc cc cc  cc cc cc cc cc cc cc cc  |................|
00000240  00 15 03 00 00 00 00 00  b1 ba ef be ad de ed fe  |................|
00000250  b1 ba ef be ad de ed fe  00 00 00 00 00 00 00 00  |................|
00000260  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000400  d0 0d fe ed 00 03 10 f4  00 00 00 48 00 02 ca 08  |...........H....|
00000410  00 00 00 28 00 00 00 11  00 00 00 10 00 00 00 00  |...(............|
00000420  00 00 46 ec 00 02 c9 c0  00 00 00 00 80 00 00 00  |..F.............|
00000430  00 00 00 00 00 02 00 00  00 00 00 00 00 00 00 00  |................|
00000440  00 00 00 00 00 00 00 00  00 00 00 01 00 00 00 00  |................|
00000450  00 00 00 03 00 00 00 23  00 00 00 00 6e 76 69 64  |.......#....nvid|
00000460  69 61 2c 6a 65 74 73 6f  6e 2d 6e 61 6e 6f 00 6e  |ia,jetson-nano.n|
00000470  76 69 64 69 61 2c 74 65  67 72 61 32 31 30 00 00  |vidia,tegra210..|

I haven’t looked specifically at the Nano, but understand that in all of the semi-recent releases (and Nano is a very recent release) device trees and other partitions are signed. If you flash using flash.sh on command line (and if you’ve used SDK Manager, then it would have installed this for you in the “Linux_for_Tegra/” subdirectory), you can modify like this to avoid actual flash (and yet get a signed tree):

sudo ./flash.sh -r <b>--no-flash</b> ...your usual target information...

When you use tegraflash.py directly, then you can use the “–keep” argument. “flash.sh” itself is human readable, and if you have an opportunity to edit if the options present are not enough.

Correctly signed trees, if they fit in the available space, can be added with dd.

Thanks for the info. Here is what I’ve tried, but it still doesn’t sign the file.

sudo ./flash.sh -r --no-flash -d sources/kernel/kernel-4.9/build/arch/arm64/boot/dts/tegra210-p3448-0000-p3449-0000-a02.dtb jetson-nano-qspi-sd sdb

This does take my dtb file and creates two files in the bootloader directory:
tegra210-p3448-0000-p3449-0000-a02.dtb
tegra210-p3448-0000-p3449-0000-a02.dtb.sb

The two files above are identical, but they are different than the file I specified in the flash.sh command. Also, neither of the two files above have the header information present as shown in my previous post.

dtb_files.7z (29.6 KB)

@Shadowmind

  1. Replace the dtb file “tegra210-p3448-0000-p3449-0000-a02.dtb” at …/nvidia_sdk/JetPack_4.2_Linux_P3448/Linux_for_Tegra/kernel/dtb/ then issue below command to update the dtb partition.

sudo ./flash.sh -r -k DTB jetson-nano-qspi-sd mmcblk0p1

  1. Try to add below to /boot/extlinux/extlinux.conf to apply your dtb
    FDT /boot/xxxxx.dtb

I replaced the tegra210-p3448-0000-p3449-0000-a02.dtb in the /nvidia_sdk/JetPack_4.2_Linux_P3448/Linux_for_Tegra/kernel/dtb/ directory. But when I run the flash.sh script, it always hangs with the following information below:

~/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3448/Linux_for_Tegra$ sudo ./flash.sh -r -k DTB jetson-nano-qspi-sd mmcblk0p1
###############################################################################
# L4T BSP Information:
# R32 (release), REVISION: 1.0, GCID: 14531094, BOARD: t210ref, EABI: aarch64, 
# DATE: Wed Mar 13 07:46:13 UTC 2019
###############################################################################
# Target Board Information:
# Name: jetson-nano-qspi-sd, Board Family: t210ref, SoC: Tegra 210, 
# OpMode: production, Boot Authentication: , 
###############################################################################
./tegraflash.py --chip 0x21 --applet "/home/nlbutts/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3448/Linux_for_Tegra/bootloader/nvtboot_recovery.bin" --skipuid --cmd "dump eeprom boardinfo cvm.bin" 
Welcome to Tegra Flash
version 1.0.0
Type ? or help for help and q or quit to exit
Use ! to execute system commands
 
[   0.0035 ] Generating RCM messages
[   0.0046 ] tegrarcm --listrcm rcm_list.xml --chip 0x21 0 --download rcm /home/nlbutts/nvidia/nvidia_sdk/JetPack_4.2_Linux_P3448/Linux_for_Tegra/bootloader/nvtboot_recovery.bin 0 0
[   0.0054 ] RCM 0 is saved as rcm_0.rcm
[   0.0060 ] RCM 1 is saved as rcm_1.rcm
[   0.0060 ] List of rcm files are saved in rcm_list.xml
[   0.0060 ] 
[   0.0060 ] Signing RCM messages
[   0.0069 ] tegrasign --key None --list rcm_list.xml --pubkeyhash pub_key.key
[   0.0078 ] Assuming zero filled SBK key
[   0.0127 ] 
[   0.0128 ] Copying signature to RCM mesages
[   0.0139 ] tegrarcm --chip 0x21 0 --updatesig rcm_list_signed.xml
[   0.0157 ] 
[   0.0157 ] Boot Rom communication
[   0.0170 ] tegrarcm --chip 0x21 0 --rcm rcm_list_signed.xml --skipuid

I’ve read that this doesn’t work correctly in a VM. I’m running Ubuntu 16.04 in VirtualBox 5.2.18. I do see the Nano enumerate as a USB device and it does appear the flash tool can start to talk to the Nano, but it will not transfer any data.

If I run the create-jetson-nano-sd-card-image.sh script, it will create the tegra210-p3448-0000-p3449-0000-a02.dtb.encrypt file in the JetPack_4.2_Linux_P3448/Linux_for_Tegra/bootloader/signed directory. This file is formatted in a way that looks similar to the partition I dumped.

There must be a more straightforward way to generate this signed file?
Can you confirm the USB recovery interface does NOT work in a VM, if so, why?

I have same question with OP. Is there anyway to natively compile and flash dtb from my jetson nano dev. board? I do not want a ‘host’ development machine get involved in this case.

You can compile the kernel/dtb on the nano I have done this. However currently flashing the dtb requires a host machine as the nano needs to be booted into recovery mode.

@jas-mx Actually what I need is simply modify/compile/locate the kernel/dtb on my jetson nano for development purpose. I do not need signature the blob and mass production stuff. Current dtb flash process is a little complex.

You should be able to add the header information to the DTB file (see my post above) and then dd that file into mmcblk0p10.

dd if=new_dtb_partition.bin of=/dev/mmcblk0p10

You could try just inserting your new DTB file from memory location 0x400 and beyond in the binary partition file. This would allow you to update the DTB partition on the Nano without using a host PC.

@Shadowmind, Thanks for the response. I will have a try with your trick and give feedback here soon. BTW, Does your trick means that content of this leading 0x400 bytes ‘header’ in dtb partition will be fixed and never altered per change of dtb blob?

So, I tried to keep the top 0x400 bytes and just replace the bottom section with a “signed and encrypted” DTB file. Tegraboot compiled about something. This is what I put in my Readme file:

Currently this is how I update the DTB:
For the Jetson Nano, the root DTS file is located here:
<install>/nvidia_sdk/JetPack_4.2_Linux_P3448/Linux_for_Tegra/sources/hardware/nvidia/platform/t210/porg/kernel-dts

The current Jetson Nano rev uses **tegra210-p3448-0000-p3449-0000-a02.dts**

Modify that file and the files it includes (DTSI). When you build the kernel it
will build the DTS files into DTB files. The resulting DTB file is located here
(assuming you use the **build** directory above)
<install>/nvidia_sdk/JetPack_4.2_Linux_P3448/Linux_for_Tegra/sources/kernel/kernel-4.9/build/arch/arm64/boot/dts

Now comes the hard part. The DTB file needs to be placed into a partition header
and signed/encrypted. The only way I've found to do this is to copy the DTB file
here:
<install>/nvidia_sdk/JetPack_4.2_Linux_P3448/Linux_for_Tegra/kernel/dtb

Then run:

sudo ./create-jetson-nano-sd-card-image.sh -o sd-blob.img -s 4G -r 200

This will create an IMG file that can be programmed into an SD card or the internal
eMMC on the actual SOM. In the process of creating the IMG file it will take
the DTB file and place the signed copy here:
<install>/nvidia_sdk/JetPack_4.2_Linux_P3448/Linux_for_Tegra/bootloader/signed/tegra210-p3448-0000-p3449-0000-a02.dtb.encryptQ

Pull the SD card out of the Nano and put into your Linux machine (share the USB into the VM).
Now the following in the **bootloader/signed** directory.

sudo dd if=tegra210-p3448-0000-p3449-0000-a02.dtb.encrypt of=/dev/sdx10


This will program the DTB file into the partition. Put the SD card back in the
Nano and reboot.

@Shadowmind" Thanks for answers.
So we still need a host linux machine to install sdk and make dtb “signed and encrypted”, and then copy this “signed and encrypted” dtb file to jetson nano, and “dd” it to dtb partition on sd card?

@shaneCCC

hispacen1n@ubuntu:~/Downloads$ cp modified-gpio.dtb ~/Downloads/nvidia/Linux_for_Tegra/kernel/dtb/tegra210-p3448-0000-p3449-0000-a02.dtb
hispacen1n@ubuntu:~/Downloads$ ls
extlinux.conf  extracted2.dts  extracted.dts  modified-gpio.dtb  nvidia
hispacen1n@ubuntu:~/Downloads$ lsusb 
Bus 001 Device 013: ID 0955:7f21 NVidia Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
hispacen1n@ubuntu:~/Downloads$ cd nvidia/Linux_for_Tegra/
hispacen1n@ubuntu:~/Downloads/nvidia/Linux_for_Tegra$ ls
apply_binaries.sh                    flash.sh                  kernel           p2371-2180.conf              p3448-0000.conf.common  TX1_boot-firmware-redundancy.txt
bootloader                           jetson-nano-qspi.conf     lib              p2371-2180-devkit-24x7.conf  p3448-0000-sd.conf
create-jetson-nano-sd-card-image.sh  jetson-nano-qspi-sd.conf  nv_tegra         p2371-2180-devkit.conf       rootfs
elf-get-entry.py                     jetson-tx1.conf           p2371-0000.conf  p3448-0000.conf              source_sync.sh
hispacen1n@ubuntu:~/Downloads/nvidia/Linux_for_Tegra$ sudo ./flash.sh -r -k DTB jetson-nano-qspi-sd mmcblk0p1
[sudo] password for hispacen1n: 
###############################################################################
# L4T BSP Information:
# Unknown Release
###############################################################################
# Target Board Information:
# Name: jetson-nano-qspi-sd, Board Family: t210ref, SoC: Tegra 210, 
# OpMode: production, Boot Authentication: , 
###############################################################################
./tegraflash.py --chip 0x21 --applet "/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/nvtboot_recovery.bin" --skipuid --cmd "dump eeprom boardinfo cvm.bin" 
Welcome to Tegra Flash
version 1.0.0
Type ? or help for help and q or quit to exit
Use ! to execute system commands
 
[   0.0498 ] Generating RCM messages
[   0.1329 ] tegrarcm --listrcm rcm_list.xml --chip 0x21 0 --download rcm /home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/nvtboot_recovery.bin 0 0
[   0.1367 ] RCM 0 is saved as rcm_0.rcm
[   0.3083 ] RCM 1 is saved as rcm_1.rcm
[   0.3084 ] List of rcm files are saved in rcm_list.xml
[   0.3084 ] 
[   0.3085 ] Signing RCM messages
[   0.3127 ] tegrasign --key None --list rcm_list.xml --pubkeyhash pub_key.key
[   0.3703 ] Assuming zero filled SBK key
[   0.4683 ] 
[   0.4684 ] Copying signature to RCM mesages
[   0.4697 ] tegrarcm --chip 0x21 0 --updatesig rcm_list_signed.xml
[   0.5088 ] 
[   0.5089 ] Boot Rom communication
[   0.5103 ] tegrarcm --chip 0x21 0 --rcm rcm_list_signed.xml --skipuid
[   0.5127 ] RCM version 0X210001
[   0.9497 ] Boot Rom communication completed
[   1.9980 ] 
[   1.9982 ] dump EEPROM info
[   1.9994 ] tegrarcm --oem platformdetails eeprom /home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/cvm.bin
[   2.0050 ] Applet version 00.01.0000
[   2.1416 ] Saved platform info in /home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/cvm.bin
[   2.2812 ] 
Board ID(3448) version(200) 
copying bctfile(/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/t210ref/BCT/P3448_A00_4GB_Micron_4GB_lpddr4_204Mhz_P987.cfg)... done.
copying bootloader(/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/t210ref/cboot.bin)... done.
	populating kernel to rootfs... done.
	populating initrd to rootfs... done.
	populating extlinux.conf.emmc to rootfs... done.
	populating /home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/kernel/dtb/tegra210-p3448-0000-p3449-0000-a02.dtb to rootfs... done.
done.
Making Boot image... done.
head: cannot open '/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/rootfs/etc/nv_tegra_release' for reading: No such file or directory
Existing sosfile(/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/nvtboot_recovery.bin) reused.
copying tegraboot(/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/t210ref/nvtboot.bin)... done.
copying cpu_bootloader(/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/t210ref/cboot.bin)... done.
copying bpffile(/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/t210ref/sc7entry-firmware.bin)... done.
Existing badpagefile(/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/badpage.bin) reused.
copying wb0boot(/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/t210ref/warmboot.bin)... done.
Existing tosfile(/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/tos-mon-only.img) reused.
Existing eksfile(/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/eks.img) reused.
copying dtbfile(/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/kernel/dtb/tegra210-p3448-0000-p3449-0000-a02.dtb)... done.
Reusing existing system.img... 
done.
Existing tbcfile(/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/nvtboot_cpu.bin) reused.
copying tbcdtbfile(/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/kernel/dtb/tegra210-p3448-0000-p3449-0000-a02.dtb)... done.
copying cfgfile(/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/t210ref/cfg/flash_l4t_t210_spi_sd_p3448.xml) to flash.xml... done.
copying flasher(/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/t210ref/cboot.bin)... done.
Existing flashapp(/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/tegraflash.py) reused.
*** Updating [DTB] with tegra210-p3448-0000-p3449-0000-a02.dtb ***
./tegraflash.py --bl cboot.bin --bldtb tegra210-p3448-0000-p3449-0000-a02.dtb  --chip 0x21 --applet nvtboot_recovery.bin --bct  P3448_A00_4GB_Micron_4GB_lpddr4_204Mhz_P987.cfg  --cfg  flash.xml   --cmd "sign; write DTB ./signed/tegra210-p3448-0000-p3449-0000-a02.dtb.encrypt; reboot"  
Welcome to Tegra Flash
version 1.0.0
Type ? or help for help and q or quit to exit
Use ! to execute system commands
 
[   0.1075 ] Generating RCM messages
[   0.1086 ] tegrarcm --listrcm rcm_list.xml --chip 0x21 0 --download rcm nvtboot_recovery.bin 0 0
[   0.1096 ] RCM 0 is saved as rcm_0.rcm
[   0.1106 ] RCM 1 is saved as rcm_1.rcm
[   0.1115 ] List of rcm files are saved in rcm_list.xml
[   0.1224 ] 
[   0.1225 ] Signing RCM messages
[   0.1448 ] tegrasign --key None --list rcm_list.xml --pubkeyhash pub_key.key
[   0.1460 ] Assuming zero filled SBK key
[   0.1687 ] 
[   0.1695 ] Copying signature to RCM mesages
[   0.1708 ] tegrarcm --chip 0x21 0 --updatesig rcm_list_signed.xml
[   0.1923 ] 
[   0.1924 ] Parsing partition layout
[   0.2202 ] tegraparser --pt flash.xml.tmp
[   0.3066 ] 
[   0.3068 ] Creating list of images to be signed
[   0.3510 ] tegrahost --chip 0x21 0 --partitionlayout flash.xml.bin --list images_list.xml
[   0.5400 ] 
[   0.5402 ] Generating signatures
[   0.5411 ] tegrasign --key None --list images_list.xml --pubkeyhash pub_key.key
[   0.5420 ] Assuming zero filled SBK key
[   0.6840 ] 
[   0.6841 ] Generating br-bct
[   0.6852 ] tegrabct --bct P3448_A00_4GB_Micron_4GB_lpddr4_204Mhz_P987.cfg --chip 0x21 0
[   0.7038 ] Copying Sdram info from 0 to 1 set
[   0.8922 ] Copying Sdram info from 1 to 2 set
[   0.8938 ] Copying Sdram info from 2 to 3 set
[   0.9041 ] 
[   0.9045 ] Updating boot device parameters
[   0.9071 ] tegrabct --bct P3448_A00_4GB_Micron_4GB_lpddr4_204Mhz_P987.bct --chip 0x21 0 --updatedevparam flash.xml.bin
[   0.9110 ] Warning: No sdram params
[   0.9520 ] 
[   0.9522 ] Updating bl info
[   0.9535 ] tegrabct --bct P3448_A00_4GB_Micron_4GB_lpddr4_204Mhz_P987.bct --chip 0x21 0 --updateblinfo flash.xml.bin --updatesig images_list_signed.xml
[   0.9949 ] 
[   0.9951 ] Updating secondary storage information into bct
[   0.9960 ] tegraparser --pt flash.xml.bin --chip 0x21 0 --updatecustinfo P3448_A00_4GB_Micron_4GB_lpddr4_204Mhz_P987.bct
[   1.0129 ] 
[   1.0129 ] Get Signed section of bct
[   1.0139 ] tegrabct --bct P3448_A00_4GB_Micron_4GB_lpddr4_204Mhz_P987.bct --chip 0x21 0 --listbct bct_list.xml
[   1.0283 ] 
[   1.0284 ] Signing BCT
[   1.0329 ] tegrasign --key None --list bct_list.xml --pubkeyhash pub_key.key
[   1.0338 ] Assuming zero filled SBK key
[   1.0515 ] 
[   1.0516 ] Updating BCT with signature
[   1.0527 ] tegrabct --bct P3448_A00_4GB_Micron_4GB_lpddr4_204Mhz_P987.bct --chip 0x21 0 --updatesig bct_list_signed.xml
[   1.0692 ] 
[   1.0692 ] Copying signatures
[   1.0703 ] tegrahost --chip 0x21 0 --partitionlayout flash.xml.bin --updatesig images_list_signed.xml
[   1.0962 ] 
[   1.0966 ] Copying signed file in /home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/signed
[   1.1339 ] Generating RCM messages
[   1.1351 ] tegrarcm --listrcm rcm_list.xml --chip 0x21 0 --download rcm nvtboot_recovery.bin 0 0
[   1.1404 ] RCM 0 is saved as rcm_0.rcm
[   1.1433 ] RCM 1 is saved as rcm_1.rcm
[   1.1464 ] List of rcm files are saved in rcm_list.xml
[   1.1610 ] 
[   1.1611 ] Signing RCM messages
[   1.1625 ] tegrasign --key None --list rcm_list.xml --pubkeyhash pub_key.key
[   1.1652 ] Assuming zero filled SBK key
[   1.1887 ] 
[   1.1887 ] Copying signature to RCM mesages
[   1.1898 ] tegrarcm --chip 0x21 0 --updatesig rcm_list_signed.xml
[   1.2065 ] 
[   1.2067 ] Boot Rom communication
[   1.2077 ] tegrarcm --chip 0x21 0 --rcm rcm_list_signed.xml
[   1.2090 ] BootRom is not running
[   1.7779 ] 
[   1.7780 ] Parsing partition layout
[   1.8029 ] tegraparser --pt flash.xml.tmp
[   1.8422 ] 
[   1.8425 ] Creating list of images to be signed
[   1.8485 ] tegrahost --chip 0x21 0 --partitionlayout flash.xml.bin --list images_list.xml
[   1.9201 ] 
[   1.9203 ] Generating signatures
[   1.9374 ] tegrasign --key None --list images_list.xml --pubkeyhash pub_key.key
[   1.9419 ] Assuming zero filled SBK key
[   2.0561 ] 
[   2.0562 ] Send BCT from Host
[   2.0562 ] Generating br-bct
[   2.0573 ] tegrabct --bct P3448_A00_4GB_Micron_4GB_lpddr4_204Mhz_P987.cfg --chip 0x21 0
[   2.0583 ] Copying Sdram info from 0 to 1 set
[   2.0601 ] Copying Sdram info from 1 to 2 set
[   2.0646 ] Copying Sdram info from 2 to 3 set
[   2.0734 ] 
[   2.0735 ] Updating boot device parameters
[   2.0745 ] tegrabct --bct P3448_A00_4GB_Micron_4GB_lpddr4_204Mhz_P987.bct --chip 0x21 0 --updatedevparam flash.xml.bin
[   2.0755 ] Warning: No sdram params
[   2.0881 ] 
[   2.0882 ] Updating bl info
[   2.0893 ] tegrabct --bct P3448_A00_4GB_Micron_4GB_lpddr4_204Mhz_P987.bct --chip 0x21 0 --updateblinfo flash.xml.bin --updatesig images_list_signed.xml
[   2.1040 ] 
[   2.1058 ] Updating secondary storage information into bct
[   2.1075 ] tegraparser --pt flash.xml.bin --chip 0x21 0 --updatecustinfo P3448_A00_4GB_Micron_4GB_lpddr4_204Mhz_P987.bct
[   2.1217 ] 
[   2.1224 ] Get Signed section of bct
[   2.1236 ] tegrabct --bct P3448_A00_4GB_Micron_4GB_lpddr4_204Mhz_P987.bct --chip 0x21 0 --listbct bct_list.xml
[   2.1370 ] 
[   2.1387 ] Signing BCT
[   2.1413 ] tegrasign --key None --list bct_list.xml --pubkeyhash pub_key.key
[   2.1446 ] Assuming zero filled SBK key
[   2.1622 ] 
[   2.1623 ] Updating BCT with signature
[   2.1634 ] tegrabct --bct P3448_A00_4GB_Micron_4GB_lpddr4_204Mhz_P987.bct --chip 0x21 0 --updatesig bct_list_signed.xml
[   2.1787 ] 
[   2.1788 ] Sending BCTs
[   2.1806 ] tegrarcm --download bct P3448_A00_4GB_Micron_4GB_lpddr4_204Mhz_P987.bct
[   2.1830 ] Applet version 00.01.0000
[   2.3366 ] Sending bct
[   2.3367 ] [................................................] 100%
[   2.4587 ] 
[   2.4588 ] Sending bootloader and pre-requisite binaries
[   2.4599 ] tegrarcm --download ebt cboot.bin 0 0 --download rp1 tegra210-p3448-0000-p3449-0000-a02.dtb 0
[   2.4610 ] Applet version 00.01.0000
[   2.5980 ] Sending ebt
[   2.5984 ] [................................................] 100%
[   2.7741 ] Sending rp1
[   2.7942 ] [................................................] 100%
[   2.9980 ] 
[   3.0042 ] tegrarcm --boot recovery
[   3.0094 ] Applet version 00.01.0000
[   3.1967 ] 
[   3.1968 ] Writing partition
[   3.1978 ] tegradevflash --write DTB /home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/signed/tegra210-p3448-0000-p3449-0000-a02.dtb.encrypt
[   3.2213 ] Cboot version 00.01.0000
[   4.0749 ] Writing partition DTB with /home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/signed/tegra210-p3448-0000-p3449-0000-a02.dtb.encrypt
[   4.0881 ] 00000004: Filesize is bigger than partition size
[   4.1374 ] 
Error: Return value 4
Command tegradevflash --write DTB /home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/signed/tegra210-p3448-0000-p3449-0000-a02.dtb.encrypt
Failed to flash/read t210ref.

Looks like the modify dtb size is bigger.

00000004: Filesize is bigger than partition size

i flashed the dtb file successfully,but it got stuck when i reboot.

<pre><font color="#8AE234"><b>hispacen1n@ubuntu</b></font>:<font color="#729FCF"><b>~/Downloads/nvidia/Linux_for_Tegra</b></font>$ sudo ./flash.sh -r -k DTB jetson-nano-qspi-sd mmcblk0p1
###############################################################################
# L4T BSP Information:
# Unknown Release
###############################################################################
# Target Board Information:
# Name: jetson-nano-qspi-sd, Board Family: t210ref, SoC: Tegra 210, 
# OpMode: production, Boot Authentication: , 
###############################################################################
./tegraflash.py --chip 0x21 --applet "/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/nvtboot_recovery.bin" --skipuid --cmd "dump eeprom boardinfo cvm.bin" 
Welcome to Tegra Flash
version 1.0.0
Type ? or help for help and q or quit to exit
Use ! to execute system commands
 
[   0.0086 ] Generating RCM messages
[   0.0103 ] tegrarcm --listrcm rcm_list.xml --chip 0x21 0 --download rcm /home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/nvtboot_recovery.bin 0 0
[   0.0124 ] RCM 0 is saved as rcm_0.rcm
[   0.0421 ] RCM 1 is saved as rcm_1.rcm
[   0.0422 ] List of rcm files are saved in rcm_list.xml
[   0.0422 ] 
</pre>
.....
[   3.4662 ] Coldbooting the device
[   3.4759 ] tegradevflash --reboot coldboot
[   3.4898 ] Cboot version 00.01.0000
[   3.6804 ] 
*** The [DTB] has been updated successfully. ***

You may need to narrow what you modify the dtb.

hispacen1n@ubuntu:~/Downloads/nvidia/Linux_for_Tegra$ lsusb 
Bus 001 Device 004: ID 0955:7f21 NVidia Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
hispacen1n@ubuntu:~/Downloads/nvidia/Linux_for_Tegra$ sudo ./flash.sh -r -k DTB jetson-nano-qspi-sd mmcblk0p1
###############################################################################
# L4T BSP Information:
# Unknown Release
###############################################################################
# Target Board Information:
# Name: jetson-nano-qspi-sd, Board Family: t210ref, SoC: Tegra 210, 
# OpMode: production, Boot Authentication: , 
###############################################################################
./tegraflash.py --chip 0x21 --applet "/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/nvtboot_recovery.bin" --skipuid --cmd "dump eeprom boardinfo cvm.bin" 
Welcome to Tegra Flash
version 1.0.0
Type ? or help for help and q or quit to exit
Use ! to execute system commands
 
[   0.0086 ] Generating RCM messages
[   0.0103 ] tegrarcm --listrcm rcm_list.xml --chip 0x21 0 --download rcm /home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/nvtboot_recovery.bin 0 0
[   0.0124 ] RCM 0 is saved as rcm_0.rcm
[   0.0421 ] RCM 1 is saved as rcm_1.rcm
[   0.0422 ] List of rcm files are saved in rcm_list.xml
[   0.0422 ] 
[   0.0423 ] Signing RCM messages
[   0.0435 ] tegrasign --key None --list rcm_list.xml --pubkeyhash pub_key.key
[   0.0553 ] Assuming zero filled SBK key
[   0.0914 ] 
[   0.0915 ] Copying signature to RCM mesages
[   0.0927 ] tegrarcm --chip 0x21 0 --updatesig rcm_list_signed.xml
[   0.0995 ] 
[   0.0997 ] Boot Rom communication
[   0.1019 ] tegrarcm --chip 0x21 0 --rcm rcm_list_signed.xml --skipuid
[   0.1031 ] RCM version 0X210001
[   0.4103 ] Boot Rom communication completed
[   1.4524 ] 
[   1.4532 ] dump EEPROM info
[   1.4705 ] tegrarcm --oem platformdetails eeprom /home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/cvm.bin
[   1.4774 ] Applet version 00.01.0000
[   1.6570 ] Saved platform info in /home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/cvm.bin
[   1.7945 ] 
Board ID(3448) version(200) 
copying bctfile(/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/t210ref/BCT/P3448_A00_4GB_Micron_4GB_lpddr4_204Mhz_P987.cfg)... done.
copying bootloader(/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/t210ref/cboot.bin)... done.
	populating kernel to rootfs... done.
	populating initrd to rootfs... done.
	populating extlinux.conf.emmc to rootfs... done.
	populating /home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/kernel/dtb/tegra210-p3448-0000-p3449-0000-a02.dtb to rootfs... done.
done.
Making Boot image... done.
head: cannot open '/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/rootfs/etc/nv_tegra_release' for reading: No such file or directory
Existing sosfile(/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/nvtboot_recovery.bin) reused.
copying tegraboot(/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/t210ref/nvtboot.bin)... done.
copying cpu_bootloader(/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/t210ref/cboot.bin)... done.
copying bpffile(/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/t210ref/sc7entry-firmware.bin)... done.
Existing badpagefile(/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/badpage.bin) reused.
copying wb0boot(/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/t210ref/warmboot.bin)... done.
Existing tosfile(/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/tos-mon-only.img) reused.
Existing eksfile(/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/eks.img) reused.
copying dtbfile(/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/kernel/dtb/tegra210-p3448-0000-p3449-0000-a02.dtb)... done.
Reusing existing system.img... 
done.
Existing tbcfile(/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/nvtboot_cpu.bin) reused.
copying tbcdtbfile(/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/kernel/dtb/tegra210-p3448-0000-p3449-0000-a02.dtb)... done.
copying cfgfile(/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/t210ref/cfg/flash_l4t_t210_spi_sd_p3448.xml) to flash.xml... done.
copying flasher(/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/t210ref/cboot.bin)... done.
Existing flashapp(/home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/tegraflash.py) reused.
*** Updating [DTB] with tegra210-p3448-0000-p3449-0000-a02.dtb ***
./tegraflash.py --bl cboot.bin --bldtb tegra210-p3448-0000-p3449-0000-a02.dtb  --chip 0x21 --applet nvtboot_recovery.bin --bct  P3448_A00_4GB_Micron_4GB_lpddr4_204Mhz_P987.cfg  --cfg  flash.xml   --cmd "sign; write DTB ./signed/tegra210-p3448-0000-p3449-0000-a02.dtb.encrypt; reboot"  
Welcome to Tegra Flash
version 1.0.0
Type ? or help for help and q or quit to exit
Use ! to execute system commands
 
[   0.0371 ] Generating RCM messages
[   0.1157 ] tegrarcm --listrcm rcm_list.xml --chip 0x21 0 --download rcm nvtboot_recovery.bin 0 0
[   0.1198 ] RCM 0 is saved as rcm_0.rcm
[   0.1311 ] RCM 1 is saved as rcm_1.rcm
[   0.1354 ] List of rcm files are saved in rcm_list.xml
[   0.1403 ] 
[   0.1404 ] Signing RCM messages
[   0.1629 ] tegrasign --key None --list rcm_list.xml --pubkeyhash pub_key.key
[   0.1678 ] Assuming zero filled SBK key
[   0.2123 ] 
[   0.2125 ] Copying signature to RCM mesages
[   0.2140 ] tegrarcm --chip 0x21 0 --updatesig rcm_list_signed.xml
[   0.2252 ] 
[   0.2253 ] Parsing partition layout
[   0.2265 ] tegraparser --pt flash.xml.tmp
[   0.2446 ] 
[   0.2447 ] Creating list of images to be signed
[   0.2457 ] tegrahost --chip 0x21 0 --partitionlayout flash.xml.bin --list images_list.xml
[   0.3212 ] 
[   0.3215 ] Generating signatures
[   0.3252 ] tegrasign --key None --list images_list.xml --pubkeyhash pub_key.key
[   0.3282 ] Assuming zero filled SBK key
[   0.5122 ] 
[   0.5124 ] Generating br-bct
[   0.5145 ] tegrabct --bct P3448_A00_4GB_Micron_4GB_lpddr4_204Mhz_P987.cfg --chip 0x21 0
[   0.5346 ] Copying Sdram info from 0 to 1 set
[   0.5403 ] Copying Sdram info from 1 to 2 set
[   0.5499 ] Copying Sdram info from 2 to 3 set
[   0.5510 ] 
[   0.5512 ] Updating boot device parameters
[   0.5590 ] tegrabct --bct P3448_A00_4GB_Micron_4GB_lpddr4_204Mhz_P987.bct --chip 0x21 0 --updatedevparam flash.xml.bin
[   0.5669 ] Warning: No sdram params
[   0.5845 ] 
[   0.5848 ] Updating bl info
[   0.5911 ] tegrabct --bct P3448_A00_4GB_Micron_4GB_lpddr4_204Mhz_P987.bct --chip 0x21 0 --updateblinfo flash.xml.bin --updatesig images_list_signed.xml
[   0.6046 ] 
[   0.6047 ] Updating secondary storage information into bct
[   0.6060 ] tegraparser --pt flash.xml.bin --chip 0x21 0 --updatecustinfo P3448_A00_4GB_Micron_4GB_lpddr4_204Mhz_P987.bct
[   0.6203 ] 
[   0.6205 ] Get Signed section of bct
[   0.6218 ] tegrabct --bct P3448_A00_4GB_Micron_4GB_lpddr4_204Mhz_P987.bct --chip 0x21 0 --listbct bct_list.xml
[   0.6294 ] 
[   0.6295 ] Signing BCT
[   0.6326 ] tegrasign --key None --list bct_list.xml --pubkeyhash pub_key.key
[   0.6339 ] Assuming zero filled SBK key
[   0.6451 ] 
[   0.6452 ] Updating BCT with signature
[   0.6468 ] tegrabct --bct P3448_A00_4GB_Micron_4GB_lpddr4_204Mhz_P987.bct --chip 0x21 0 --updatesig bct_list_signed.xml
[   0.6571 ] 
[   0.6572 ] Copying signatures
[   0.6590 ] tegrahost --chip 0x21 0 --partitionlayout flash.xml.bin --updatesig images_list_signed.xml
[   0.6761 ] 
[   0.6762 ] Copying signed file in /home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/signed
[   0.7223 ] Generating RCM messages
[   0.7240 ] tegrarcm --listrcm rcm_list.xml --chip 0x21 0 --download rcm nvtboot_recovery.bin 0 0
[   0.7253 ] RCM 0 is saved as rcm_0.rcm
[   0.7396 ] RCM 1 is saved as rcm_1.rcm
[   0.7419 ] List of rcm files are saved in rcm_list.xml
[   0.7484 ] 
[   0.7485 ] Signing RCM messages
[   0.7498 ] tegrasign --key None --list rcm_list.xml --pubkeyhash pub_key.key
[   0.7511 ] Assuming zero filled SBK key
[   0.7611 ] 
[   0.7612 ] Copying signature to RCM mesages
[   0.7624 ] tegrarcm --chip 0x21 0 --updatesig rcm_list_signed.xml
[   0.7730 ] 
[   0.7731 ] Boot Rom communication
[   0.7742 ] tegrarcm --chip 0x21 0 --rcm rcm_list_signed.xml
[   0.7752 ] BootRom is not running
[   1.0519 ] 
[   1.0522 ] Parsing partition layout
[   1.0541 ] tegraparser --pt flash.xml.tmp
[   1.0642 ] 
[   1.0642 ] Creating list of images to be signed
[   1.0655 ] tegrahost --chip 0x21 0 --partitionlayout flash.xml.bin --list images_list.xml
[   1.0801 ] 
[   1.0803 ] Generating signatures
[   1.0817 ] tegrasign --key None --list images_list.xml --pubkeyhash pub_key.key
[   1.0855 ] Assuming zero filled SBK key
[   1.1404 ] 
[   1.1405 ] Send BCT from Host
[   1.1405 ] Generating br-bct
[   1.1416 ] tegrabct --bct P3448_A00_4GB_Micron_4GB_lpddr4_204Mhz_P987.cfg --chip 0x21 0
[   1.1427 ] Copying Sdram info from 0 to 1 set
[   1.1446 ] Copying Sdram info from 1 to 2 set
[   1.1455 ] Copying Sdram info from 2 to 3 set
[   1.1529 ] 
[   1.1530 ] Updating boot device parameters
[   1.1542 ] tegrabct --bct P3448_A00_4GB_Micron_4GB_lpddr4_204Mhz_P987.bct --chip 0x21 0 --updatedevparam flash.xml.bin
[   1.1560 ] Warning: No sdram params
[   1.1603 ] 
[   1.1603 ] Updating bl info
[   1.1613 ] tegrabct --bct P3448_A00_4GB_Micron_4GB_lpddr4_204Mhz_P987.bct --chip 0x21 0 --updateblinfo flash.xml.bin --updatesig images_list_signed.xml
[   1.1708 ] 
[   1.1709 ] Updating secondary storage information into bct
[   1.1731 ] tegraparser --pt flash.xml.bin --chip 0x21 0 --updatecustinfo P3448_A00_4GB_Micron_4GB_lpddr4_204Mhz_P987.bct
[   1.1808 ] 
[   1.1809 ] Get Signed section of bct
[   1.1820 ] tegrabct --bct P3448_A00_4GB_Micron_4GB_lpddr4_204Mhz_P987.bct --chip 0x21 0 --listbct bct_list.xml
[   1.1883 ] 
[   1.1884 ] Signing BCT
[   1.1905 ] tegrasign --key None --list bct_list.xml --pubkeyhash pub_key.key
[   1.1914 ] Assuming zero filled SBK key
[   1.1961 ] 
[   1.1962 ] Updating BCT with signature
[   1.1982 ] tegrabct --bct P3448_A00_4GB_Micron_4GB_lpddr4_204Mhz_P987.bct --chip 0x21 0 --updatesig bct_list_signed.xml
[   1.2104 ] 
[   1.2105 ] Sending BCTs
[   1.2116 ] tegrarcm --download bct P3448_A00_4GB_Micron_4GB_lpddr4_204Mhz_P987.bct
[   1.2126 ] Applet version 00.01.0000
[   1.4927 ] Sending bct
[   1.4945 ] [................................................] 100%
[   1.6277 ] 
[   1.6288 ] Sending bootloader and pre-requisite binaries
[   1.6606 ] tegrarcm --download ebt cboot.bin 0 0 --download rp1 tegra210-p3448-0000-p3449-0000-a02.dtb 0
[   1.6723 ] Applet version 00.01.0000
[   1.8316 ] Sending ebt
[   1.8338 ] [................................................] 100%
[   2.0176 ] Sending rp1
[   2.0367 ] [................................................] 100%
[   2.1648 ] 
[   2.1771 ] tegrarcm --boot recovery
[   2.1901 ] Applet version 00.01.0000
[   2.5237 ] 
[   2.5240 ] Writing partition
[   2.5863 ] tegradevflash --write DTB /home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/signed/tegra210-p3448-0000-p3449-0000-a02.dtb.encrypt
[   2.5934 ] Cboot version 00.01.0000
[   3.2650 ] Writing partition DTB with /home/hispacen1n/Downloads/nvidia/Linux_for_Tegra/bootloader/signed/tegra210-p3448-0000-p3449-0000-a02.dtb.encrypt
[   3.2725 ] [................................................] 100%
[   3.4658 ] 
[   3.4662 ] Coldbooting the device
[   3.4759 ] tegradevflash --reboot coldboot
[   3.4898 ] Cboot version 00.01.0000
[   3.6804 ] 
*** The [DTB] has been updated successfully. ***

but when i reboot,nano got stuck.

my nano can’t boot again while i flash the new dtb file successfully,ant then i write a new image on another SD card but nano can’t boot.how!!!

hi ShaneCCC,i flash dtb successfully and enable spi1,but it doesnt work when i run spi loop back test,i had connected gpio16(spi_1_mosi) and gpio17(spi_1_miso),what could i do next?

waveshare-eng23@waveshareeng23-desktop:~$ sudo cat /sys/kernel/debug/tegra_gpio
[sudo] password for waveshare-eng23: 
Name:Bank:Port CNF OE OUT IN INT_STA INT_ENB INT_LVL
 A: 0:0 64 40 40 04 00 00 000000
 B: 0:1 f0 e0 e0 f0 00 00 000000
 C: 0:2 08 08 00 00 00 00 000000
 D: 0:3 00 00 00 00 00 00 000000
 E: 1:0 40 00 00 00 00 00 000000
 F: 1:1 00 00 00 00 00 00 000000
 G: 1:2 0c 00 00 00 00 00 000000
 H: 1:3 fd 99 00 60 00 00 000000
 I: 2:0 07 05 00 02 00 00 000000
 J: 2:1 f0 00 00 00 00 00 000000
 K: 2:2 00 00 00 00 00 00 000000
 L: 2:3 00 00 00 00 00 00 000000
 M: 3:0 00 00 00 00 00 00 000000
 N: 3:1 00 00 00 00 00 00 000000
 O: 3:2 00 00 00 00 00 00 000000
 P: 3:3 00 00 00 00 00 00 000000
 Q: 4:0 00 00 00 00 00 00 000000
 R: 4:1 00 00 00 00 00 00 000000
 S: 4:2 a0 80 00 00 00 00 000000
 T: 4:3 01 01 00 00 00 00 000000
 U: 5:0 00 00 00 00 00 00 000000
 V: 5:1 03 00 00 02 00 00 000000
 W: 5:2 00 00 00 00 00 00 000000
 X: 5:3 78 08 08 70 00 60 606000
 Y: 6:0 06 00 00 02 00 00 000000
 Z: 6:1 0f 08 08 04 00 06 020600
AA: 6:2 00 00 00 00 00 00 000000
BB: 6:3 01 00 00 00 00 00 000000
CC: 7:0 12 00 00 10 00 12 121200
DD: 7:1 01 00 00 00 00 00 000000
EE: 7:2 00 00 00 00 00 00 000000
FF: 7:3 00 00 00 00 00 00 000000
waveshare-eng23@waveshareeng23-desktop:~$ ls /dev/spi*
/dev/spidev1.0
waveshare-eng23@waveshareeng23-desktop:~$ cd ~/Downloads/
waveshare-eng23@waveshareeng23-desktop:~/Downloads$ ls
extracted.dts  python  python1.44  spidev_test  spidev_test.c
waveshare-eng23@waveshareeng23-desktop:~/Downloads$ sudo ./spidev_test -D /dev/spidev1.0 
spi mode: 0
bits per word: 8
max speed: 500000 Hz (500 KHz)

00 00 00 00 00 00 
00 00 00 00 00 00 
00 00 00 00 00 00 
00 00 00 00 00 00 
00 00 00 00 00 00 
00 00 00 00 00 00 
00 00

Hi!

You may find useful the following link:

This is a detailed guide on how to compile the kernel from source code, and flash custom DTB and kernel image on the Jetson Nano.

You could use the following command from the Nano board to update the dtb:

Replacing the DTB on the Nano:

    sudo dd if=dtb/tegra210-p3448-0000-p3449-0000-a02.dtb.encrypt of=/dev/<DTB_SDCARD_PARTITION>

To generate the tegra210-p3448-0000-p3449-0000-a02.dtb.encrypt you should use create-jetson-nano-sd-card-image.sh script