Cannot compile Device Tree Overlays from Source Code

I followed this link Build Device Tree Overlays from Source Code | Toradex Developer Center to compile the DTO.

I get an error:
In file included from fdtdump.c:14:
fdtdump.c: In function ‘main’:
libfdt/libfdt.h:251:28: error: array subscript ‘struct fdt_header[0]’ is partly outside array bounds of ‘unsigned char[4]’ [-Werror=array-bounds]
251 | fdth->name = cpu_to_fdt32(val);
| ~^~~~~~~~~
libfdt/libfdt.h:253:1: note: in expansion of macro ‘fdt_set_hdr_’
253 | fdt_set_hdr_(magic);
| ^~~~~~~~~~~~
fdtdump.c:216:31: note: while referencing ‘smagic’
216 | unsigned char smagic[FDT_MAGIC_SIZE];

How can I solve it ?

Hello @Massimo,

Could you please send us some more information regarding the BSP or TorizonCore that you are using on the module? Could you please send us the output of tdx-info command (Getting Device Information with Tdx-Info | Toradex Developer Center) from which we will get all the hardware and software information?

Also, could you please share with us the overlay file you have written so that we could try to reproduce the issue?

This is the tdx-info output:

root@colibri-imx6ull-14926715:~# tdx-info

Software summary
Bootloader:               U-Boot
Kernel version:           6.1.22-6.2.0+git.3b29299e5f60 #1 SMP Thu Mar 30 10:49:31 UTC 2023
Kernel command line:      user_debug=30 ubi.mtd=ubi root=ubi0:rootfs rw rootfstype=ubifs ubi.fm_autoconvert=1 console=tty1 console=ttymxc0,115200n8 consoleblank=0 video=mxsfb:640x480M-16@60
Distro name:              NAME="TDX Wayland with XWayland Upstream"
Distro version:           VERSION_ID=6.2.0-build.6
Hostname:                 colibri-imx6ull-14926715

Hardware info
HW model:                 Toradex Colibri iMX6ULL 256/512MB on Colibri Evaluation Board V3
Toradex version:          0044 V1.1A
Serial number:            14926715
Processor arch:           armv7l
root@colibri-imx6ull-14926715:~# tdx-info -dt

Device tree
Device tree enabled:      -
Compatible string:        toradex,colibri-imx6ull-evalfsl,imx6ull
Device trees available:   -

Device tree overlays
Overlays enabled:         -
Overlays available:       -

Hello @Massimo,

Thanks for sending the tdx-info.

Please send us the overlay file so that we can try to reproduce the issue.

Hello Rudhi,
I can’t send you the overlay file. I had the compile error I reported when I tryed to build " Device Tree Compiler (DTC) Tool" with your procedure, following Build Device Tree Overlays from Source Code | Toradex Developer Center.
When I run: make inside the dtc directory, I get the error.
Consider that I run it on Ubuntu 22.04.2 LTC and that I installed the 32 bit host machine cross compilation.


Hello @Massimo,

Could you please send me the output of echo $PATH command?
Also, please send the absolute path where gcc-linaro and dtc are installed.
Have you built the linux kernel as a mandatory requirement?

Hello Rudhi,

$ echo $PATH

linaro path:

dtc path:

I haven’t built the linux kernel because to build only the device tree file, I would want to avoid this, but if it is necessary…

Hello @Massimo,

I was able to reproduce this error on an Ubuntu 22.04 machine. On further investigation, I found that the cause behind this error has been fixed on version 1.6.1 of dtc. I could solve the issue by simply cloning to this branch on the dtc repository. So you will need to do the following:

$ git clone git:// -b v1.6.1 ~/dtc
$ cd ~/dtc
$ make
$ export PATH=$HOME/dtc/:$PATH

Thanks for reporting this error. Please let me know if this solves your issue.

Thank Rudhi,
dtc was compiled without error.

Now I ask you if it is necessary to download the kernel source code to compile the dts files ?
From here Build Device Tree Overlays from Source Code | Toradex Developer Center it seem yes because it is necessary to set the STAGING_KERNEL_DIR variable.

Dear @Massimo,

Glad to hear that it worked.

Now I ask you if it is necessary to download the kernel source code to compile the dts files ?
From here Build Device Tree Overlays from Source Code | Toradex Developer Center it seem yes because it is necessary to set the STAGING_KERNEL_DIR variable.

That’s right, you need to build the kernel and export the STAGING_KERNEL_DIR variable before you compile the dts files.

Dear Rudhi,
I’m trying to compile kernel following your Build Linux Kernel from Source Code | Toradex Developer Center .
I downloaded:
git clone -b v6.1 git://

When I run:
make imx_v6_v7_defconfig
I get:
scripts/Kconfig.include:39: C compiler ‘arm-none-linux-gnueabihf-gcc’ not found
make[1]: *** [scripts/kconfig/Makefile:94: imx_v6_v7_defconfig] Errore 1
make: *** [Makefile:697: imx_v6_v7_defconfig] Errore 2

How can I set the compiler ? I haven’t found in your site.

Hello @Massimo,

This is because the environment variables are not set properly. Can you check the output of echo $CROSS_COMPILE ?

As it is mentioned on the linked article:
The U-Boot and Linux makefiles use the environment variables ARCH/CROSS_COMPILE to configure and call the compiler correctly. Therefore, these environment variables must be exported in any shell instance that will run configure/compile commands to build U-Boot or Linux for the target module.

$ export ARCH=arm
$ export DTC_FLAGS="-@"
$ export PATH=~/gcc-linaro/bin/:$PATH
$ export CROSS_COMPILE=arm-none-linux-gnueabihf-

Hello Rudhi,


Hi @Massimo,

I tried to reproduce the error on the exact same setup as yours but unfortunately, I couldn’t.

I followed all the steps listed on our web page and it just worked fine. It looks like you are probably missing one or several of the steps. Could you please retry?

Dear @Massimo,

Hope you are doing well! May I know if you have been able to make some progress on this topic?

Hi @rudhi.tx,

right now I can compile. There was a problem inside my export_compiler file.
Now, when a compile the dts, I get:
“CHK version_gen.h
Skipping pylibfdt (install python dev and swig to build)”
So I installed:
sudo apt-get install python3-dev
sudo apt-get install swig

After that, running make, I get:

CHK version_gen.h
make[1]: ingresso nella directory «/home/showroom/Dev/Toradex/ImageDev/DeviceTree/dtc»
CHK version_gen.h
PYMOD pylibfdt/
/home/showroom/Dev/Toradex/ImageDev/DeviceTree/dtc/pylibfdt/ DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
from distutils.core import setup, Extension
make[1]: uscita dalla directory «/home/showroom/Dev/Toradex/ImageDev/DeviceTree/dtc»

Is it normal ?

Continuing, I built device tree.
Now, how can I load them in the i.MX6ULL ?


I haven’t received answer about my last post, but I can produce the dtbo files.
I do another question: how can I do the dtb file ?
I only run the “make” command. There are some options to use ?


Hi @Massimo,

Very sorry about the delay.

The error messages that you receive when executing the make are not normal. Could you please send me your export_compiler file?
Also have you exported the dtc path to the PATH variable?
Please send the absolute path to where you have installed your dtc tool, output of echo $PATH, absolute path to where you have created the symlink for gcc-linaro.

All your errors look like there is an error with the paths you have configured either in the export_compiler file or in the PATH variable.

Regarding your second question on loading the dtbo files onto the module:

First of all, you are using a NAND based module. They don’t support device tree overlays. Therefore you will have to modify the dts files, build them into dtb and load them to the module. For these modules, the device tree is stored in an ubifs partition. The reason for this is that originally U-Boot did not support ubifs (I think that changed in the meanwhile).
What you could do is, modify the device tree directly, then compile it to a dtb and afterwards update the ubi volume. This is documented here:

Also, you have to verify that the partition numbering for the dtb by checking the output of the following command:

root@colibri-imx6ull:~# cat /sys/class/ubi/ubi0_1/name

Here you will find how to build your dtb file:

Hi @rudhi.tx,
export_compiler (399 Bytes)

I exported dtc in PATH variable.

Dtc absolute path: /home/showroom/Dev/Toradex/ImageDev/DeviceTree/dtc/
$PATH: /home/showroom/Dev/Toradex/ImageDev/DeviceTree/dtc/:/home/showroom/Dev/Toradex/ImageDev/gcc-linaro/bin/:/home/showroom/Dev/Toradex/ImageDev/gcc-linaro/bin/:/home/showroom/Dev/Raspberry/tools-master/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin

Absolute path to where you have created the symlink for gcc-linaro: /home/showroom/Dev/Toradex/ImageDev/

About dtb file: where is created ?


Hello @Massimo,

The PATH variable and the export file look fine to me. You were receiving some warning messages while executing the make. I think these could be ignored for now as you were able to build the dtb files anyway.

About dtb file: where is created ?

Once you compile the dts files successfully, you should be able to see the corresponding dtb files in linux/arch/arm/boot/dts directory for your upstream kernel. Now you only need to update the ubi partition on the target to deploy the device tree.