IMX6 change default device tree binary using Yocto (custom carrier board)

Hi all,

I’m currently using a Colibri IMX6S module on an Iris carrier board and have been trying to replace the device tree binary, since we’ll be moving to a custom carrier board. We’re using Yocto with OpenEmbedded Core to build our Linux image.

In order to replace the default dtb, I’ve added a custom dts file to our own meta layer, appended the custom device tree to the KERNEL_DEVICETREE variable using KERNEL_DEVICETREE_append from our bbappend file, like so:

SRC_URI += "file://imx6dl-colibri-custom-carrier.dts;subdir=git/arch/${ARCH}/boot/dts \
            file://0002-Update-dtb-makefile.patch \
"

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

PACKAGE_ARCH = "${MACHINE_ARCH}"

KERNEL_DEVICETREE_append = "imx6dl-colibri-custom-carrier.dtb"

and have created a patch to patch the default dtb file in uboot (replaced the FDT_FILE define in colibri_imx6.h):

SRC_URI += "file://0001-Update-default-dtb-uboot.patch"

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


diff --git a/include/configs/colibri_imx6.h b/include/configs/colibri_imx6.h
old mode 100644
new mode 100755
index fda171b…b4fe5d1
— a/include/configs/colibri_imx6.h
+++ b/include/configs/colibri_imx6.h
@@ -235,7 +235,7 @@
“usbdtbload=setenv dtbparam; load usb 0:1 ${fdt_addr_r} "
“${fdt_file} && setenv dtbparam " - ${fdt_addr_r}” && true\0”

-#define FDT_FILE "imx6dl-colibri-eval-v3.dtb"
+#define FDT_FILE "imx6dl-colibri-custom-carrier.dtb"
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	BOOTENV \
 	"boot_file=zImage\0" \

I’ve also patched the Makefile:

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
old mode 100644
new mode 100755
index 44d94f8..89099d2
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -333,6 +333,7 @@ dtb-$(CONFIG_SOC_IMX6Q) += \
 	imx6dl-colibri-aster.dtb \
 	imx6dl-colibri-cam-eval-v3.dtb \
 	imx6dl-colibri-eval-v3.dtb \
+	imx6dl-colibri-custom-carrier.dtb \
 	imx6dl-cubox-i.dtb \
 	imx6dl-dfi-fs700-m60.dtb \
 	imx6dl-gw51xx.dtb \

When building the image though, I’m presented with the following error:

ERROR: linux-toradex-4.9-2.3.x+gitAUTOINC+5758a8e648-r0 do_compile: oe_runmake failed
ERROR: linux-toradex-4.9-2.3.x+gitAUTOINC+5758a8e648-r0 do_compile: Function failed: do_compile (log file is located at /yocto/Toradex/oe-core/build/tmp-glibc/work/colibri_imx6-angstrom-linux-gnueabi/linux-toradex/4.9-2.3.x+gitAUTOINC+5758a8e648-r0/temp/log.do_compile.14684)
ERROR: Logfile of failure stored in: /yocto/Toradex/oe-core/build/tmp-glibc/work/colibri_imx6-angstrom-linux-gnueabi/linux-toradex/4.9-2.3.x+gitAUTOINC+5758a8e648-r0/temp/log.do_compile.14684
Log data follows:
| DEBUG: Executing shell function do_compile
| /yocto/Toradex/oe-core/build/tmp-glibc/work/colibri_imx6-angstrom-linux-gnueabi/linux-toradex/4.9-2.3.x+gitAUTOINC+5758a8e648-r0/temp/run.do_compile.14684: 242: /yocto/Toradex/oe-core/build/tmp-glibc/work/colibri_imx6-angstrom-linux-gnueabi/linux-toradex/4.9-2.3.x+gitAUTOINC+5758a8e648-r0/temp/run.do_compile.14684: arm-angstrom-linux-gnueabi-gcc: not found
| NOTE: make -j 12 HOSTCC=gcc  -isystem/yocto/Toradex/oe-core/build/tmp-glibc/work/colibri_imx6-angstrom-linux-gnueabi/linux-toradex/4.9-2.3.x+gitAUTOINC+5758a8e648-r0/recipe-sysroot-native/usr/include -O2 -pipe -L/yocto/Toradex/oe-core/build/tmp-glibc/work/colibri_imx6-angstrom-linux-gnueabi/linux-toradex/4.9-2.3.x+gitAUTOINC+5758a8e648-r0/recipe-sysroot-native/usr/lib -L/yocto/Toradex/oe-core/build/tmp-glibc/work/colibri_imx6-angstrom-linux-gnueabi/linux-toradex/4.9-2.3.x+gitAUTOINC+5758a8e648-r0/recipe-sysroot-native/lib -Wl,-rpath-link,/yocto/Toradex/oe-core/build/tmp-glibc/work/colibri_imx6-angstrom-linux-gnueabi/linux-toradex/4.9-2.3.x+gitAUTOINC+5758a8e648-r0/recipe-sysroot-native/usr/lib -Wl,-rpath-link,/yocto/Toradex/oe-core/build/tmp-glibc/work/colibri_imx6-angstrom-linux-gnueabi/linux-toradex/4.9-2.3.x+gitAUTOINC+5758a8e648-r0/recipe-sysroot-native/lib -Wl,-rpath,/yocto/Toradex/oe-core/build/tmp-glibc/work/colibri_imx6-angstrom-linux-gnueabi/linux-toradex/4.9-2.3.x+gitAUTOINC+5758a8e648-r0/recipe-sysroot-native/usr/lib -Wl,-rpath,/yocto/Toradex/oe-core/build/tmp-glibc/work/colibri_imx6-angstrom-linux-gnueabi/linux-toradex/4.9-2.3.x+gitAUTOINC+5758a8e648-r0/recipe-sysroot-native/lib -Wl,-O1 HOSTCPP=gcc  -E zImage CC=arm-angstrom-linux-gnueabi-gcc  -mno-thumb-interwork -marm -fuse-ld=bfd   LD=arm-angstrom-linux-gnueabi-ld.bfd   LOADADDR=0x10008000
| /yocto/Toradex/oe-core/build/tmp-glibc/work-shared/colibri-imx6/kernel-source/scripts/gcc-version.sh: line 25: arm-angstrom-linux-gnueabi-gcc: command not found
| /yocto/Toradex/oe-core/build/tmp-glibc/work-shared/colibri-imx6/kernel-source/scripts/gcc-version.sh: line 26: arm-angstrom-linux-gnueabi-gcc: command not found
| make[2]: arm-angstrom-linux-gnueabi-gcc: Command not found
| make[2]: arm-angstrom-linux-gnueabi-gcc: Command not found
|   CHK     include/config/kernel.release
| make[2]: arm-angstrom-linux-gnueabi-gcc: Command not found
| make[2]: arm-angstrom-linux-gnueabi-gcc: Command not found
|   GEN     ./Makefile
| make[2]: arm-angstrom-linux-gnueabi-gcc: Command not found
|   CHK     include/generated/uapi/linux/version.h
| make[2]: arm-angstrom-linux-gnueabi-gcc: Command not found
|   CHK     include/generated/utsrelease.h
| make[2]: arm-angstrom-linux-gnueabi-gcc: Command not found
| make[2]: arm-angstrom-linux-gnueabi-gcc: Command not found
|   Using /yocto/Toradex/oe-core/build/tmp-glibc/work-shared/colibri-imx6/kernel-source as source for kernel
| make[2]: arm-angstrom-linux-gnueabi-gcc: Command not found
|   CC      scripts/mod/empty.o
| /bin/sh: 1: arm-angstrom-linux-gnueabi-gcc: not found
| /yocto/Toradex/oe-core/build/tmp-glibc/work-shared/colibri-imx6/kernel-source/scripts/Makefile.build:304: recipe for target 'scripts/mod/empty.o' failed
| make[4]: *** [scripts/mod/empty.o] Error 127
| /yocto/Toradex/oe-core/build/tmp-glibc/work-shared/colibri-imx6/kernel-source/scripts/Makefile.build:555: recipe for target 'scripts/mod' failed
| make[3]: *** [scripts/mod] Error 2
| make[3]: *** Waiting for unfinished jobs....
| /yocto/Toradex/oe-core/build/tmp-glibc/work-shared/colibri-imx6/kernel-source/Makefile:591: recipe for target 'scripts' failed
| make[2]: *** [scripts] Error 2
| Makefile:152: recipe for target 'sub-make' failed
| make[1]: *** [sub-make] Error 2
| Makefile:24: recipe for target '__sub-make' failed
| make: *** [__sub-make] Error 2
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_compile (log file is located at /yocto/Toradex/oe-core/build/tmp-glibc/work/colibri_imx6-angstrom-linux-gnueabi/linux-toradex/4.9-2.3.x+gitAUTOINC+5758a8e648-r0/temp/log.do_compile.14684)
ERROR: Task (/yocto/Toradex/oe-core/build/../layers/meta-toradex-nxp/recipes-kernel/linux/linux-toradex_4.9-2.3.x.bb:do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 3126 tasks of which 3125 didn't need to be rerun and 1 failed.
NOTE: Writing buildhistory

Summary: 1 task failed:
  /yocto/Toradex/oe-core/build/../layers/meta-toradex-nxp/recipes-kernel/linux/linux-toradex_4.9-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.

I don’t understand why Yocto is complaining about a missing compiler, when only adding our custom dtb file to the variable.

When removing the KERNEL_DEVICETREE_append from my bbappend file, the error is gone and the image builds properly. This however results in uboot unable to find our custom dtb file during startup (which makes sense since the dtb file isn’t included in the bootfs partition).

Does anyone know what I’m missing here and how I can solve this error?

Thanks!

How about adding that missing space when appending?

KERNEL_DEVICETREE_append = " imx6dl-colibri-custom-carrier.dtb"

Thanks, that seems to solve the weird compiler error I was facing!

Now Yocto builds fine but unfortunately our custom dtb file is still not included in the bootfs partition (tar file). Do you have any idea what could cause this or which step I’m missing?

Thanks again!

Apparently I needed to move the KERNEL_DEVICETREE_append from my bbappend to the local.conf file of my meta layer (or machine config). This resulted in my custom dtb file to be added to the bootfs partition. Thanks!

Perfect that it works. Thanks for the feedback.