Modifying uEnv.txt at build time


I am trying to modify uEnv.txt during build time for our custom carrier board.
The Aim is to : change the dtb filename to boot primarily and adding distroboot cmd in boot argument
to enable default usb booting.

I have tested both by manually editing the uEnv.txt but now we want to integrate this in the build process. I am not sure which bb file I should modify by a custom bbappend .

Also can we achieve the following :

  1. We have two dtb files dtb-1 and dtb-2 .
  2. The uboot will try to look for dtb-1 and if it fails to find it then it will try to find dtb-2.
  3. Then uboots loads the dtb and continues the boot process.

Hi @xdaco

Could you provide the version of the software of your module?

Thanks and best regards,

Dear @xdaco .

Greetings and Thank you for contacting the Toradex Community!

We currently extract the uEnv.txt from the u-Boot Binary:

When you need to append the custoim config, it would be better to fork u-boot and modify the environment:
Alternatively, you could also add a u-boot-toradex_%.bbappend to the yocto layer. Then you would need to add FILESEXTRAPATHS_prepend := “${THISDIR}/${PN}:” and put the uEnv.txt into the directory u-boot-toradex. After that, you do do the following to bbappend file as well:

do_install_append() {
  cp ${S}/uEnv.txt ${D}/boot/uEnv.txt

As for the second part, its possible to perform using something like the following:

load mmc 0:1 ${fdt_addr_r} dtb-1 || load mmc 0:1 ${fdt_addr_r} dtb-2

I hope this answer helps.

Thank you and best regards,

We are using bsp version 2.8b


Thanks a lot . I think it is easy to add the modified uEnv.txt in our custom yocto layer.

Dear @xdaco ,

Thank you for your feedback and reach us at the community if you have more questions!

Best Regards,