Update image.json file and adding a custom device tree during Yocto build - iMX6ULL BSP 6

Hi everyone,

I have created a recipe to add my custom device tree according to these instructions.

I checked that my custom device tree was store in the final Colibri-iMX6ULL_Reference-Multimedia-Image-upstream-Tezi_6.4.0-devel-****.tar file and the fdtfile inside u-boot-initial-env was updated. However, the image.json file wasn’t updated

Everything worked fine when I manually update the image.json file, change the filename to my custom device tree.

      "product_ids": "0044",
      "filename": "my-custom-devicetree-file.dtb"

I tried the following approaches to update the image.json during the Yocto phase:

  1. The image.json file was updated when I add the TORADEX_PRODUCT_IDS[0044] = β€œmy-custom-devicetree-file.dtb” inside the build/conf/local.conf.
  2. The image.json file was updated when I change the TORADEX_PRODUCT_IDS[0044] value inside layers/meta-toradex-nxp/conf/machine/include/colibri-imx6ull.inc.
  3. However, the image.json file WAS NOT updated when I add the TORADEX_PRODUCT_IDS[0044] = β€œmy-custom-devicetree-file.dtb” inside the meta-custom/conf/layer.conf.

How can I update that information inside image.json by my meta-custom layer during the Yocto build? I tried this approach described here, but I got many errors.

Following the tree of my meta layer. The priority value inside layer.conf is BBFILE_PRIORITY_../layers/meta-custom = "7".

.
β”œβ”€β”€ conf
β”‚   β”œβ”€β”€ layer.conf
β”‚   └── machine
β”‚       └── colibri-imx6ull-extra.conf
β”œβ”€β”€ COPYING.MIT
β”œβ”€β”€ README
β”œβ”€β”€ recipes-bsp
β”‚   └── u-boot
β”‚       └── u-boot-toradex_%.bbappend
β”œβ”€β”€ recipes-example
β”‚   └── example
β”‚       └── example_0.1.bb
└── recipes-kernel
    └── linux
        β”œβ”€β”€ linux-toradex
        β”‚   └── my-custom-devicetree-file.dts
        └── linux-toradex%.bbappend

Thanks for helping!

System and Hardware:

  • Reference image tdx-reference-multimedia-image
  • Toradex BSP 6
  • Colibri iMX6ULL 512MB IT V1.1A
  • Aster V1.1B board

Hi @CharlesDias,

Since the MACHINE configuration is located inside a .inc file, the recommended approach to incorporate it into your layer is to copy the entire MACHINE.inc file into your layer in the same directory. Then, make the necessary modifications within your layer. Could you please give this a try and confirm if it works?

Best regards,
Daniel Morais

Hi @daniel_m.tx ,

I’ll return to this issue next week. I’ll share the results as soon as possible.

Thanks for your help!

Hi @daniel_m.tx ,

I did some test. Unfortunately, didn’t solve. Please, check the result below:

1. Test

  • In local.conf has the MACHINE ?= "colibri-imx6ull".
  • I copy the colibri-imx6ull.inc file to my layer, layers/meta-custom/conf/machine/include/colibri-imx6ull.inc and update the TORADEX_PRODUCT_IDS variable to my-custom-devicetree-file.dtb.
  • Also, I changed the BBFILE_PRIORITY_meta-custom = "99" inside the layer.conf.
  • And run the commands
$ bitbake -c cleansstate tdx-reference-multimedia-image
$ bitbake -f tdx-reference-multimedia-image
  • Result: It Didn’t work. After build, the image.json still with the Toradex’s device tree file.
β”œβ”€β”€ conf
β”‚   β”œβ”€β”€ layer.conf
β”‚   └── machine
β”‚       β”œβ”€β”€ colibri-imx6ull-extra.conf
β”‚       └── include
β”‚           └── colibri-imx6ull.inc
β”œβ”€β”€ COPYING.MIT
β”œβ”€β”€ README
β”œβ”€β”€ recipes-bsp
β”‚   └── u-boot
β”‚       └── u-boot-toradex_%.bbappend
β”œβ”€β”€ recipes-example
β”‚   └── example
β”‚       └── example_0.1.bb
└── recipes-kernel
    └── linux
        β”œβ”€β”€ linux-toradex
        β”‚   └── my-custom-devicetree-file.dts
        └── linux-toradex%.bbappend

2. Test

  • I copied the colibri-imx6ull.conf file to my layer.

  • and run the commands to clean the state and build again the tdx-reference-multimedia-image recipes.

  • Result: It Didn’t work. After build, the image.json still with the Toradex’s device tree file.

β”œβ”€β”€ conf
β”‚   β”œβ”€β”€ layer.conf
β”‚   └── machine
β”‚       β”œβ”€β”€ colibri-imx6ull.conf
β”‚       β”œβ”€β”€ colibri-imx6ull-extra.conf
β”‚       └── include
β”‚           └── colibri-imx6ull.inc
β”œβ”€β”€ COPYING.MIT
β”œβ”€β”€ README
β”œβ”€β”€ recipes-bsp
β”‚   └── u-boot
β”‚       └── u-boot-toradex_%.bbappend
β”œβ”€β”€ recipes-example
β”‚   └── example
β”‚       └── example_0.1.bb
└── recipes-kernel
    └── linux
        β”œβ”€β”€ linux-toradex
        β”‚   └── my-custom-devicetree-file.dts
        └── linux-toradex%.bbappend

3. Test

Following these instructions,

  • I copied the colibri-imx6ull.conf file to my layer.
  • I created my own MACHINE my-colibri-imx6ull.conf. Inside the my-colibri-imx6ull.conf has just:
require conf/machine/colibri-imx6ull.conf
  • Changed the file name from 'colibri-imx6ull.inc to my-colibri-imx6ull.inc.
  • Updated the local.conf to MACHINE ?= "my-colibri-imx6ull".
  • I remove the build/tmp and sstate-cache folders

My layer structure is:

β”œβ”€β”€ conf
β”‚   β”œβ”€β”€ layer.conf
β”‚   └── machine
β”‚       β”œβ”€β”€ colibri-imx6ull.conf
β”‚       β”œβ”€β”€ colibri-imx6ull-extra.conf
β”‚       β”œβ”€β”€ include
β”‚       β”‚   └── my-colibri-imx6ull.inc
β”‚       └── my-colibri-imx6ull.conf
β”œβ”€β”€ COPYING.MIT
β”œβ”€β”€ README
β”œβ”€β”€ recipes-bsp
β”‚   └── u-boot
β”‚       └── u-boot-toradex_%.bbappend
β”œβ”€β”€ recipes-example
β”‚   └── example
β”‚       └── example_0.1.bb
└── recipes-kernel
    └── linux
        β”œβ”€β”€ linux-toradex
        β”‚   └── my-custom-devicetree-file.dts
        └── linux-toradex%.bbappend

But I got the errors:

ERROR: u-boot-toradex-1_2022.07-r0 do_deploy: ExecutionError('/home/imx6ull/oe-core/build/tmp/work/my_colibri_imx6ull-tdx-linux-gnueabi/u-boot-toradex/1_2022.07-r0/temp/run.do_deploy.3242530', 1, None, None)
ERROR: Logfile of failure stored in: /home/imx6ull/oe-core/build/tmp/work/my_colibri_imx6ull-tdx-linux-gnueabi/u-boot-toradex/1_2022.07-r0/temp/log.do_deploy.3242530
Log data follows:
| DEBUG: Executing python function sstate_task_prefunc
| DEBUG: Python function sstate_task_prefunc finished
| DEBUG: Executing shell function do_deploy
| install: cannot stat '/home/imx6ull/oe-core/build/tmp/work/my_colibri_imx6ull-tdx-linux-gnueabi/u-boot-toradex/1_2022.07-r0/build/u-boot-nand.imx': No such file or directory
| WARNING: /home/imx6ull/oe-core/build/tmp/work/my_colibri_imx6ull-tdx-linux-gnueabi/u-boot-toradex/1_2022.07-r0/temp/run.do_deploy.3242530:202 exit 1 from 'install -D -m 644 /home/imx6ull/oe-core/build/tmp/work/my_colibri_imx6ull-tdx-linux-gnueabi/u-boot-toradex/1_2022.07-r0/build/u-boot-nand.imx /home/imx6ull/oe-core/build/tmp/work/my_colibri_imx6ull-tdx-linux-gnueabi/u-boot-toradex/1_2022.07-r0/deploy-u-boot-toradex/u-boot-nand-my-colibri-imx6ull-2022.07-r0.imx'
| WARNING: Backtrace (BB generated script):
| 	#1: do_deploy, /home/imx6ull/oe-core/build/tmp/work/my_colibri_imx6ull-tdx-linux-gnueabi/u-boot-toradex/1_2022.07-r0/temp/run.do_deploy.3242530, line 202
| 	#2: main, /home/imx6ull/oe-core/build/tmp/work/my_colibri_imx6ull-tdx-linux-gnueabi/u-boot-toradex/1_2022.07-r0/temp/run.do_deploy.3242530, line 458
ERROR: Task (/home/imx6ull/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/u-boot-toradex_2022.07.bb:do_deploy) failed with exit code '1'
ERROR: u-boot-toradex-1_2022.07-r0 do_install: ExecutionError('/home/imx6ull/oe-core/build/tmp/work/my_colibri_imx6ull-tdx-linux-gnueabi/u-boot-toradex/1_2022.07-r0/temp/run.do_install.3242537', 1, None, None)
ERROR: Logfile of failure stored in: /home/imx6ull/oe-core/build/tmp/work/my_colibri_imx6ull-tdx-linux-gnueabi/u-boot-toradex/1_2022.07-r0/temp/log.do_install.3242537
Log data follows:
| DEBUG: Executing python function extend_recipe_sysroot
| NOTE: Direct dependencies are ['/home/imx6ull/oe-core/build/../layers/openembedded-core/meta/recipes-core/glibc/glibc_2.35.bb:do_populate_sysroot', '/home/imx6ull/oe-core/build/../layers/openembedded-core/meta/recipes-devtools/gcc/gcc-cross_11.4.bb:do_populate_sysroot', '/home/imx6ull/oe-core/build/../layers/openembedded-core/meta/recipes-devtools/gcc/gcc-runtime_11.4.bb:do_populate_sysroot', '/home/imx6ull/oe-core/build/../layers/openembedded-core/meta/recipes-devtools/quilt/quilt-native_0.67.bb:do_populate_sysroot', '/home/imx6ull/oe-core/build/../layers/openembedded-core/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb:do_populate_sysroot', 'virtual:native:/home/imx6ull/oe-core/build/../layers/openembedded-core/meta/recipes-connectivity/openssl/openssl_3.0.10.bb:do_populate_sysroot', 'virtual:native:/home/imx6ull/oe-core/build/../layers/openembedded-core/meta/recipes-devtools/bison/bison_3.8.2.bb:do_populate_sysroot', 'virtual:native:/home/imx6ull/oe-core/build/../layers/openembedded-core/meta/recipes-devtools/flex/flex_2.6.4.bb:do_populate_sysroot', 'virtual:native:/home/imx6ull/oe-core/build/../layers/openembedded-core/meta/recipes-devtools/patch/patch_2.7.6.bb:do_populate_sysroot', 'virtual:native:/home/imx6ull/oe-core/build/../layers/openembedded-core/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb:do_populate_sysroot', 'virtual:native:/home/imx6ull/oe-core/build/../layers/openembedded-core/meta/recipes-devtools/pseudo/pseudo_git.bb:do_populate_sysroot', 'virtual:native:/home/imx6ull/oe-core/build/../layers/openembedded-core/meta/recipes-devtools/python/python3-setuptools_59.5.0.bb:do_populate_sysroot', 'virtual:native:/home/imx6ull/oe-core/build/../layers/openembedded-core/meta/recipes-devtools/python/python3_3.10.13.bb:do_populate_sysroot', 'virtual:native:/home/imx6ull/oe-core/build/../layers/openembedded-core/meta/recipes-devtools/swig/swig_4.0.2.bb:do_populate_sysroot', 'virtual:native:/home/imx6ull/oe-core/build/../layers/openembedded-core/meta/recipes-extended/bc/bc_1.07.1.bb:do_populate_sysroot', 'virtual:native:/home/imx6ull/oe-core/build/../layers/openembedded-core/meta/recipes-kernel/dtc/dtc_1.6.1.bb:do_populate_sysroot']
| NOTE: Installed into sysroot: []
| NOTE: Skipping as already exists in sysroot: ['glibc', 'gcc-cross-arm', 'gcc-runtime', 'quilt-native', 'kern-tools-native', 'openssl-native', 'bison-native', 'flex-native', 'patch-native', 'pkgconfig-native', 'pseudo-native', 'python3-setuptools-native', 'python3-native', 'swig-native', 'bc-native', 'dtc-native', 'texinfo-dummy-native', 'gettext-minimal-native', 'libtool-native', 'xz-native', 'sqlite3-native', 'libffi-native', 'readline-native', 'libtirpc-native', 'gdbm-native', 'zlib-native', 'bzip2-native', 'libnsl2-native', 'ncurses-native', 'util-linux-libuuid-native', 'mpfr-native', 'libmpc-native', 'gnu-config-native', 'binutils-cross-arm', 'gmp-native', 'zstd-native', 'linux-libc-headers', 'libpcre-native', 'attr-native', 'perl-native', 'm4-native', 'libgcc', 'python3-wheel-native', 'python3-installer-native', 'make-native', 'python3-flit-core-native', 'unzip-native']
| DEBUG: Python function extend_recipe_sysroot finished
| DEBUG: Executing shell function do_install
| install: cannot stat '/home/imx6ull/oe-core/build/tmp/work/my_colibri_imx6ull-tdx-linux-gnueabi/u-boot-toradex/1_2022.07-r0/build/u-boot-nand.imx': No such file or directory
| WARNING: /home/imx6ull/oe-core/build/tmp/work/my_colibri_imx6ull-tdx-linux-gnueabi/u-boot-toradex/1_2022.07-r0/temp/run.do_install.3242537:176 exit 1 from 'install -D -m 644 /home/imx6ull/oe-core/build/tmp/work/my_colibri_imx6ull-tdx-linux-gnueabi/u-boot-toradex/1_2022.07-r0/build/u-boot-nand.imx /home/imx6ull/oe-core/build/tmp/work/my_colibri_imx6ull-tdx-linux-gnueabi/u-boot-toradex/1_2022.07-r0/image/boot/u-boot-nand-my-colibri-imx6ull-2022.07-r0.imx'
| WARNING: Backtrace (BB generated script):
| 	#1: do_install, /home/imx6ull/oe-core/build/tmp/work/my_colibri_imx6ull-tdx-linux-gnueabi/u-boot-toradex/1_2022.07-r0/temp/run.do_install.3242537, line 176
| 	#2: main, /home/imx6ull/oe-core/build/tmp/work/my_colibri_imx6ull-tdx-linux-gnueabi/u-boot-toradex/1_2022.07-r0/temp/run.do_install.3242537, line 319
ERROR: Task (/home/imx6ull/oe-core/build/../layers/meta-toradex-bsp-common/recipes-bsp/u-boot/u-boot-toradex_2022.07.bb:do_install) failed with exit code '1'
NOTE: Tasks Summary: Attempted 6521 tasks of which 0 didn't need to be rerun and 2 failed.
NOTE: Writing buildhistory
NOTE: Writing buildhistory took: 10 seconds

Whether, inside the colibri-imx6ull.conf, I modified the MACHINEOVERRIDES =. "my-colibri-imx6ull:", I still got those errors.

Do you have another suggestion? Thanks!

Hi @CharlesDias,

I tried on my side to simulate your issue, and here it is what I found:

In order to change to your own device tree file, you can change the position on your bblayers.conf.

We relocated our meta-customer to the first position on the BBLAYERS section, as it follows:

BBLAYERS ?= " \
  ${TOPDIR}/../layers/meta-customer \
  ${BBLAYERS_NXP} \
  ${BBLAYERS_TI} \
  \
  ${TOPDIR}/../layers/meta-toradex-bsp-common \
  \

Besides that, I followed @daniel_m.tx instructions in order to make it work.

This reposition will force the operating system to read your custom layer first.

Could you give this a try and return the results to us?

Best regards,
Larissa Souza

1 Like

Hello, I have a question. Don’t you need to add a patch to customize the device tree? As it says in the documentation.

Hi @facundo.n.r ,

Both options should work. The alternative of creating a new carrier board device tree is recommended if you are using a custom carrier board.

A patch would apply modifications to one of our carrier board device trees.

Best regards,
Daniel Morais