How to activate the LVDS touch panel for Verdin iMX8M Mini on Yocto

I am working on:
Dahlia Carrier Board
Verdin iMX8M Mini
Branch kirkstone-6.x.y

Installing a reference image and then SSH into the target and manually changing fdt_overlays in overlays.txt works perfectly. However, I am trying to directly create an image with the 10 inch touch panel activated but I am probably missing something obvious.

I tried a few things and my last attempt was by following this: Custom meta layers, recipes and images in Yocto Project (hello-world examples) | Toradex Developer Center to add verdin-imx8mm_dsi-to-lvds_panel-cap-touch-10inch-lvds-_overlay.dtbo to the overlays.txt file.

This is some of what my layer contains:

conf/layer.conf:

include conf/machine/verdin-imx8mm-extra.conf

# We have a conf and classes directory, add to BBPATH
BBPATH .= ":${LAYERDIR}"

# We have recipes-* directories, add to BBFILES
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
            ${LAYERDIR}/recipes-*/*/*.bbappend"

BBFILE_COLLECTIONS += "meta-customer-demos"
BBFILE_PATTERN_meta-customer-demos = "^${LAYERDIR}/"
BBFILE_PRIORITY_meta-customer-demos = "25"

LAYERDEPENDS_meta-customer-demos = " \
    core \
    yocto \
    openembedded-layer networking-layer \
    toradex-demos \
    freescale-layer \
    freescale-distro \
    toradex-bsp-common-layer \
    meta-flutter \
"

LAYERSERIES_COMPAT_meta-customer-demos = "kirkstone"

(if I change the position of include conf/machine/verdin-imx8mm-extra.conf to the end of layer.conf, I get an error during linux-toradex_%.bb:do_compile that says: make[1]: *** No rule to make target 'arch/arm64/boot/dts/verdin-imx8mm_dsi-to-lvds_panel-cap-touch-10inch-lvds-copy_overlay.dtbo'. Stop.)

conf/machine/verdin-imx8mm-extra.conf:

KERNEL_DEVICETREE:append = " verdin-imx8mm_dsi-to-lvds_panel-cap-touch-10inch-lvds-copy_overlay.dtbo"

recipes-bsp/u-boot/u-boot-toradex_%.bbappend:

do_configure:append() {
      sed -i 's/#define FDT_FILE.*/#define FDT_FILE "verdin-imx8mm_dsi-to-lvds_panel-cap-touch-10inch-lvds-copy_overlay.dtbo"/' ${S}/include/configs/verdin-imx8mm.h
}

recipes-kernel/linux/linux-toradex_%.bbappend:

FILESEXTRAPATHS:prepend := "${THISDIR}/linux-toradex:"

CUSTOM_DEVICETREE = "verdin-imx8mm_dsi-to-lvds_panel-cap-touch-10inch-lvds-copy_overlay.dts"

SRC_URI += "\
    file://${CUSTOM_DEVICETREE} \
   	"

do_configure:append() {
    cp ${WORKDIR}/${CUSTOM_DEVICETREE} ${S}/arch/arm64/boot/dts/freescale
}

And, in recipes-kernel/linux/linux-toradex/, I put copies of “verdin-imx8mm_dsi-to-lvds_panel-cap-touch-10inch-lvds_overlay.dts”, “display-lt170410_sn65dsi84_overlay.dtsi” and “verdin-imx8_mipi-dsi-to-sn65dsi84.dtsi”. I just added “copy” to the name.

The image builds, but the overlays.txt still shows: “fdt_overlays=verdin-imx8mm_dsi-to-hdmi_overlay.dtbo verdin-imx8mm_spidev_overlay.dtbo”.

I am most certainly missing something easy but I cannot figure it out.

How to configure Yocto to make an image that has “fdt_overlays=verdin-imx8mm_dsi-to-lvds_panel-cap-touch-10inch-lvds_overlay.dtbo” ?

Thank you for your assistance.

Hi @mnano,

Thanks for reaching out to Toradex and for the very detailed explanation.

Did you also try the steps on this article below?

Add your overlays to a custom yocto-project-build

Best Regards
Kevin

Thank you for the quick response.

I did try to override “TEZI_EXTERNAL_KERNEL_DEVICETREE_BOOT” by using machine-extra.conf, local.conf and even by making a machine-copy.conf. Whatever I tried, I ended with this error message:
make[1]: *** No rule to make target 'arch/arm64/boot/dts/verdin-imx8mm_dsi-to-lvds_panel-cap-touch-10inch-lvds-copy_overlay.dtbo'. Stop.

It seems I am missing something but I do not know what

Hi @mnano !

Could you please share all the modification/additions you did in order to add your overlay?

Best regards,

Everything in my first post (meta-customer-demos/conf/layer.conf + meta-customer-demos/conf/machine/verdin-imx8mm-extra.conf + meta-customer-demos/recipes-bsp/u-boot/u-boot-toradex_%.bbappend + meta-customer-demos/recipes-kernel/linux/linux-toradex_%.bbappend).

In recipes-kernel/linux/linux-toradex, I have:

  • display-lt170410_sn65dsi84-copy_overlay.dtsi
  • verdin-imx8_mipi-dsi-to-sn65dsi84-copy.dtsi
  • verdin-imx8mm_dsi-to-lvds_panel-cap-touch-10inch-lvds-copy_overlay.dts

The panel-cap dts has these 2 includes changed (everything else is the same as in the repo):

#include "display-lt170410_sn65dsi84-copy_overlay.dtsi"
#include "verdin-imx8_mipi-dsi-to-sn65dsi84-copy.dtsi"

local.conf has MACHINE ?= "verdin-imx8mm" uncommented.

One thing I have not mentioned is that local.conf also has DISTRO ?= "tdx-xwayland-no-vulkan" instead of what was there by default on the kirkstone branch. It refers to meta-customer-demos/conf/tdx-xwayland-no-vulkan which is:

# Toradex Distro for Wayland with XWayland.
# Using the downstream kernel flavour.

require conf/distro/include/tdx-base.inc

DISTRO = "tdx-xwayland-no-vulkan"
DISTRO_NAME = "TDX Wayland with XWayland"
DISTRO_FLAVOUR = ""

IMX_DEFAULT_BSP = "nxp"

# we use graphics, so set opengl
DISTRO_FEATURES:append = " opengl"

DISTRO_FEATURES:append = " wayland x11"

# If vulkan is not removed, flutter embedder does not work
DISTRO_FEATURES:remove = " vulkan"

# lxqt requires this
DISTRO_FEATURES:append = " polkit"

But, I do not think this has an impact.

There is 2 scenarios here:

  1. If ‘include conf/machine/verdin-imx8mm-extra.conf’ is on top of layer.conf → nothing happens and fdt_overlays is unchanged.
  2. If ‘include conf/machine/verdin-imx8mm-extra.conf’ is on the bottom of layer.conf → the error make[1]: *** No rule to make target 'arch/arm64/boot/dts/verdin-imx8mm_dsi-to-lvds_panel-cap-touch-10inch-lvds-copy_overlay.dtbo'. Stop. appears

I also tried adding TEZI_EXTERNAL_KERNEL_DEVICETREE_BOOT:append = " verdin-imx8mm_dsi-to-lvds_panel-cap-touch-10inch-lvds-copy_overlay.dtbo" to the meta-customer-demos/conf/machine/verdin-imx8mm-extra.conf. Same error happened.

Hi @mnano

I think the easiest would be to instead of having a bbappend for linux-toradex have one for device-tree-overlays. Somthing like this:
device-tree-overlays_%.bbapend

FILESEXTRAPATHS:prepend := "${THISDIR}/devcie-tree-overlays:"
SRC_URI += "\
    file://${CUSTOM_DEVICETREE} \
   	"

do_configure:append() {
    cp ${WORKDIR}/${CUSTOM_DEVICETREE} ${S}/
}

It looks like BSP6 doesn’t support -extra anymore (not 100% sure about this). So you would just have to create your own machine-customer.conf and include verdin-imx8mm.conf.
Afterward, you should be able to use this in your machine configuration, something like this:

include conf/machine/verdin-imx8mm.conf

TEZI_EXTERNAL_KERNEL_DEVICETREE_BOOT = "verdin-imx8mm_dsi-to-lvds_panel-cap-touch-10inch-lvds-copy_overlay.dtbo"

Unfortunately, I couldn’t test it yet. Please let me know if it does not work.

Regards,
Stefan

Thank you for your help.

So, I tried it with:

  • New machine called verdin-imx8mm-lvds.conf, same as you suggested. The local.conf sets the MACHINE to it as well.
  • In recipes-kernel/linux/, I changed to having device-tree-overlays_%.bbappend with what you suggested + CUSTOM_DEVICETREE="verdin-imx8mm_dsi-to-lvds_panel-cap-touch-10inch-copy_overlay.dts". The overlays are in the device-tree-overlays/ folder.

There is 2 errors that happen:

  1. alsa-state related packages are not found:


    and later:

  2. The overlay is not installed in the boot filesystem

Finally figured it out:

  1. alsa-state. That’s simple actually, in meta-toradex-nxp/recipes-bsp/alsa-state there is this alsa-state.bbappend which, between other things, adds some asound-dev/asound-dahlia conf and state files. Each of these is in a folder in the name of the machine. So, when you create a new machine based on verdin-imx8mm for example. You have to include that as well. I copied the alsa-state/alsa-state/verdin-imx8mm to my recipes-bsp folder in my layer + renamed it to verdin-imx8mm-lvds (name of my machine). Then I added an additional recipes-bsp/alsa-state/alsa-state.bbappend with just:
FILESEXTRAPATHS:prepend := "${THISDIR}/alsa-state/:"
  1. Now this one I am less sure if that’s the right solution. I just created my own repo for device trees.
    tdx-base.inc define the provider for virtual/dtb. Just change it somewhere to (I did it in my distro conf file):
PREFERRED_PROVIDER_virtual/dtb = "device-tree-overlays-customer"

In my machine (verdin-imx8mm-lvds) conf file, I have:

TEZI_EXTERNAL_KERNEL_DEVICETREE = "verdin-imx8mm_dsi-to-lvds_panel-cap-touch-10inch-lvds_overlay.dtbo verdin-imx8mm_spidev_overlay.dtbo"
TEZI_EXTERNAL_KERNEL_DEVICETREE_BOOT = "verdin-imx8mm_dsi-to-lvds_panel-cap-touch-10inch-lvds_overlay.dtbo verdin-imx8mm_spidev_overlay.dtbo"

For whatever reason, I had to set both of them to get it to work.

For the devicetree overlays, I set up a repository where I have our + Toradex overlays. Then, I have a class called customer-devicetree.bbclass which is the same as toradex-devicetree.bbclass except for:

SRC_URI = "git://git@gitlab.customer.com/device-tree-overlays-customer.git;protocol=ssh;branch=${SRCBRANCH};

And, as indicated by the virtual/dtb provider, I have a recipes-kernel/linux/device-tree-overlays-customer.bb recipe. It is the same as device-tree-overlays_git.bb that you can find in toradex layers but with a different inherit: inherit customer-devicetree

I am sure some of it is unnecessary to fix the issue but now it works. For example, a .bbappend for the device-tree-overlays should suffice.

Sadly I have another problem now.
While the overlay.txt is correct when I check the content of the image, I cannot boot from said image anymore. Seems like something is missing to the definition of a new machine:

U-Boot SPL 2022.04-6.1.0-devel+git.944a4ccb70e4 (Nov 08 2022 - 11:29:12 +0000)
DDRINFO: start DRAM init
DDRINFO: DRAM rate 3000MTS
DDRINFO:ddrphy calibration done
DDRINFO: ddrmix config done
Normal Boot
WDT:   Started watchdog@30280000 with servicing (60s timeout)
Trying to boot from MMC1

It gets stuck at this point and reboot after 60s.

Hi @mnano

Sorry for the late reply. The thing with the new machine was a bad idea on my side, sorry for that. This is why you run into these follow-up issues.

However, I think the easiest is to create a bbappend and solve everything in there:
recipes-kernel/linux/device-tree-overlays_%.bbapend:

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

# This overwrites TEZI_EXTERNAL_KERNEL_DEVICETREE_BOOT for verdin-imx8mm forcefully
TEZI_EXTERNAL_KERNEL_DEVICETREE_BOOT:verdin-imx8mm = "verdin-imx8mm_dsi-to-lvds_panel-cap-touch-10inch-lvds_overlay.dtbo verdin-imx8mm_spidev_overlay.dtbo"

SRC_URI += "\
    file://verdin-imx8mm_dsi-to-lvds_panel-cap-touch-10inch-lvds_overlay.dts \
   	"

do_configure:append() {
    cp ${WORKDIR}/verdin-imx8mm_dsi-to-lvds_panel-cap-touch-10inch-lvds_overlay.dts ${S}/
}

Regards,
Stefan

Hello,

Thank you for your solution.
I essentially did something similar to make it work. Remove the new machine and used a device-tree-overlay_%.bbappend along with a machine-extra.conf that is included by the distro.conf file that I use. Doing it this way worked and a similar result is obtained with your solution.

Thank you again for your time.

Hi @mnano !

Thanks for the feedback!

If you could share the recipe/solution that you ended up with, would be great to guide other people that face similar issue as you :slight_smile:

Best regards,

Hello,

I still ended up using my own device tree overlay repository, but this is still applicable. I have in my layer:

  • conf/machine/verdin-imx8mm-extra.conf
TEZI_EXTERNAL_KERNEL_DEVICETREE = "verdin-imx8mm_dsi-to-lvds_panel-cap-touch-10inch-lvds_overlay.dtbo verdin-imx8mm_spidev_overlay.dtbo"
TEZI_EXTERNAL_KERNEL_DEVICETREE_BOOT = "verdin-imx8mm_dsi-to-lvds_panel-cap-touch-10inch-lvds_overlay.dtbo verdin-imx8mm_spidev_overlay.dtbo"
  • conf/distro/my_distro.conf
include conf/machine/verdin-imx8mm-extra.conf
PREFERRED_PROVIDER_virtual/dtb = "device-tree-overlays-customer"

require conf/distro/include/tdx-base.inc

Rest is the same as tdx-xwayland.conf

  • class/customer-devicetree.bbclass (same as toradex devicetree.class) except the URI:
SRC_URI = "git://git@gitlab.customer.com/device-tree-overlays-customer.git;protocol=ssh;branch=${SRCBRANCH};
  • recipes-kernel/linux/device-tree-overlays-customer_git.bb (same as toradex device-tree-overlays_git.bb) except for:
include customer-devicetree

Thanks, @mnano !

Have a great day!