how to modify the dts file for jetson nano board

I followed the below steps to modify dtb file for my jetson nano board. But I only saw the modifications at the first time. It lost all my changes if reboot the board.

##on target:
root@yisp-desktop:~# cat /proc/device-tree/nvidia,dtsfilename
/dvs/git/dirty/git-master_linux/kernel/kernel-4.9/arch/arm64/boot/dts/…/…/…/…/…/…/hardware/nvidia/platform/t210/porg/kernel-dts/tegra210-p3448-0000-p3449-0000-a02.dts

##on host:
cd /home/jetson
#untar Jetson release package, ${L4T_RELEASE_PACKAGE}#
tar xpf /media/sf_F_DRIVE/temp_work/jetson/Tegra210_Linux_R32.3.1_aarch64.tbz2
#untar ‘L4T Sample Root File System’#
cd Linux_for_Tegra/rootfs/
tar xpf /media/sf_F_DRIVE/temp_work/jetson/Tegra_Linux_Sample-Root-Filesystem_R32.3.1_aarch64.tbz2
cd …
./apply_binaries.sh

#modify
cd /home/jetson
cp ./Linux_for_Tegra/kernel/dtb/tegra210-p3448-0000-p3449-0000-a02.dtb old.dtb
dtc -I dtb -O dts -o old.dts old.dtb
vi old.dts
spi@7000d400 {
spi@0 {
compatible = “mcp251x”;
reg = <0x00>;
spi-max-frequency = <0x1f78a40>;
nvidia,enable-hw-based-cs;
nvidia,rx-clk-tap-delay = <0x07>;
};
spi@1 {
compatible = “mcp251x”;
reg = <0x01>;
spi-max-frequency = <0x1f78a40>;
nvidia,enable-hw-based-cs;
nvidia,rx-clk-tap-delay = <0x07>;
};

dtc -I dts -O dtb -o new.dtb old.dts
cp ./Linux_for_Tegra/kernel/dtb/tegra210-p3448-0000-p3449-0000-a02.dtb tegra210-p3448-0000-p3449-0000-a02.dtb.origin
cp new.dtb ./Linux_for_Tegra/kernel/dtb/tegra210-p3448-0000-p3449-0000-a02.dtb

##To generate an image to be flashed to an SD card
cd /home/jetson/Linux_for_Tegra
./tools/jetson-disk-image-creator.sh -o sd-blob.img -s 5G -b jetson-nano -r 200
200 for revision A02
cp sd-blob.img /media/sf_F_DRIVE/

##flash sd-blob.img to tf card on windows

then boot jetson nano board with tf card(new img). I see my modifications on board.
root@yisp-desktop:/home/yisp# cat /proc/device-tree/spi@7000d400/spi@0/compatible
mcp251x
root@yisp-desktop:/home/yisp# cat /proc/device-tree/spi@7000d400/spi@1/compatible
mcp251x
root@yisp-desktop:/home/yisp#

But If reboot jetson nano board, everything goes back.

root@yisp-desktop:/home/yisp# ls /proc/device-tree/spi@7000d400/
#address-cells’ dmas nvidia,clk-parents resets
clock-names interrupts phandle ‘#size-cells
clocks iommus prod-settings spi@0
compatible linux,phandle reg status
dma-names name reset-names

root@yisp-desktop:/home/yisp# cat /proc/device-tree/spi@7000d400/spi@0/compatible
spidev

checking the dtb file in /boot/ on target. I find my modifications are in dtb. It’s very odd that where the kernel got the dtb file.

root@yisp-desktop:/home/yisp# cat /proc/device-tree/nvidia,dtsfilename
/dvs/git/dirty/git-master_linux/kernel/kernel-4.9/arch/arm64/boot/dts/…/…/…/…/…/…/hardware/nvidia/platform/t210/porg/kernel-dts/tegra210-p3448-0000-p3449-0000-a02.dts

root@yisp-desktop:/home/yisp# fdtget /boot/tegra210-p3448-0000-p3449-0000-a02.dtb / -l | grep spi
spi@7000d400
spi@7000d600
spi@7000d800
spi@7000da00
spi@70410000
root@yisp-desktop:/home/yisp# fdtget /boot/tegra210-p3448-0000-p3449-0000-a02.dtb /spi@7000d400 -l | grep spi
spi@0
spi@1
root@yisp-desktop:/home/yisp# fdtget /boot/tegra210-p3448-0000-p3449-0000-a02.dtb /spi@7000d400/spi@0/ compatible
mcp251x
root@yisp-desktop:/home/yisp# fdtget /boot/tegra210-p3448-0000-p3449-0000-a02.dtb /spi@7000d400/spi@1/ compatible
mcp251x

root@yisp-desktop:/home/yisp# ls /boot/dtb
ls: cannot access ‘/boot/dtb’: No such file or directory

I followed the below steps to modify dtb file for my jetson nano board. But I only saw the modifications at the first time. It lost all my changes if reboot the board.

This is a known issue and already fixed internally. This would be ready in next release.

For now, please check and modify blow lines in rootfs/opt/nvidia/l4t-bootloader-config/nv-l4t-bootloader-config.sh

elif (( "${sys_maj_rev}" == "${qspi_maj_rev}" )); then
    if (( "${sys_min_rev}" <b>></b> "${qspi_min_rev}" )); then
        # sys_rel == qspi_rel
	# sys_maj_rev == qspi_maj_rev
	# sys_min_rev > qspi_min_rev
	# need to update QSPI
	return 0

Hi, Wayne
Thanks a lot. This works.

Hi,

This wiki contains the instruction to download and build L4T 32.3.1 sources (JetPack 4.3) for Jetson Nano,
These instructions also include the patch to fix the known issue.

https://developer.ridgerun.com/wiki/index.php?title=Jetson_Nano/Development/Building_the_Kernel_from_Source

Regards.

Any update on jetpack 4.4, thanks