Device Tree Open Embedded build

Can I add a custom device tree before I build the image with open embedded? I realized in the machine config it made reference to a device tree ; however, I cannot find the device included in the machine file within the oe-core directory.

for example I cannot fine imx6dl-colibri-cam-eval-v3.dtb within the oe-core directory. Do I have to compile the device tree separately then added it to the image after I build the image?

The device tree input files are part of the kernel sources and their binary representation are compiled when the kernel is built. Some further information on writing or changing device tree sources.

The KERNEL_DEVICETREE variable is used by the kernel recipe to set the device tree(s) which are built and deployed.

A variable with the same name in update.sh is used for the device tree file(s) which are deployed to the module.


So to add a custom device tree built and deployed during your OE build you would:

  • Write a patch which adds your device tree sources to the kernel and add it to the OE kernel recipe.
  • Add your device tree to KERNEL_DEVICETREE in the .conf and update.sh file to build and deploy it.
  • Maybe patch the U-Boot sources to set the default of the environment variable fdt_file to your device tree.

Hi, I’m also handling similar difficulties and I just wondered, how to patch u-boots fdt_file definition. I found file colibri_imx6.h, edited the define of FDT_FILE and created a patch. But I do not know where to use the patch. Can you please help me out?

You would add it to the OE U-Boot recipe similarly as you did add your new device tree to the kernel recipe.

I’m aware of that, but I do not now what recipe should I edit. I tried /stuff/meta-toradex/recipes-bsp/u-boot/u-boot-toradex_git.bb but it did not work. So what recipe I must edit, to compile uboot?

I’ve added my own custom layer to oe-core. My image recipe is based on (in fact, almost identical to) meta-toradex/recipes/console-trdx-image.bb.

I’ve written the patch to add my own device tree to the kernel source and added it to my kernel recipe as suggested in your answer. I’ve checked and it is being added to build/out-glibc/work-shared/colibri-vf/kernel-source/arch/arm/boot/dts/.

I’ve copied stuff/meta-toradex/conf/machine/colibri-vf.conf to my layer and changed the KERNEL_DEVICETREE variable. Got no errors when using bitbake to build my image. After the image was built, I unpacked it and changed KERNEL_DEVICETREE in the update.sh script accordingly.

However, when I run the script it doesn’t find my dtb file:

Did not find the devicetrees from KERNEL_DEVICETREE, vf610-colibri-mycarrier-r3.dtb.  Aborting.

Seems that my conf/machine/colibri-vf.conf file is being ignored. Any ideas of what I’m doing wrong ?

Hi

I’m unsure which of the two colibri-vf.conf is taken in your setup.

I’d expect the one with the higher layer priority will take precedence.

You could check with the -e switch to bitbake:

bitbake virtual/kernel -e > kernel.txt

And then search how the KERNEL_DEVICETREE variable gets sets in the kernel.txt file.

Max

Thanks, Max. Your suggestion allowed me to understand what was going on. You were right, the ‘other’ colibri-vf.conf was being used to set the KERNEL_DEVICETREE variable.

I increased the priority of my custom layer and moved it to the very top of the list in build/conf/bblayers.conf.

After that, everything is fine.

Thanks once more.