Main Platform Device Tree File On Tx2 Nx

hi, I want custom a sensor on tx2 nx Using the Main Platform Device Tree File.
I do not know how to modify which .dtsi for tx2 nx.
Is there Sensor Software Driver Programming Guide for tx2 nx?

I can’t answer specifics (someone else will need to answer), but some information you might find useful (this is only about device trees, not about sensor programming; for that you might find this sensor document useful),

  • The binary device tree can be read either from the device tree partition, or from the file in “/boot” mentioned in the “/boot/extlinux/extlinux.conf” file via the FDT key/value pair. If you leave the original boot entry in extlinux.conf alone, and then add an alternate entry with the new FDT entry, you’ll be able to pick the alternate entry at boot time via serial console. This is fairly safe and easy. You can always ask for an example.
  • An example of editing a binary file, if the file name is “tree.dtb”:
# First convert to source, perhaps you need install via "`sudo apt-get install device-tree-compiler`":
dtc -I dtb -O dts -o tree.dts tree.dtb
# ...edit "tree.dts"
# Convert to binary form, giving it a new name:
dtc -I dts -O dtb -o tree_edited.dtb tree.dts
  • If you know which device tree is used via either a serial console boot log or looking at flash logs (or by any other method), then you could reverse compile the binary, edit, and recompile back to binary format (trivial to do if you know the name of the file). The edited version could have an alternate name and be used with the above FDT entry for testing purposes (would be a simple way to test without risk).
  • A .dtsi file is an “include” file during kernel build of the device tree target. The kernel must already be configured to match your correct kernel configuration, or else the device tree compile is meaningless. The build target is “dtbs”, e.g., if you’ve already configured and are natively compiling:
    make O=$TEGRA_KERNEL_OUT dtbs
    (then you’d look for the correct dtb file)
  • Think of a device tree node as arguments passed to a driver. Typical arguments include the address to find the device at (if the device were plug-n-play you wouldn’t need a device tree), whether to use the device (“status = okay”), or some argument to pass to the driver. The name of the driver applying to that hardware is also one of the arguments.
  • You can examine what the running system thinks is the current tree. Either you can browse “/proc/device-tree”, or you could create a source .dts file:
    dtc -I fs -O dts -o extracted.dts /proc/device-tree
  • Tip: The kernel source has its own copy of the dtc device tree compiler.

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