Device tree modification in Yocto for Colibri i.MX7 emmc

Hi @ompie,

I’m glad you could solve your issue!

You’re correct, the

do_configure_append() {    
  sed -i 's/#define FDT_FILE.*/#define FDT_FILE "my-custom-devicetree-file.dtb"/' ${S}/include/configs/colibri_imx6.h
}

It’s just an example for Colibri iMX6. However, if you check the u-boot source code for Colibri iMX7, the FDT_FILE doesn’t exist, so you need to first check this file and then modify the sed command accordingly.

Thanks for your input.

Best Regards,
Hiago.

Hi @hfranco.tx ,

I stumbled on the next “challenge”…

The device tree that I managed to get working was very simple in that it only disabled UART2:
test_imx7d-colibri-emmc-interferometer.dts (1.1 KB)

When replacing this file with the files I successfully used on the Torizon project for the same custom board, I stumbled into errors.
My device tree structure is as follows:

  • The top .dts file is called imx7d-colibri-emmc-interferometer.dts
  • It includes two other files:
    #include “imx7d-colibri-emmc.dtsi”
    #include “imx7-colibri-interferometer.dtsi”
  • The second one is created by me
  • I also modified “imx7-colibri.dtsi” which is included somewhere along the line

The result is that there are the only three files under meta-customer/recipes-kernel/linux/linux-toradex. linux-toradex%.bbappend takes care of copying them to the right place :

FILESEXTRAPATHS_prepend := "${THISDIR}/linux-toradex:"

# Prevent the use of in-tree defconfig
unset KBUILD_DEFCONFIG

#--- We're adding some custom device tree files and a "defconfig" that configures the linux modules that are to be included

SRC_URI += "\
    file://imx7d-colibri-emmc-interferometer.dts \
    file://imx7-colibri-interferometer.dtsi \
    file://imx7-colibri.dtsi \
    file://colibri_imx7_defconfig  \
    "

do_configure_append() {
    # For arm32 bit devices
    cp ${WORKDIR}/imx7d-colibri-emmc-interferometer.dts ${S}/arch/arm/boot/dts
    cp ${WORKDIR}/imx7-colibri-interferometer.dtsi      ${S}/arch/arm/boot/dts
    cp ${WORKDIR}/imx7-colibri.dtsi                     ${S}/arch/arm/boot/dts
}

These are the three files:
imx7d-colibri-emmc-interferometer.dts (2.4 KB)
imx7-colibri-interferometer.dtsi (5.4 KB)
imx7-colibri.dtsi (28.7 KB)

When I ran bitbake, I got an error "Reference to non-existent node or label “reg_3v3"”:

|   DTC     arch/arm/boot/dts/imx7d-colibri-emmc-iris-v2.dtb
| /home/jeroen/Interferometer/yocto/oe-core/build/tmp/work-shared/colibri-imx7-emmc/kernel-source/arch/arm/boot/dts/imx7-colibri.dtsi:59.23-89.4: ERROR (phandle_references): /panel-dpi: Reference to non-existent node or label "reg_3v3"
| 
| ERROR: Input tree has errors, aborting (use -f to force output)
| make[2]: *** [scripts/Makefile.lib:285: arch/arm/boot/dts/imx7d-colibri-emmc-iris-v2.dtb] Error 2
| make[1]: *** [/home/jeroen/Interferometer/yocto/oe-core/build/tmp/work-shared/colibri-imx7-emmc/kernel-source/Makefile:1270: imx7d-colibri-emmc-iris-v2.dtb] Error 2
| make: *** [/home/jeroen/Interferometer/yocto/oe-core/build/tmp/work-shared/colibri-imx7-emmc/kernel-source/Makefile:179: sub-make] Error 2
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
| ERROR: Execution of '/home/jeroen/Interferometer/yocto/oe-core/build/tmp/work/colibri_imx7_emmc-tdx-linux-gnueabi/linux-toradex/5.4.193+gitAUTOINC+f782992971-r0/temp/run.do_compile.2468614' failed with exit code 1
ERROR: Task (/home/jeroen/Interferometer/yocto/oe-core/build/../layers/meta-toradex-nxp/recipes-kernel/linux/linux-toradex_5.4-2.3.x.bb:do_compile) failed with exit code '1'

Since I do not use the panel-dpi in which the reg_3v3 was referred to, I commented that part r and disabled the panel-dpi device.

I then got another error. the really strange thing is that it now complaning about “lcd_panel_in” and about the file arch/arm/boot/dts/imx7d-colibri-emmc-iris-v2.dtb.
So where does the “iris” part come from ???

| NOTE: make -j 7 HOSTCC=gcc  -isystem/home/jeroen/Interferometer/yocto/oe-core/build/tmp/work/colibri_imx7_emmc-tdx-linux-gnueabi/linux-toradex/5.4.193+gitAUTOINC+f782992971-r0/recipe-sysroot-native/usr/include -O2 -pipe -L/home/jeroen/Interferometer/yocto/oe-core/build/tmp/work/colibri_imx7_emmc-tdx-linux-gnueabi/linux-toradex/5.4.193+gitAUTOINC+f782992971-r0/recipe-sysroot-native/usr/lib                         -L/home/jeroen/Interferometer/yocto/oe-core/build/tmp/work/colibri_imx7_emmc-tdx-linux-gnueabi/linux-toradex/5.4.193+gitAUTOINC+f782992971-r0/recipe-sysroot-native/lib                         -Wl,--enable-new-dtags                         -Wl,-rpath-link,/home/jeroen/Interferometer/yocto/oe-core/build/tmp/work/colibri_imx7_emmc-tdx-linux-gnueabi/linux-toradex/5.4.193+gitAUTOINC+f782992971-r0/recipe-sysroot-native/usr/lib                         -Wl,-rpath-link,/home/jeroen/Interferometer/yocto/oe-core/build/tmp/work/colibri_imx7_emmc-tdx-linux-gnueabi/linux-toradex/5.4.193+gitAUTOINC+f782992971-r0/recipe-sysroot-native/lib                         -Wl,-rpath,/home/jeroen/Interferometer/yocto/oe-core/build/tmp/work/colibri_imx7_emmc-tdx-linux-gnueabi/linux-toradex/5.4.193+gitAUTOINC+f782992971-r0/recipe-sysroot-native/usr/lib                         -Wl,-rpath,/home/jeroen/Interferometer/yocto/oe-core/build/tmp/work/colibri_imx7_emmc-tdx-linux-gnueabi/linux-toradex/5.4.193+gitAUTOINC+f782992971-r0/recipe-sysroot-native/lib                         -Wl,-O1 -Wl,--allow-shlib-undefined -Wl,--dynamic-linker=/home/jeroen/Interferometer/yocto/oe-core/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2 HOSTCPP=gcc  -E HOSTCXX=g++  -isystem/home/jeroen/Interferometer/yocto/oe-core/build/tmp/work/colibri_imx7_emmc-tdx-linux-gnueabi/linux-toradex/5.4.193+gitAUTOINC+f782992971-r0/recipe-sysroot-native/usr/include -O2 -pipe -L/home/jeroen/Interferometer/yocto/oe-core/build/tmp/work/colibri_imx7_emmc-tdx-linux-gnueabi/linux-toradex/5.4.193+gitAUTOINC+f782992971-r0/recipe-sysroot-native/usr/lib                         -L/home/jeroen/Interferometer/yocto/oe-core/build/tmp/work/colibri_imx7_emmc-tdx-linux-gnueabi/linux-toradex/5.4.193+gitAUTOINC+f782992971-r0/recipe-sysroot-native/lib                         -Wl,--enable-new-dtags                         -Wl,-rpath-link,/home/jeroen/Interferometer/yocto/oe-core/build/tmp/work/colibri_imx7_emmc-tdx-linux-gnueabi/linux-toradex/5.4.193+gitAUTOINC+f782992971-r0/recipe-sysroot-native/usr/lib                         -Wl,-rpath-link,/home/jeroen/Interferometer/yocto/oe-core/build/tmp/work/colibri_imx7_emmc-tdx-linux-gnueabi/linux-toradex/5.4.193+gitAUTOINC+f782992971-r0/recipe-sysroot-native/lib                         -Wl,-rpath,/home/jeroen/Interferometer/yocto/oe-core/build/tmp/work/colibri_imx7_emmc-tdx-linux-gnueabi/linux-toradex/5.4.193+gitAUTOINC+f782992971-r0/recipe-sysroot-native/usr/lib                         -Wl,-rpath,/home/jeroen/Interferometer/yocto/oe-core/build/tmp/work/colibri_imx7_emmc-tdx-linux-gnueabi/linux-toradex/5.4.193+gitAUTOINC+f782992971-r0/recipe-sysroot-native/lib                         -Wl,-O1 -Wl,--allow-shlib-undefined -Wl,--dynamic-linker=/home/jeroen/Interferometer/yocto/oe-core/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2 imx7d-colibri-emmc-eval-v3.dtb CC=arm-tdx-linux-gnueabi-gcc  -mno-thumb-interwork -marm -fuse-ld=bfd -fmacro-prefix-map=/home/jeroen/Interferometer/yocto/oe-core/build/tmp/work/colibri_imx7_emmc-tdx-linux-gnueabi/linux-toradex/5.4.193+gitAUTOINC+f782992971-r0=/usr/src/debug/linux-toradex/5.4.193+gitAUTOINC+f782992971-r0                      -fdebug-prefix-map=/home/jeroen/Interferometer/yocto/oe-core/build/tmp/work/colibri_imx7_emmc-tdx-linux-gnueabi/linux-toradex/5.4.193+gitAUTOINC+f782992971-r0=/usr/src/debug/linux-toradex/5.4.193+gitAUTOINC+f782992971-r0                      -fdebug-prefix-map=/home/jeroen/Interferometer/yocto/oe-core/build/tmp/work/colibri_imx7_emmc-tdx-linux-gnueabi/linux-toradex/5.4.193+gitAUTOINC+f782992971-r0/recipe-sysroot=                      -fdebug-prefix-map=/home/jeroen/Interferometer/yocto/oe-core/build/tmp/work/colibri_imx7_emmc-tdx-linux-gnueabi/linux-toradex/5.4.193+gitAUTOINC+f782992971-r0/recipe-sysroot-native=  -fdebug-prefix-map=/home/jeroen/Interferometer/yocto/oe-core/build/tmp/work-shared/colibri-imx7-emmc/kernel-source=/usr/src/kernel -fdebug-prefix-map=/home/jeroen/Interferometer/yocto/oe-core/build/tmp/work-shared/colibri-imx7-emmc/kernel-build-artifacts=/usr/src/kernel   LD=arm-tdx-linux-gnueabi-ld.bfd   LOADADDR=0x81000000
|   DTC     arch/arm/boot/dts/imx7d-colibri-emmc-eval-v3.dtb
| /home/jeroen/Interferometer/yocto/oe-core/build/tmp/work-shared/colibri-imx7-emmc/kernel-source/arch/arm/boot/dts/imx7-colibri.dtsi:516.23-518.5: ERROR (phandle_references): /soc/aips-bus@30400000/lcdif@30730000/port/endpoint: Reference to non-existent node or label "lcd_panel_in"
| 
| ERROR: Input tree has errors, aborting (use -f to force output)
| make[2]: *** [scripts/Makefile.lib:285: arch/arm/boot/dts/imx7d-colibri-emmc-eval-v3.dtb] Error 2
| make[1]: *** [/home/jeroen/Interferometer/yocto/oe-core/build/tmp/work-shared/colibri-imx7-emmc/kernel-source/Makefile:1270: imx7d-colibri-emmc-eval-v3.dtb] Error 2
| make: *** [/home/jeroen/Interferometer/yocto/oe-core/build/tmp/work-shared/colibri-imx7-emmc/kernel-source/Makefile:179: sub-make] Error 2
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
| ERROR: Execution of '/home/jeroen/Interferometer/yocto/oe-core/build/tmp/work/colibri_imx7_emmc-tdx-linux-gnueabi/linux-toradex/5.4.193+gitAUTOINC+f782992971-r0/temp/run.do_compile.2322216' failed with exit code 1
ERROR: Task (/home/jeroen/Interferometer/yocto/oe-core/build/../layers/meta-toradex-nxp/recipes-kernel/linux/linux-toradex_5.4-2.3.x.bb:do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 5746 tasks of which 5714 didn't need to be rerun and 1 failed.
NOTE: Writing buildhistory
NOTE: Writing buildhistory took: 7 seconds

Summary: 1 task failed:
  /home/jeroen/Interferometer/yocto/oe-core/build/../layers/meta-toradex-nxp/recipes-kernel/linux/linux-toradex_5.4-2.3.x.bb:do_compile
Summary: There was 1 WARNING message shown.
Summary: There were 2 ERROR messages shown, returning a non-zero exit code.

Sorry for the quite lengthy error message but it may provide you some insight.
I also made a tar file of the entire meta-customer directory :
meta-customer.tar (240 KB)

The original "imx7-colibri.dtsi " came from https://github.com/toradex/device-trees by the way

Any help on resolving the “reg_3v3” problem is very much appreciated…

Best regards,
Jeroen

Solved (I think…)

I commented the the followong two definitions in meta-toradex-nxp/conc/machine/include/colibri-imx7-emcc.inc because they referred to aster and iris boards:

#KERNEL_DEVICETREE_append_use-nxp-bsp = " \
#    imx7d-colibri-emmc-iris.dtb \
#    imx7d-colibri-emmc-iris-v2.dtb \
#"
#KERNEL_DEVICETREE_append_use-mainline-bsp = " \
#    imx7d-colibri-emmc-aster.dtb \
#"

In meta-freescale-3rdparty/conf/machine/colibri-imx7-emmc.conf, I commented two lines and added a new definition:

#replaced two lines with one.
#KERNEL_DEVICETREE = "imx7d-colibri-emmc-eval-v3.dtb"
#KERNEL_DEVICETREE_append_use-nxp-bsp = " imx7d-colibri-emmc-aster.dtb"
KERNEL_DEVICETREE = "imx7d-colibri-emmc-interferometer.dtb"

With this, I managed to generate a new image that resulted in the changes I wanted (by checking /dev/spi*, dev/ttym*, etc.)

Jeroen