Problem while programming updated device tree on Orin NX

devt-proc.txt (425.5 KB)
kernel-dts.txt (428.3 KB)
tegra234-p3768-0000-a0.dtsi.txt (7.1 KB)

I work with NVIDIA Jetson ORIN NX, I need to modify device tree in order to match our custom board.
I have NVIDIA programming environment installed with following commands (running under sudo):
################################### export usable env vars ###############################
export LOCALVERSION=-tegra
export CROSS_COMPILE_AARCH64_PATH=$WORKSPACE_PATH/Toolchain
export CROSS_COMPILE_AARCH64=$WORKSPACE_PATH/Toolchain/bin/aarch64-buildroot-linux-gnu-
export CROSS_COMPILE=$CROSS_COMPILE_AARCH64

############################### perform actions by flag choice ###########################

install utilities if requested

echo “apt get for some utilities:”
need_to_install=“build-essential bc qemu-user-static flex bison libssl-dev libncurses-dev sshpass abootimg nfs-kernel-server libxml2-utils”
sudo apt update
sudo apt install -y $need_to_install

unzipping all srouces

echo “unzipping sources:”
mkdir $WORKSPACE_PATH
mkdir $WORKSPACE_PATH/Toolchain
mkdir -p $WORKSPACE_PATH/Out
echo “1 / 5 - aarch64–glibc–stable-final.tar.gz”
tar xf aarch64–glibc–stable-final.tar.gz -C $WORKSPACE_PATH/Toolchain
echo “2 / 5 - Jetson_Linux_R35.3.1_aarch64.tbz2”
tar xf Jetson_Linux_R35.3.1_aarch64.tbz2 -C $WORKSPACE_PATH/
echo “3 / 5 - xpf public_sources.tbz2”
tar xpf public_sources.tbz2 -C $WORKSPACE_PATH/
echo “4 / 5 - xpf public_sources.tbz2”
tar xpfv $WORKSPACE_PATH/Linux_for_Tegra/source/public/kernel_src.tbz2 -C $WORKSPACE_PATH/Linux_for_Tegra/source/public/
echo “4 / 5 - Tegra_Linux_Sample-Root-Filesystem_R35.3.1_aarch64.tbz2”
sudo tar xpf Tegra_Linux_Sample-Root-Filesystem_R35.3.1_aarch64.tbz2 -C $WORKSPACE_PATH/Linux_for_Tegra/rootfs

I’ve modified file:
$WORKSPACE_PATH/Linux_for_Tegra/source/public/hardware/nvidia/platform/t23x/p3768/kernel-dts/cvb/tegra234-p3768-0000-a0.dtsi
I’ve modified only USB3 ports properties:
usb3-0 {/* Goes to hub /
nvidia,usb2-companion = <1>;
nvidia,usb3-gen1-only = <1>;
maximum-speed = “super-speed”;
status = “okay”;
};
usb3-1 {/
Goes to J5 /
nvidia,usb2-companion = <2>;
nvidia,usb3-gen1-only = <1>;
maximum-speed = “super-speed”;
status = “okay”;
};
I’ve run make with following commands (running under sudo):
echo “make:”
echo “1 / 4 - updating device tree to fit our hardware”
sed -i “s/cvb_eeprom_read_size = <0x100>;$/cvb_eeprom_read_size = <0x0>;/” $WORKSPACE_PATH/Linux_for_Tegra/bootloader/t186ref/BCT/tegra234-mb2-bct-misc-p3767-0000.dts
cd $WORKSPACE_PATH/Linux_for_Tegra/source/public/kernel/kernel-5.10/
echo “2 / 4 - make ARCH=arm64 O=$WORKSPACE_PATH/Out tegra_defconfig”
make -j8 ARCH=arm64 O=$WORKSPACE_PATH/Out -j12 tegra_defconfig
echo “3 / 4 - make ARCH=arm64 O=$WORKSPACE_PATH/Out -j16 --output-sync=target”
make -j8 ARCH=arm64 O=$WORKSPACE_PATH/Out -j12 --output-sync=target
echo “4 / 4 - copy from out to Linux_for_Tegra”
cp -f $WORKSPACE_PATH/Out/arch/arm64/boot/Image $WORKSPACE_PATH/Linux_for_Tegra/kernel/Image
cp -rf $WORKSPACE_PATH/Out/arch/arm64/boot/dts/nvidia/
$WORKSPACE_PATH/Linux_for_Tegra/kernel/dtb/

echo “apply binaries:”
cd $WORKSPACE_PATH/Linux_for_Tegra/
echo "1 / 2 - sudo ./apply_binaries.sh "
sudo sudo ./apply_binaries.sh
echo “2 / 2 - copy drivers to filesystem”
sudo cp -f $WORKSPACE_PATH/Out/drivers/gpu/nvgpu/nvgpu.ko $WORKSPACE_PATH/Linux_for_Tegra/rootfs/usr/lib/modules/5.10.104-tegra/kernel/drivers/gpu/nvgpu/

I’ve verified that file $WORKSPACE_PATH /Linux_for_Tegra/kernel/dtb/tegra234-p3767-0000-p3768-0000-a0.dtb was modified (I’ve dec-compiled it to dts. File kernel-dts.txt is attached):
usb3-0 {
status = “okay”;
nvidia,usb2-companion = <0x01>;
nvidia,usb3-gen1-only = <0x01>;
maximum-speed = “super-speed”;
};

		usb3-1 {
			status = "okay";
			nvidia,usb2-companion = <0x02>;
			nvidia,usb3-gen1-only = <0x01>;
			maximum-speed = "super-speed";
                                          };

I’ve generated programming images with following command:
sudo tools/kernel_flash/l4t_initrd_flash.sh --no-flash --external-device nvme0n1p1 -c ./tools/kernel_flash/flash_l4t_external.xml jetson-orin-nano-devkit-nvme external

I’ve programmed board with following command:
sudo ./tools/kernel_flash/l4t_initrd_flash.sh --flash-only --external-device nvme0n1p1 -c ./tools/kernel_flash/flash_l4t_external.xml -k kernel-dtb --external-only jetson-orin-nano-devkit-nvme external
After re-starting the board in operational mode I’ve de-complied programmed device tree with following command:
dtc -I fs -O dts /proc/device-tree > devt-proc.txt
I’ve discovered that my modifications for USB3 ports configuration weren’t applied:
usb3-0 {
nvidia,usb2-companion = <0x01>;
status = “okay”;
};
usb3-1 {
nvidia,usb2-companion = <0x00>;
status = “okay”;
};
I’ve attached file devt-proc.txt.

What am I doing wrong?

Hi igor.glozman,

What’s your Jetpack version in use for Orin NX?

Could you remove -k kernel-dtb in this command to flash the whole board to apply the change?
Please also share the full flash log for further check.

I use Jetson_Linux_R35.3.1_aarch64.tbz2, this mean I use JetPack 5.1.1

I’ve uploaded log files: ImagePreparationRCM.txt, ImagesGeneration.txt, flashing.txt.
Both ImagePreparationRCM.txt and ImagesGeneration.txt are logs for images generation stage (running l4t_initrd_flash.sh with –no-flash option).

flashing.txt is a log for actual NVME flash programming (running l4t_initrd_flash.sh with * – flash-only --external-device* and -k kernel-dtb options).

I’ve paid attention that I get inconsistent logs for image preparation, that is why I put two. There is " ERROR: failed to read rcm_state" message in ImagePreparationRCM.txt, while ImagesGeneration.txt does not have such message.

Regarding to removing “-k kernel-dtb” , I try to avoid re-programming of root file system because all my additional installation will go way. It is very undesirable for us to reprogram root file system.

What is rcm?

Did I modified correct DTSI file: Linux_for_Tegra/source/public/hardware/nvidia/platform/t23x/p3768/kernel-dts/cvb/tegra234-p3768-0000-a0.dtsi ?

Can I update DTB file by just copy new tegra234-p3767-0000-p3768-0000-a0.dtb to /boot/dtb on the target root file system?

flashing.txt (11.4 KB)
ImagePreparationRCM.txt (266.5 KB)
ImagesGeneration.txt (224.2 KB)

Hello
It looks like that I solved the problem by just copying file Linux_for_Tegra/tools/kernel_flash/images/external/kernel_tegra234-p3767-0000-p3768-0000-a0.dtb
to target directory /boot/dtb

My conclusion:
-k kernel-dtb does not program device tree file.

Yes, Orin NX with JP5 will load device tree from /boot/dtb/kernel_xxx.dtb rather than kernel dtb partition.
The kernel-dtb partition will be used in case the dtb in rootfs is broken.