Custom Device tree

HI @JerryChang

Im trying to create a device tree from custom carrier board .
Iam using Jetson Orin NX JP 36.5

my dt should only build if the config shows CONFIG_CUSTOM_DT=y

is it possible to do

I have tried to create
ifeq ($(CONFIG_CUSTOM_DT),y)
dtb-y += my_dt.dtb
endif

// SPDX-License-Identifier: GPL-2.0
/dts-v1/;

include “tegra234-p3768-0000+p3767-0000.dts” // Point to the actual NVIDIA file

/ {
my_dt_test {
status = “okay”;
};
};

i was able to force compile dtb-y += my_dt.dtb

but then i tried to create a CONFIG my_dt in kconfig.platforms which i was enabled in kernel defconfig and then in .config

could you help me to find the device tree used was same and alos walk on these steps?

*** Please note that this reply is generated by LLM automatically ***

To create a device tree from a custom carrier board for Jetson Orin NX, you can follow these steps:

  1. Create a new device tree file: Create a new file with a .dts extension, for example, mydt.dts. This file will contain the device tree configuration for your custom carrier board.

  2. Include the NVIDIA device tree file: At the top of your mydt.dts file, include the NVIDIA device tree file using the include directive. For example:

include “tegra234-p3768-0000-p3767-0000.dts”


    This will include the device tree configuration for the Jetson Orin NX module.

3.  **Define your custom device tree configuration**: Below the `include` directive, define your custom device tree configuration. For example:

    ```dts
mydt {
    status = "okay";
    // Add your custom device tree configuration here
};
Replace the comment with your actual device tree configuration.
  1. Create a Kconfig file: Create a new file with a .kconfig extension, for example, mydt.kconfig. This file will contain the configuration options for your custom device tree.

  2. Define the configuration option: In the mydt.kconfig file, define a configuration option for your custom device tree. For example:

config CUSTOM_DT
bool “Custom Device Tree”
default n
help
Enable custom device tree configuration


    This will create a configuration option called `CUSTOM_DT` that can be enabled or disabled.

6.  **Modify the kernel defconfig file**: Modify the kernel defconfig file to include your custom configuration option. For example, add the following line to the `defconfig` file:

    ```makefile
CONFIG_CUSTOM_DT=y
This will enable your custom device tree configuration by default.
  1. Modify the device tree Makefile: Modify the device tree Makefile to include your custom device tree file. For example, add the following lines to the Makefile:

ifeq ($(CONFIG_CUSTOM_DT),y)
dtb-$(CONFIG_ARCH_TEGRA_234) += mydt.dtb
endif


    This will build your custom device tree file only if the `CUSTOM_DT` configuration option is enabled.

8.  **Build the device tree**: Build the device tree using the `make` command. For example:

    ```bash
make dtbs
This will build your custom device tree file and create a `mydt.dtb` file in the `arch/arm64/boot/dts/` directory.

By following these steps, you can create a custom device tree for your Jetson Orin NX module and enable it using a configuration option.

Comparison with your approach:

You have tried to create a device tree file with a conditional statement to build the device tree only if the CONFIG_CUSTOM_DT configuration option is enabled. However, you have not defined the CUSTOM_DT configuration option in a Kconfig file, which is required to enable the configuration option.

Additionally, you have not modified the kernel defconfig file to include your custom configuration option, which is required to enable the configuration option by default.

By following the steps outlined above, you can create a custom device tree for your Jetson Orin NX module and enable it using a configuration option.

*** Please give the thumbs up if you get answers you like. Or provide feedback to help us improve the answer. ***

hello abhiram.m,

please see-also Release Notes (r36.5) for [4. Implementation Details].

I have looked the notes ,

we will be adding a overlay layer with our name as dtb ,
will it be same in case of other modules also or only for in case of camera ?

hello abhiram.m,

as you can see of developer guide, Configuring the CSI Connector.
it’s Jetson-IO for checking for overlays, (*.dtbo), you may see-also reference driver,
$public_sources/kernel_src/hardware/nvidia/t23x/nv-public/overlay/tegra234-p3767-camera-p3768-imx219-A.dts

I have tried the below steps :

+++ b/Src/Nvidia/SDK_36.5/Linux_for_Tegra/source/hardware/nvidia/t23x/nv-public/overlay/tegra234-p3768-0000+p3767-0000-dynamic.dts
@@ -8,6 +8,8 @@
overlay-name = “Tegra234 p3768-0000+p3767-xxxx Dynamic Overlay”;
};

+/* Include your new structured layout asset /
+include “my_custom.dtsi”
/

cat overlay/my_custom.dtsi
// SPDX-License-Identifier: GPL-2.0-only
/* my_devices.dtsi - Custom Integrated Board Sensors */

/ {
/* Fragment 0: Targets the root directory to add tracking and hardware */
fragment@0 {
target-path = “/”;
overlay {

		/* 1. Your custom board identification */
		my_custom_info {
			board-name = " NVIDIA Jetson Orin NX Custom dt";
		};
	};
};

tried to build the dtb : make dtb

***dtc -I dtb -O dts ./kernel-devicetree/generic-dts/dtbs/tegra234-p3768-0000+p3767-0000-dynamic.dtbo


{
overlay-name = “Tegra234 p3768-0000+p3767-xxxx Dynamic Overlay”;

fragment@0 {
	target-path = "/";

	__overlay__ {

		my_custom_info {
			board-name =  " NVIDIA Orin NX Custom dt";
		};
	};
};

please see-also previous post #5, it shows the steps to create and apply a DTB overlay file.

I have tried to build the Overlay
But instead of creating complete image is there a way to load the device with the new dtb generated by copying the dtb to board ?

hello abhiram.m,

you may follow Building the DTBs without building the whole image.

BTW,
you may also try dtc utility to modify the dtbo file for quick testing.
here’re some steps for your reference,
for example,
(1) here’s command to disassembler the single dtb file into text format. (temp.dts)
$ sudo dtc -I dtb -O dts -o temp.dts tegra234-xxx.dtbo
(2) review and modify the temp.dts file, follow below command to convert into a new dtbo binary file.
$ sudo dtc -I dts -O dtb -o new-output.dtbo temp.dts
(3) open /boot/extlinux/extlinux.conf, edit the OVERLAYS point-to new-output.dtbo.
(4) reboot the system for verification.

please note that, You can specify FDT alone. You can specify FDT + OVERLAYS. You cannot do only OVERLAYS though.