28.1 Flash a modified Device Tree

Hi, guys.

I’m effectively trying to replicate the following link (http://elinux.org/Jetson/TX1_SPI) when building the kernel sources on the HOST machine. The objective of the link attached is to do the following:

  1. De-compile the device tree on target(/boot/tegra210-jetson-tx1-p2597-2180-a01-devkit-gpio.dtb)
  2. Modify it to include SpiDev
  3. Re-compile the device tree on the target

I want to be able to flash the Jetson with a custom device tree, which for this instance, is a slightly modified version of the existing one. I understand I can do all this on the Target device, but I want to be doing this on the Host machine as part of my build process.

From what I understand, the device tree running on JetsonTX1 (L4T 28.1) is

$TARGET_MACHINE/boot/tegra210-jetson-tx1-p2597-2180-a01-devkit.dtb

and comes from

$HOST_MACHINE/Jetpack/64_TX1/Linux_for_Tegra_64_tx1/bootloader/t210ref/tegra210-jetson-tx1-p2597-2180-a01-devkit.dtb

I modified the file $KERNEL_SOURCES/hardware/nvidia/t210/kernel-dts/tegra210-soc-base.dtsi with the changes from the SPI example above (the changes are from spi0_0 onwards).

spi@7000d400 {
		compatible = "nvidia,tegra210-spi";
		reg = <0x0 0x7000d400 0x0 0x200>;
		interrupts = <0x0 0x3b 0x4>;
		nvidia,dma-request-selector = <0x5d 0xf>;
		iommus = <0x46 0xe>;
		#address-cells = <0x1>;
		#size-cells = <0x0>;
		dmas = <0x5d 0xf 0x5d 0xf>;
		dma-names = "rx", "tx";
		nvidia,clk-parents = "pll_p", "clk_m";
		status = "okay";
		prod-settings {
			prod {
				prod = <0x4 0xfffff000 0x0>;
			};
			prod_c_flash {
				status = "disabled";
				prod = <0x4 0xffffffc0 0x7>;
			};
			prod_c_loop {
				status = "disabled";
				prod = <0x4 0xfffff000 0x44b>;
			};
		};
		spi0_0 {
		    #address-cells = <0x1>;
		    #size-cells = <0x0>;
		    compatible = "spidev";
		    reg = <0x0>;
		    spi-max-frequency = <20000000>;
		    nvidia,enable-hw-based-cs;
		    nvidia,cs-setup-clk-count = <0x1e>;
		    nvidia,cs-hold-clk-count = <0x1e>;
		    nvidia,rx-clk-tap-delay = <0x1f>;
		    nvidia,tx-clk-tap-delay = <0x0>;
		};
 };

I also modified the configuration file to be used by the build process CONFIG_SPI_SPIDEV=m as required.

The kernel build process is

  • sudo make mrproper
  • sudo make O=$KERN_OUT zImage
  • sudo make O=$KERN_OUT dtbs
  • sudo make O=$KERN_OUT modules
  • sudo make O=$KERN_OUT modules_install INSTALL_MOD_PATH[...]

I took the dtb produced from the build
($KERN_OUT/arch/arm64/boot/dts/tegra210-jetson-tx1-p2597-2180-a01-devkit.dtb), decompiled it (on the host), and seen that it has included the additional spi_dev modification.
This file is then copied over to the JetPack path ($HOST_MACHINE/Jetpack/64_TX1/Linux_for_Tegra_64_tx1/bootloader/t210ref/) as instructed in the Kernel Build instructions. My issue is that when I flash the Jetson, de-compile the flashed dtb file ($TARGET_MACHINE/boot/tegra210-jetson-tx1-p2597-2180-a01-devkit.dtb) it doesn’t have the additional spi_dev addition.

My Flash command is as follows:

sudo ./flash.sh -K kernel/zImage jetson-tx1 mmcblk0p1

If it’s relevant, the kernel name is 4.4.38[my_custom_name] and not -tegra
I have also confirmed that the $TARGET/proc/config.gz contains the included CONFIG_SPI_SPIDEV=m

As always, any help or advice is appreciated.

There were some changes with putting more device tree information in the U-Boot stage (I think via partition), and then the kernel inheriting this. It used to be only from “/boot/extlinux/extlinux.conf” specification of the FDT key/value pair. Instead of looking at a specific file or clone to see what you are testing, try this, and compare to your changes:

sudo dtc -I fs -O dts -o extracted.dts /boot/device-tree

See also:
https://devtalk.nvidia.com/default/topic/1020708/jetson-tx2/method-to-modify-use-different-device-tree-in-r28-1/post/5195927/#5195927
https://devtalk.nvidia.com/default/topic/1021660/jetson-tx1/is-there-any-other-method-in-l4t-r28-1-to-update-dtb-file-for-tx1-besides-flashing-the-dtb-partitio-/post/5200056/#5200056

Thanks, LinuxDev.

My apologies, I should have came across the first link you mentioned while searching the forums.

I did have some success yesterday evening by modifying the flash command from:

sudo ./flash.sh -K kernel/zImage jetson-tx1 mmcblk0p1

to

sudo ./flash.sh jetson-tx1 mmcblk0p1

Which allowed me to decompile the DTB on the Target as expected.

David.

Btw, U-Boot seems to only support zImage compression on 32-bit ARM. You’ll see just Image (an uncompressed zImage) used on a TX1 or TX2.