On-Target Device Tree Building

Has anyone been able (/ is it possible(?)) to build the device tree binaries (DTB) on-target from sources and use them on the device after a reboot?

I have looked here https://elinux.org/Jetson/TX2_DTB#TX2 but this only covers flashing the DTB partition, I’m just curious if it’s actually possible (without manually inserting the FDT entry into extlinux.conf).

sudo make [...] 
sudo make <b>dtbs</b>
sudo make [...]

Thanks,

David.

I haven’t tried directly on the Jetson, but it should work if things are configured correctly. It’s possible you might need to use the driver package’s “source_sync.sh” to get everything you need (versus just the kernel source download which does not have everything in it).

hello david_evans_g,

may i have more details about why you would like to build the DTB on-target?
thanks

@LinuxDev:
Thanks, I’ll look into that.

@JerryChange
may i have more details about why you would like to build the DTB on-target?

Should I wish to modify the device tree locally on-target (and observe changes), I know how to do it via a host machine, but it would be beneficial if there was a method to do explicitly on-target without the use of a host machine.

@JerryChange, I’d second the reason that David puts forward. Furthermore, the solution seems feasible. The on-target DTB building process is almost there.

As described in https://devtalk.nvidia.com/default/topic/1023007/jetson-tx2/how-to-use-uart0-as-normal-uart-port-on-r28-1-/post/5206235/ it’s readily able to hack the process as follows:

  1. Install dtc compiler
  2. De-compile the DTB to DTS
  3. Edit the DTS as needed
  4. Compile and get new DTB
  5. Copy to memory partition 15, mmcblk0p15

What missing in the on-target process is the ability to compile the source from a full structured device-tree, instead of a de-compiled flat DTS file.

Basically, we need an environment that would port the “make dtbs” on the host to the TX2 target.

Primarily my reason is that people struggle here to enable SPI on the Jetson and I would like to make a very detailed setup guide that can be all done on-target. The (now redundant) solution (Pre 28.1 http://elinux.org/Jetson/TX1_SPI ) requires you to decompile the DTB, modify it, recompile it and reboot, which is no longer valid. You can loosely follow this process and manually insert an FDT entry into extlinux.conf, but I understand that has other implications, such as messing up your network connections.

Another reason is, I don’t really understand Device Trees well enough and I think it could be easier to modify/build a new device tree (based on the sources) on-target, and observe the impact of those changes.

If it’s not possible to do it, I understand, but I just find it surprising if that’s the case. Personally I prefer doing host-building, but sometimes you just want to do it quickly on-target.

@david_evens_g, to my knowledge, the method of “insert an FDT entry into extlinux.conf” is no longer valid on TX2.

@tmx3
It does work, I’ve had success with it, but it has knock-on effects which makes it impractical.