We want to modify the u-boot-initial-env-sd file or possibly the boot.scr file that is built and included into the TEZI image as part of the yocto build. Our initial requirement is to provide a “maintenance mode” boot function that can be controlled by writing a u-boot environment variable from linux command-line then rebooting. Eventually we’ll want to include firmware for the M-4 cores in the boot sequence as well.
We have our own custom meta-layer that already does a number of other customizations for our image, including adding packages and enabling extra kernel modules.
Is there an obvious or supported way to write a .bb or .bbappend file to also edit/replace the u-boot-initial-env-sd or boot.scr file?
For quick tests and debugging you can simply just edit these files in the Yocto layers directly. However it is of course best practice to have such changes in your own meta-layer via a bbappend. So for example to use your own boot.scr you would need to do the following:
Taking a quick look at the recipe file you can see it takes a source file called “boot.cmd.in” this eventually gets compiled into “boot.scr”. So for your layer you’ll need to do something similar to what was done in the Torizon bbappend file. In this layer a new “boot.cmd.in” was supplied. This will override the “boot.cmd.in” given in meta-toradex-bsp-common since the meta-toradex-torizon has a higher layer priority.
So for your own meta-layer you’ll basically need to do the same thing. The only think to keep in mind is to make sure your meta-layer is of an even higher priority so that it overwrites the “boot.cmd.in” give in meta-toradex-torizon.
I’ve managed to get this working with a patch rather than replace the entire script, which is for our purposes more robust. Getting all the paths right was a pain, but this is what’s working for me now (for future reference):
In my recipe file recipes-bsp/u-boot/u-boot-distro-boot.bbappend: