How to add custom device tree to deploy/images/colibri-imx6 and update.sh using OpenEmbedded recipes

I added my custom openembedded layer containing a patch which adds my custom device tree and drivers to the kernel sources. The kernel and drivers seems to be build, is available under deploy/images/… and is installed onto the internal flash memory of Toradex modules by the update.sh script.

However, my custom kernel device tree is not installed.

  • I think I have to patch the update.sh script to contain the name of my dtb file in the KERNEL_DEVICETREE variable. But where do I have to add this patch and how I can make bitbake apply it?
  • And how can I tell bitbake to include the dtb file in Colibri-iMX6_pe-LXDE-image_2.7b4-20180424.tar.bz2?

Hi

You could append in local.conf to the KERNEL_DEVICETREE variable which gets set in the machine configuration file.

KERNEL_DEVICETREE_append_colibri-imx6 = " imx6dl-your_version.dtb "

This should make sure that you have your device tree in deploy/images. The legacy image will then put all deploy/images/machine/*.dtb files into the Colibri-iMX6_pe-LXDE-image_2.7b4-20180424.tar.bz2


There is no easy way to change update.sh with a patch. You could add something like the following to add your device tree to the list of device tree files that the legacy update procedure deploys during ‘run update’:

imagedeploytools_append_colibri-imx6 () {
    sed -i 's/\(KERNEL_DEVICETREE\=\"\)/\1imx6dl-your_version.dtb /' ${IMAGE_DIR}/update.sh
}

Note that you additionally need to set the fdt_file U-Boot environment variable to actually use your new device tree.

Max

You could append in local.conf to the
KERNEL_DEVICETREE variable which gets
set in the machine configuration file.

 KERNEL_DEVICETREE_append_colibri-imx6 = " imx6dl-your_version.dtb "

This should make sure that you have
your device tree in deploy/images.

This works. I wonder if there is a way to append this to a *.conf within my custom BSP layer instead of local.conf which is not under version control. Appending to meta-pe-bsp/conf/machine/colibri-imx6.conf had no effect.

There is no easy way to change
update.sh with a patch. You could add
something like the following to add
your device tree to the list of device
tree files that the legacy update
procedure deploys during ‘run update’:

 imagedeploytools_append_colibri-imx6 () {
     sed -i 's/\(KERNEL_DEVICETREE\=\"\)/\1imx6dl-your_version.dtb /' ${IMAGE_DIR}/update.sh
 }

This works if put into meta-pe-software/recipes-images/images/pe-angstrom-lxde-image.bb

Note that you additionally need to set
the fdt_file U-Boot environment
variable to actually use your new
device tree.

For the record here is how I did it:

I added meta-pe-bsp/recipes-bsp/u-boot/files/colibri-imx6/colibri_imx6.h-FDT_FILE_imx6dl-colibri-pe641t-1.dtb.patch:

diff --git a/include/configs/colibri_imx6.h b/include/configs/colibri_imx6.h
index f1fd5b422e..21f4723199 100644
--- a/include/configs/colibri_imx6.h
+++ b/include/configs/colibri_imx6.h
@@ -228,7 +228,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-pe641t-1.dtb"
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	BOOTENV \
 	"bootcmd=run emmcboot ; echo ; echo emmcboot failed ; " \

and meta-pe-bsp/recipes-bsp/u-boot/u-boot-toradex_2016.11.bbappend:

# the _mx6 suffix restricts the validity to iMX6 modules
# see ELPUYPC p.105
SRC_URI_append_mx6 = " file://colibri_imx6.h-FDT_FILE_imx6dl-colibri-pe641t-1.dtb.patch"
FILESEXTRAPATHS_prepend := "${THISDIR}/files/colibri-imx6/:"

This the layer structure:

meta-pe-bsp/
├── conf
│   ├── layer.conf
│   └── machine
│       ├── colibri-imx6.conf
│       └── colibri-t30-pe.conf
├── recipes-bsp
│   └── u-boot
│       ├── files
│       │   └── colibri-imx6
│       │       └── colibri_imx6.h-FDT_FILE_imx6dl-colibri-pe641t-1.dtb.patch
│       └── u-boot-toradex_2016.11.bbappend
└── recipes-kernel
    └── linux
        ├...
        :
        .

After flashing the new environment variables can be loaded with:

env default -a
saveenv

Hi

This works. I wonder if there is a way to append this to a *.conf within my custom BSP layer instead of local.conf which is not under version control.

You cannot append to *.conf files.

One not intutive way is to misuse the layer.conf file of your layer. As an aid to your uninitiated coworker I think a comment in the bbappend to the linux kernel pointing to conf/layer.conf could be beneficial.

Max

Well then the cleaner way seems to stick to local.conf and add a local.conf.example to our docs.