Search by Tags

Device Tree Overlays


Article updated at 26 Mar 2020
Compare with Revision

Subscribe for this article updates


Device Tree Overlays provide a way to modify the overall device tree without having to re-compile the complete device tree. Overlays are small pieces, or fragments of a complete device tree, and can be added or removed as needed, often enabling/disabling components of hardware in the system. It is because of this flexible nature that overlays provide an advantageous way of describing peripheral hardware, that can be added or removed from the system. It is also useful for tweaking parameters of existing hardware before committing it to a complete device tree. Overlays are described elsewhere, but here are some links that do a good job explaining them:

This article complies to the Typographic Conventions for Torizon Documentation


Developer Tools for Device Tree Overlays

Device Tree Overlays tools are provided in the Developer Tools Container for TorizonCore.

To overcome the task of setting up the environment, modifying and re-compiling a device tree, Toradex provides the tools necessary to build, analyze, and apply both device trees and device tree overlays.

The bulk of the tools are part of the dtc (device tree compiler) project and can, therefore, be found in the dtc repository on Github, but are also shipped as part of the Linux kernel on the scripts/dtc directory.

Overlays in human-readable format (dts files) must be compiled to binary format (dtb for complete device-trees, dtbo for overlays) to be parsed by the kernel.

See a high-level description of the tools:


Used to manage device-trees and device-tree overlays running on a system.

Device Tree and Overlays Source-code

This container also comes with device-tree and device-tree overlay source files.

These files are stored using git and the tool will match their version with the currently running kernel. It is possible to download updates directly from the container, but this requires an internet connection.

Using dtconf

On the computer on module, run the Developer Tools Container for TorizonCore. Then learn how to use dtconf as presented in the next sections.

dtconf Command Line Options

usage: dtconf < command > [arguments]

Use help command to have a more detailed list of commands and their arguments.
  • The status command prints out a list of currently active overlays, of the device trees that are available on the device and of those that are available for the currently running kernel.
  • The build command compiles dts code files into a device-tree or device-tree overlay file.
  • The validate command checks that overlay files are compatible with a device tree. Depending on the Torizon image and SOC you may have multiple valid device trees on your boot partition, the tool should be able to detect which one has been used to boot the device, if this is not possible, you should specify the one that is currently used with the "-c" additional parameter.
  • The enable command copies a binary device tree overlay to the boot partition and adds it to the list of overlays that are activated at boot.
  • The activate command builds a source dts, validates it and enables it in a single step. It's equivalent to run build, validate and enable commands in sequence.
  • The disable command can be used to remove one overlay from the list of those that are applied at boot. If --all is specified, all overlays will be removed.
  • The print command translates a binary device-tree file back into a human-readable format, it can be used to debug issues or document the configuration changes performed by active overlays

Overlays are applied at boot, so the options that affect active overlays configuration (-a,-e and -d) will require a reboot to apply the required changes.


Compile device tree or device tree overlay

Build command can be used to convert a dts into a binary device tree file.

## dtconf build display_EDT7_parallel_res_touch.dts

NOTE: Both device trees (.dtb) and device tree overlays (.dtbo) are built from the same source file (.dts). In an attempt to determine the output file type, the dtconf script will scan the .dts file for the "fragment@0" string. If this string is found it assumes file is an overlay and names the output with a .dtbo extension, otherwise, it is named with a .dtb.

If you don't specify a full path for the file, the tool will search the file in the git repository, matching the current kernel, to prevent this behavior you can use the --no-git-repo option.

Enable overlays

You can enable an overlay using a binary dtbo file:

## dtconf enable display_7_parallel_cap_touch.dto

Or directly using dts file, in this case, the overlay is first compiled to binary format, then validated and then enabled:

## dtconf activate display_7_parallel_cap_touch.dts 

The tool will try to find the base device tree used to boot the module, if it can't find it you'll have to specify it using the -c option.

Validate device tree overlay against base device tree

This simply ensures that the device tree overlay is compatible with a specified device tree. The base device-tree parameter is optional, by default it will validate the overlay against the active device tree:

## dtconf validate some-overlay.dtbo

Deactivate an overlay

## dtconf disable touch_cap_colibri_imx6_aster.dts.dtbo

Note: You should not specify a full path for the overlay because active overlays are stored in the boot partition.

Remove all active overlays

## dtconf disable --all

View overall status of device trees and overlays

## dtconf status
Device is apalis imx6(0028)
Mounting /mnt/part
Currently active overlays:
Available base device trees:
Available overlays for running kernel:

Modify parameter in an overlay

You can modify any of the overlays we provide and then validate them.

First, you need to build the overlay:

## dtconf build modified_overlay.dts

You can then validate that this overlay will apply to the active device tree by executing:

## dtconf validate modified_overlay.dtbo

And finally set it to be active by executing:

## dtconf enable modified_overlay.dtbo

You would now be required to reboot for these changes to take effect.

Creating custom overlays: Enabling GPIOs

In addition to the sample overlays that are available on github, one can also create custom overlays by simply creating a new .dts file and applying it using dtconf according to the instructions above. If you build overlays that are not from the Toradex git repo you'll have to use the --no-git-repo option and provide a complete (full or relative) path for the file.

The following overlay will enable any given pinctrl node (&pinctrl_my_gpios) as GPIOs:

/ {
	compatible = "toradex";
	fragment@0 {
		target = <&iomuxc>;
		__overlay__ {
			pinctrl-names = "default";
			pinctrl-0 = <

Known Issues

  • Build warnings appear upon building an overlay file. This is due to the compiler assuming the file is a full device-tree instead of an overlay.