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.
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):
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.
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.
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.
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:
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.
@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?
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?
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