Where I can find the 'Device tree' of Jetson AGX Xavier development kit?

I have burned my AGX board using ‘NVIDIA_SDK_MANAGER’ and choosing the AGX target.
All peripherals are working so I believe it is built with the right ‘Device tree’.
Now I want to build my own kernel (adding some drivers) to this version:
https://developer.ridgerun.com/wiki/index.php?title=Jetson_Nano%2FDevelopment%2FBuilding_the_Kernel_from_Source
As I understood the ‘Device Tree’ there is of the Xavier NX.
As I have told the code of kernel is the same and only the device tree changed.
From where I can load the AGX ‘device tree’ as base to build on top of it my changes.

This actually has different answers depending on what you are doing. However, a partial answer is:

  • If you have configured kernel source to match an existing system, and propagated the config (such as through building target Image or modules_prepare), then this build target builds all trees for that configuration (you’d have to know which end .dtb to use since it depends on which Jetson):
    make dtbs
  • A running system has a reflection of the tree which is used in “/proc/device-tree”. You can extract this as source via:
    dtc -I fs -O dts -o extracted.dts /proc/device-tree
    (there are other similar ways to go from source to binary format)
  • If you were to flash your system on command line and keep a log, then you could examine which device trees are used. Example:
    sudo ./flash.sh jetson-agx-xavier-devkit mmcblk0p1 2>&1 | tee log_flash.txt
    (then examine which trees are used)
  • Serial console boot log would probably also offer clues as to which tree is used. Note that it is possible for a tree to be used in earlier non-Linux boot stages, get minor edits, and then be passed to Linux.

I know how to extract the from existing as you suggest:
dtc -I fs -O dts -o extracted.dts /proc/device-tree
The point is that I want to build my own ‘kernel’ base on NVIDIA kernel as described in the link in my first question, but for the Jetson AGX xavier.
Does NVIDIA gives the ‘Device Tree’ (.dts) files for that board?
Since I’m new in Linux also I would like to know how to build the .dtb file for that board.
By using this command:
make -C kernel/kernel-4.9/ ARCH=arm64 O=$TEGRA_KERNEL_OUT LOCALVERSION=-tegra CROSS_COMPILE=${TOOLCHAIN_PREFIX} -j8 --output-sync=target dtbs
To which target I’m building the device tree?

Source code tarball inside each of the link here, depends on which release you are using.

https://developer.nvidia.com/embedded/linux-tegra-archive

Incidentally, a number of device trees might be built for a given kernel configuration, and then the end user would pick which one works with a given set of hardware. To exactly copy a kernel you need two things for compile:

  • The kernel config must match, and “/proc/config.gz” on a Jetson shows the current config (you’d have to copy the file somewhere else, gunzip it, and then rename it as “.config” to use it as a current build config in the kernel source).
  • The “uname -r” command must end up being the same. If the kernel source is the version used on the system which has the config.gz, then this means setting (in the “.config”) the CONFIG_LOCALVERSION to match the existing system’s “uname -r” suffix. That suffix is almost always “-tegra”. Thus you might see this when the “.config” is an exact match:
    CONFIG_LOCALVERSION="-tegra"

Then the kernel being built is an exact match to the running system. Once kernel and modules are built, then you can optionally build the dtbs target and pick the resulting .dtb which your hardware uses (and the reason I suggested logging a flash is to see which .dtb is actually used).

FYI, there is more than one way to set CONFIG_LOCALVERSION, and your mentioned inclusion on command line of flash does that job as well as putting it in the .config.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.