Add dts overlay custom with torizon core builder

Hi support,

I have a problem with dts overlay custom include in my torizon core builder project.

This is my dts overlay custom file:

// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/*
 * Copyright 2023 Toradex
 */

// Verdin iMX8M Plus single-channel LVDS

/dts-v1/;
/plugin/;

/ {
	compatible = "toradex,verdin-imx8mp"; // Set hardware compatibility
};

&{/} {

	status = "okay";
	backlight_lvds_native: backlight-lvds-native {
		compatible = "pwm-backlight";
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_i2s_2_d_out_dsi_1_bkl_en>;
		brightness-levels = <0 45 63 88 119 158 203 255>;
		default-brightness-level = <4>;
		/* Verdin I2S_2_D_OUT as GPIO (SODIMM 46) */
		enable-gpios = <&gpio5 1 GPIO_ACTIVE_HIGH>;
		/* Verdin PWM_2 (SODIMM 16) */
		pwms = <&pwm2 0 6666667 PWM_POLARITY_INVERTED>;
	};

	panel-lvds-native {
		compatible = "panel-lvds";
		backlight = <&backlight_lvds_native>;
		data-mapping = "vesa-24";
		height-mm = <136>; /* Height active area */
		width-mm = <217>;  /* Width active area */

		panel-timing {
			clock-frequency = <72400000>;
			de-active = <1>;
			hactive = <1280>;
			hback-porch = <86>;
			hfront-porch = <72>;
			hsync-active = <0>;
			hsync-len = <2>;
			pixelclk-active = <1>;
			vactive = <800>;
			vback-porch = <21>;
			vfront-porch = <15>;
			vsync-active = <0>;
			vsync-len = <2>;
		};

		port {
			panel_lvds_native_in: endpoint {
				remote-endpoint = <&lvds_out>;
			};
		};
	};
};

&gpu_2d {
	status = "okay";
};

&gpu_3d {
	status = "okay";
};

/* Verdin I2C channel 1 */
&i2c2 {
    status = "okay";
    ilitek@41 {
        compatible = "ilitek,ili251x";
        reg = <0x41>;

        interrupt-parent = <&gpio4>;
        interrupts = <31 IRQ_TYPE_EDGE_FALLING>;

        reset-gpios = <&gpio4 30 GPIO_ACTIVE_LOW>;

        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_i2s_2_d_in_gpio>,
                   <&pinctrl_i2s_2_sync_gpio>;
    };
};

&lcdif2 {
	status = "okay";
};

&ldb {
	status = "okay";

	lvds-channel@0 {
		#address-cells = <1>;
    	#size-cells = <0>;
	reg = <0>;
		fsl,data-mapping = "spwg";
		fsl,data-width = <24>;
		status = "okay";

		port@1 {
			reg = <1>;
			#address-cells = <1>;
    		#size-cells = <0>;

			lvds_out: endpoint {
				remote-endpoint = <&panel_lvds_native_in>;
			};
		};
	};
};

&ldb_phy {
	status = "okay";
};

&mix_gpu_ml {
	status = "okay";
};

&ml_vipsi {
	status = "okay";
};

/* Verdin PWM_2 */
&pwm2 {
	status = "okay";
};

&iomuxc {
		/* Reset pin */
        pinctrl_i2s_2_d_in_gpio: gpio4io30grp {
                fsl,pins =
                        <MX8MP_IOMUXC_SAI3_RXD__GPIO4_IO30 0x184>; /* SODIMM 48 */
        };

		/* Interrupt pin */
        pinctrl_i2s_2_sync_gpio: gpio4io31grp {
                fsl,pins =
                        <MX8MP_IOMUXC_SAI3_TXFS__GPIO4_IO31 0x1c4>; /* SODIMM 44 */
        };

		pinctrl_i2s_2_d_out_dsi_1_bkl_en: i2s2doutdsi1bklengrp {
				fsl,pins =
					<MX8MP_IOMUXC_SAI3_TXD__GPIO5_IO01 0x184>; /* SODIMM 46 */
		};
};

and this is my tcb-build.yml file:

---
input:
  easy-installer:
    remote: https://tezi.toradex.com/artifactory/torizoncore-oe-prod-frankfurt/scarthgap-7.x.y/release/30/verdin-imx8mp/torizon/torizon-docker/oedeploy/torizon-docker-verdin-imx8mp-Tezi_7.5.0+build.30.tar
customization:
  device-tree:
    include-dirs:
      - device-trees/overlays
    custom: linux-toradex/arch/arm64/boot/dts/freescale/imx8mp-verdin-wifi-mallow.dts
    overlays:
      add:
        - device-trees/overlays/verdin-imx8mp_panel-touch-10inch-lvds_overlay.dts
output:
  easy-installer:
    name: demo_0.1.0
    local: torizon-image
    accept-licence: true
    autoinstall: true
    bundle:
      compose-file: containers/docker-compose.yml

when i run torizoncore-builder build command return this error:

Building image as per configuration file 'tcbuild.yaml'...

=>> Handling input section
Fetching URL 'https://tezi.toradex.com/artifactory/torizoncore-oe-prod-frankfurt/scarthgap-7.x.y/release/30/verdin-imx8mp/torizon/torizon-docker/oedeploy/torizon-docker-verdin-imx8mp-Tezi_7.5.0+build.30.tar' into '/tmp/torizon-docker-verdin-imx8mp-Tezi_7.5.0+build.30.tar'
[========================================] 
Download Complete!
Downloaded file name: '/tmp/torizon-docker-verdin-imx8mp-Tezi_7.5.0+build.30.tar'
No integrity check performed because checksum was not specified.
Unpacking Toradex Easy Installer image.
Unpacking TorizonCore Toradex Easy Installer image.
Importing OSTree revision b48dbccb33ac49e6a61d82a6ae7953ddc00e624569caaabc1033b4cf6adfd793 from local repository...
1286 metadata, 9890 content objects imported; 652.2 MB content written                                                                                                                        
0 metadata, 0 content objects imported; 0 bytes content written                                                                                                                               
Unpacked OSTree from Toradex Easy Installer image:
  Commit checksum: b48dbccb33ac49e6a61d82a6ae7953ddc00e624569caaabc1033b4cf6adfd793
  TorizonCore Version: 7.5.0+build.30

=>> Handling customization section

=> Handling device-tree subsection
Not testing overlay because base image does not have a device-tree set!

=> Adding device-tree overlay 'device-trees/overlays/verdin-imx8mp_panel-touch-10inch-lvds_overlay.dts'
Compiling Device Tree with DTC 1.6.0...
Error: device-trees/overlays/verdin-imx8mp_panel-touch-10inch-lvds_overlay.dts:25.28-29 syntax error
FATAL ERROR: Unable to parse input tree
error: cannot apply device-trees/overlays/verdin-imx8mp_panel-touch-10inch-lvds_overlay.dts.

The row 25 is the follow:

enable-gpios = <&gpio5 1 GPIO_ACTIVE_HIGH>;

How can i resolve this issue? And exists an method for include custom: linux-toradex/arch/arm64/boot/dts/freescale/imx8mp-verdin-wifi-mallow.dts without clone linux-toradex repository?

Thanks

Fabio

Hi, I’m the Toradex AI Assistant.

I might make mistakes or occasionally get you wrong. Our support team will step in if needed.


The error you’re encountering is due to missing header files that define the GPIO macros used in your overlay(1). The syntax error on line 25 with GPIO_ACTIVE_HIGH indicates that this constant isn’t defined during compilation.

Fix the Missing Headers

You need to include the GPIO header file in your overlay(1). Add this line at the top of your overlay file:

// Header file with GPIO macros
#include <dt-bindings/gpio/gpio.h>

(1)

Your overlay should start like this:

/dts-v1/;
/plugin/;

// Header file with GPIO macros
#include <dt-bindings/gpio/gpio.h>

(1)

Update Your tcbuild.yaml Configuration

You also need to specify the correct include directories in your tcbuild.yaml file(1)(2). Update your configuration:

customization:
  device-tree:
    include-dirs:
    # Folder that contains common kernel header files like gpio.h
      - linux/include
    # Folder that contains SoC-specific header files for TI, like k3-pinctrl.h
      - linux-toradex/arch/arm64/boot/dts/freescale/
    custom: linux-toradex/arch/arm64/boot/dts/freescale/imx8mp-verdin-wifi-mallow.dts
    overlays:
      add:
        - device-trees/overlays/verdin-imx8mp_panel-touch-10inch-lvds_overlay.dts

(1)(2)

Regarding Linux Repository

Unfortunately, you do need to clone the linux-toradex repository to get the device tree source files and headers(3). For i.MX 8/8X/8M Mini/8M Plus modules, you need to clone the NXP downstream kernel fork:

$ git clone -b toradex_6.6-2.2.x-imx git://git.toradex.com/linux-toradex.git linux

(3)

You can use the --depth 1 option to clone only the latest commit to reduce download time(3).

Alternative: Use Git Submodules

As suggested in the documentation, you can manage external device trees from your project’s repository using Git submodules(2). This ensures that all required source files are available in your project’s source tree without manually cloning repositories each time.

Your directory structure should look like this:

├── linux-toradex
├── device-trees
│  └── overlays
│       └── verdin-imx8mp_panel-touch-10inch-lvds_overlay.dts
├── tcbuild.yaml
└── containers

(2)

Best regards, Toradex AI Assistant.


Did you like my answer? :+1: :-1:

If I answered your question, please tick the “Solution” checkbox.

For follow-up questions to me, please use @ToradexAI in your post.

Hi @ToradexAI,

How do I keep the linux-toradex repository up to date when a new version of TorizonCore is released and then do a new image update?

When a new TorizonCore version is released, you need to update both the base image and the corresponding linux-toradex repository branch to maintain compatibility(1).

Update Process

1. Download the New TorizonCore Image

First, download the new TorizonCore image and unpack it(1):

$ torizoncore-builder images unpack torizon-core-docker-verdin-imx8mp-Tezi_NEW_VERSION.tar

(1)

Alternatively, you can use the automatic download command(1):

$ torizoncore-builder images download --remote-host 192.168.1.117 --remote-username torizon --remote-password torizon

(1)

2. Update the linux-toradex Repository

The key is understanding that different TorizonCore versions correspond to different kernel branches(2). For example:

  • TorizonCore 6.x uses kernel 5.15 with branch toradex_5.15-2.2.x-imx(2)
  • TorizonCore 7.x uses kernel 6.6 with branch toradex_6.6-2.2.x-imx(2)

To update your existing linux-toradex repository(1):

$ cd linux-toradex
$ git fetch origin
$ git checkout toradex_6.6-2.2.x-imx  # Use the appropriate branch for your TorizonCore version
$ git pull origin toradex_6.6-2.2.x-imx

(1)

3. Update Device Tree Overlays Repository

Similarly, update the device-tree-overlays repository(1):

$ cd device-trees
$ git fetch origin
$ git checkout toradex_6.6-2.2.x-imx  # Match the same branch as linux-toradex
$ git pull origin toradex_6.6-2.2.x-imx

(1)

Branch Selection Guidelines

For i.MX 8/8X/8M Mini/8M Plus modules, clone or update to the appropriate branch(1):

$ git clone -b toradex_6.6-2.2.x-imx git://git.toradex.com/linux-toradex.git linux
$ git clone -b toradex_6.6-2.2.x-imx git://git.toradex.com/device-tree-overlays.git device-trees

(1)

Version Compatibility Check

The community discussions indicate that branch availability may vary(3). As noted in the community forum, toradex_6.6-2.2.x-imx is the current branch for TorizonCore 7(3).

Important Notes

  • Always ensure both repositories use the same branch version to maintain compatibility(1)
  • The TorizonCore version numbers (6.x, 7.x) don’t directly correspond to kernel version numbers (5.15, 6.6)(2)
  • You can use --depth 1 option when cloning to reduce download time(1)

After updating the repositories, rebuild your custom image using the same torizoncore-builder build command with your existing tcbuild.yaml configuration.

Best regards, Toradex AI Assistant.


Did you like my answer? :+1: :-1:

If I answered your question, please tick the “Solution” checkbox.

For follow-up questions to me, please use @ToradexAI in your post.