How to Add a Custom Device Tree Overlay to Verdin AM62 Yocto Build?

Hi everyone,

I’m working with the Verdin AM62 module and have built a basic Yocto image by setting the machine to verdin-am62 and adding pyqt5. The build completes without any issues.

Now I just want to create one simple custom device tree overlay — either for GPIO or SPI (anything basic) — and I want to see that .dtbo file show up in the deploy/images directory after building. That’s all I’m trying to achieve for now.

I’ve followed a few guides and forum links here in the Toradex community, but so far I haven’t had success getting the .dtbo to appear in the output.

Could anyone please share a complete working example for a basic overlay, including all the necessary steps or .bb files?

Thanks a lot in advance!

Best regards,
Raju

Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Hello!

To obtain the device tree overlays source code for the Verdin AM62, you can use the following Git commands:

$ cd ~/workdir
$ git clone -b toradex_ti-linux-6.1.y git://git.toradex.com/device-trees.git
$ cd device-tree-overlays/

Once you have the source code, you can add your own device tree overlay (DTBO) by including it in the Makefile located in the overlays folder:

dtb-y += <my overlay>.dtbo

To compile the overlays, execute the following commands:

$ cd overlays/
$ export STAGING_KERNEL_DIR=/home/user/workdir/linux-toradex
$ make

For reference, here are some existing Verdin AM62 overlays you can use as examples:

  • verdin-am62_dsi-to-hdmi_overlay.dtbo
  • verdin-am62_dsi-to-lvds_panel-cap-touch-10inch-lvds_overlay.dtbo
  • verdin-am62_panel-cap-touch-10inch-dsi_overlay.dtbo
  • verdin-am62_panel-cap-touch-10inch-lvds_overlay.dtbo
  • verdin-am62_ov5640_overlay.dtbo
  • verdin-am62_hmp_overlay.dts
  • verdin-am62_spidev_overlay.dtbo
  • verdin-am62_nau8822-btl_overlay.dtbo

I noticed you are interested in integrating these overlays into a Yocto build. While the provided sources do not cover this specifically, I can offer a general approach for integrating device tree overlays into Yocto builds if you would like.

Best regards,
Toradex AI Assistant.

Hi @raju3003!

Refer to this answer that I gave a few days ago about a similar problem. In that example, I was using the overlay to enable GPIOs pull-ups.

Feel free to ask if you face any doubts or issues.

Best regards.
Lucas Azeituno.

Hi Lucas!

Thanks i gone through that and i modified these changes but i idnt got dtbo file in deploy directory please review completely and tell me how to get that dtbo to deploy
and also with these i have done correct me i am wrong

Custom Layer Structure (meta-raju)

meta-raju/
├── conf/
│   └── layer.conf
├── COPYING.MIT
├── README
└── recipes-kernel/
    └── linux/
        ├── device-tree-overlays/
        │   └── verdin-am62_gpio-pullup.dts
        └── device-tree-overlays_%.bbappend

DTS File: verdin-am62_gpio-pullup.dts

/dts-v1/;
/plugin/;

#include <dt-bindings/gpio/gpio.h>
#include "k3-am62-main.dtsi"

&{/} {
    fragment@0 {
        target = <&main_pmx0>;
        __overlay__ {
            gpio_pu_pins: gpio-pu-pins {
                pinctrl-single,pins = <
                    AM62X_IOPAD(0x0090, PIN_INPUT_PULLUP | MUX_MODE7)  /* GPIO0_36 */
                >;
            };
        };
    };

    fragment@1 {
        target-path = "/bus@f0000/gpio@600000";  // Adjust based on actual GPIO node
        __overlay__ {
            pinctrl-names = "default";
            pinctrl-0 = <&gpio_pu_pins>;
        };
    };
};

.bbappend File: device-tree-overlays_%.bbappend

FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:"

SRC_URI:append = " file://verdin-am62_gpio-pullup.dts"

do_collect_overlays:prepend() {
    cp ${WORKDIR}/verdin-am62_gpio-pullup.dts ${S}
}

TEZI_EXTERNAL_KERNEL_DEVICETREE_BOOT:append = " verdin-am62_gpio-pullup.dtbo"

after this
i ran a command
bitbake virtual/kernel
bitbake tdx-reference-multimedia-image

after this other overlays are present not mine

~/oe-core/build/deploy/images/verdin-am62/overlays$ ls
verdin-am62_dsi-to-hdmi_overlay.dtbo verdin-am62_mezzanine_panel-cap-touch-10inch-lvds_overlay.dtbo verdin-am62_panel-cap-touch-10inch-dsi_overlay.dtbo
verdin-am62_dsi-to-lvds_panel-cap-touch-10inch-lvds_overlay.dtbo verdin-am62_mezzanine_panel-lvds-dual-channel-1080p_overlay.dtbo verdin-am62_panel-cap-touch-10inch-lvds_overlay.dtbo
verdin-am62_hmp_overlay.dtbo verdin-am62_nau8822-btl_overlay.dtbo verdin-am62_panel-cap-touch-7inch-dsi_overlay.dtbo
verdin-am62_mezzanine_can.dtbo verdin-am62_ov5640_overlay.dtbo

Best regards
Raju

Hi Lucas!

Kindly reply to the above topic

And also if u have any custom overlay created for verdin am62 please provide I will try that itself straight away

Best regards
Raju

Hi @raju3003!

First, did you add your layer to bblayers.conf? If not, it won’t consider your modifications when building the new image.

Second, your overlay isn’t correct. Please refer to this line of k3-am62-verdin.dtsi to use as an example on how you should write a node. In your overlay, you’ll need to add a node to &main_pmx0 and then change its function. Besides that, you must be sure that any other node doesn’t reserve the pin you’re trying to use and, if so, disable the node using the pin by adding status = "disabled" to it. Your overlay file would look like the following:

/dts-v1/;
/plugin/;

#include <dt-bindings/gpio/gpio.h>

/ {
        compatible = "toradex,verdin-am62";
};

&main_pmx0 {
        pinctrl_custom_pullup: main-custom-pullup {
                pinctrl-single,pins = <
                        AM62X_IOPAD(0x0094, PIN_INPUT_PULLUP, 7)
                >;
        };
};

The hexadecimal number is the pin physical address. You can find it in the AM62x Reference Manual. For example, you can find this pin used in the example on page 5832.

Besides that, the last argument in AM62X_IOPAD is the mux mode. You can find the possible modes in the Verdin AM62 Datasheet.

Best regards.
Lucas Azeituno

Hi @lucas_az.tx !

Thanks a lot for the information

Yes, I have added my custom layer meta-raju to the bblayers.conf. Here’s the result from running bitbake-layers show-layers to confirm that it’s being included:

meta-raju /home/raju/oe-core/layers/meta-raju 6

Just for checking purposes, I’m currently using your example device tree overlay exactly as it is, and I have also verified that no other node is using the GPIO pin(k3-am62-verdin.dtsi) I’m testing with (gpio-pull_up).

Here’s the content of my overlay file verdin-am62_gpio-pullup.dts:

/dts-v1/;
/plugin/;

#include <dt-bindings/gpio/gpio.h>

/ {
    compatible = "toradex,verdin-am62";
};

&main_pmx0 {
    pinctrl_custom_pullup: main-custom-pullup {
        pinctrl-single,pins = <
            AM62X_IOPAD(0x0094, PIN_INPUT_PULLUP, 7)
        >;
    };
};

And here’s my device-tree-overlays_%.bbappend file:

FILESEXTRAPATHS:prepend := "${THISDIR}/device-tree-overlays:"

CUSTOM_OVERLAYS_SOURCE = " \
    verdin-am62_gpio-pullup.dts \
"
CUSTOM_OVERLAYS_BINARY = " \
    verdin-am62_gpio-pullup.dtbo \
"

SRC_URI += " \
    file://verdin-am62_gpio-pullup.dts \
"

TEZI_EXTERNAL_KERNEL_DEVICETREE += " \
    ${CUSTOM_OVERLAYS_BINARY} \
"

TEZI_EXTERNAL_KERNEL_DEVICETREE_BOOT = " \
    ${CUSTOM_OVERLAYS_BINARY} \
"

do_collect_overlays:prepend() {
    for DTS in ${CUSTOM_OVERLAYS_SOURCE}; do
        cp ${WORKDIR}/${DTS} ${S}
    done
}

After creating the overlay and .bbappend, I ran:

bitbake tdx-reference-multimedia-image

The build finished without any errors, but I noticed that the .dtbo file was not included or generated.

Just to test if BitBake is actually considering my .bbappend file, I tried intentionally putting a wrong file name in the SRC_URI like this:


SRC_URI += " \
    file://verdin-a2_gpio-pullup.dts \   # (note the wrong filename here)
"

Surprisingly, it still compiled with zero errors, which makes me think that BitBake might not even be considering my device-tree-overlays_%.bbappend file at all during the build process.

So my doubt is — even though the layer is added correctly and the recipe exists, is there something extra I need to do to ensure that this .bbappend is picked up? Or maybe I’ve missed a necessary include or dependency to hook into the overlays mechanism?

Thanks again for your support and the great explanation you provided in your last message — especially the reference to the datasheet and how to verify the mux modes and pin addresses!

Best regards,
Raju

Hi @raju3003!

I’ve tested it, and here’s what is working:

.
├── conf
│   └── layer.conf
├── COPYING.MIT
├── README
└── recipes-kernel
    └── linux
        ├── device-tree-overlays-ti
        │   └── verdin-am62_gpio-pullup.dts
        └── device-tree-overlays-ti_%.bbappend

verdin-am62_gpio-pullup.dts:

/dts-v1/;
/plugin/;

#include <dt-bindings/gpio/gpio.h>
#include "k3-pinctrl.h"

/ {
        compatible = "toradex,verdin-am62";
};

&main_pmx0 {
        pinctrl_custom_pullup: main-custom-pullup {
                pinctrl-single,pins = <
                        AM62X_IOPAD(0x0094, PIN_OUTPUT_PULLUP, 7)
                >;
        };
};

device-tree-overlays-ti_%.bbappend:

FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:"

SRC_URI:append = " file://verdin-am62_gpio-pullup.dts"

do_collect_overlays:prepend () {
    cp ${WORKDIR}/verdin-am62_gpio-pullup.dts ${S}
}

TEZI_EXTERNAL_KERNEL_DEVICETREE_BOOT:append = " verdin-am62_gpio-pullup.dtbo"

Please edit your project with these changes and try to build it again.

Best regards.
Lucas Azeituno

1 Like

Hi Lucas,

I genuinely can’t thank you enough for your consistent support.

After struggling for over 2 weeks, your detailed and patient guidance helped me finally get it working.

You’ve replied to me multiple times and stayed with the issue — that means a lot. Your willingness to help and the clarity in your explanations really stood out.

what exactly was the key change that made it work? Was it mainly the -ti part and
#include “k3-pinctrl.h”, something else I might’ve missed?

Thanks again for everything, Lucas.

Best Regards,
Raju

Hi @raju3003!

Thank you for your feedback. Hearing things like this helps us to continue with our good work.

Regarding the modifications, the -ti is mandatory because Yocto will only recognize the right recipe you are trying to modify if you reference it properly. You can see here the recipe we are modifying with our .bbappend (and it has the -ti).

Without this suffix, Yocto won’t use our .bbappend since it will not find any recipe to which it is applicable. This is the reason you weren’t seeing the overlay built.

Our recipe without the suffix is for modules with NXP chips, as you can see here.

About the overlay itself, the #include "k3-pinctrl.h" is mandatory since we are working with pins, and it has the macro AM62X_IOPAD, which is defined in k3-pinctrl.h. Otherwise, without this include, it won’t build and will give an error.

I saw you marked my answer as a solution. Can I consider this topic solved? Just keep in mind that you can always open a new topic whenever you want.

Best regards.
Lucas Azeituno

Hi Lucas,

Thanks again for the detailed explanation — that makes everything much clearer now.

Yes, you can mark the topic as solved. Really appreciate all your help throughout!

Best regards,
Raju

1 Like