Understanding Torizon booting process

Hi team, I’m making some deep self-learning in the Torizon architecture and BSP 3.0, and with it I arrived to the boot.src, and consequently to the FIT images and Distro Boot.

I just did a TorizonCore Yocto build and I’m trying to understand its build output as well as the booting process, although with the FIT explanation in the sheets referenced in our Distro boot knowledge base, it becomes pretty clear at least component-wise, however, I have some doubts regarding the whole process itself.

As far as I know, we migrated from the uImage (zImage + DTB) format in 2.8 to the newer ITB/Distro boot in both TEZI and Torizon. Uboot will look for the boot.src, which is mkimage’d from the ITB, which is also mkimag’ed (DTC’d) from the ITS, right?

Is the ITS file that we use with Torizon easily available to see (and change)? I’m really curious to see its structure, as I’m not completely sure the meaning of how boot.src correctly points to the DTB and kernel binary, plus the change capabilities of those. I couldn’t find it in the build output.

Related to this: How do the Uboot environment affects the booting process since the boot.src is pretty much self-contained due to the ITS meta-data? (For example if I want to change between different kernel binaries or device trees stored in the eMMC, do I have to recompile the ITS?).

Finally, I believe the ITS only contains metadata, and therefore, a kernel or device tree can still be compiled outside and simply added/changed. However I couldn’t find these binaries on the TEZI image created from Yocto (on bootfs only boot.src is found, are both contained in these? The sizes didn’t seem to match).

Sorry for the load of questions, but I couldn’t quite understand the process and I didn’t find that info in our site.

Many thanks and kind regards,
Alvaro.

Greetings @alvaro.tx,

So actually as of this moment right now the Torizon boot flow doesn’t utilize FIT images. Though FIT images is something we are considering and might migrate too, especially for secure boot/security related purposes.

Moving on, let me give a brief overview of the current boot flow for Torizon:

  1. VIa Distro boot the boot script (boot.scr) which is located in a vfat partition is loaded and executed.
  2. This boot script then sets up some boot variables but most importantly it loads a file uEnv.txt from the root file system partition. This uEnv.txt contains very specific boot variables that help the script locate and load the kernel, DTBs, and initramfs.
  3. Using the values from uEnv.txt the kernel, DTBs, and initramfs are then loaded. These binaries are actually located within the root file system itself. This is so that during an OTA update these binaries can also be updated.
  4. Then the boot script concludes with the initramfs starting and mounting the file system proper.

I hope this helps clear up some of your confusion with the Torizon boot flow.

Best Regards,
Jeremias

I’m not commenting on Torizon, but instead Tezi for some additional info that may be of use.

First, the boot.scr is in meta-toradex-tezi/recipes-core/u-boot-distro-boot/apalis-imx6/files. For distroboot, bootmedia search is defined in env area of u-boot. It looks for a boot.scr and runs that if it finds it. For Tezi, its looking for tezi.itb. To re-build the boot.scr, run “bitbake u-boot-distro-boot”.

Second, tezi.itb is a sort binary blob of filesystem, kernel and device tree. To compile to new blob, you run first build your kernel, file system and device tree with bitbake. Then you can run “mkimage -f tezi.its tezi.itb”, where tezi.itb is your new output FIT image. The tezi.its is located at
meta-toradex-tezi/recipes-bsp/tezi-run-metadata/files/apalis-imx6/tezi.its

Both are part of Tezi layer here:
https://github.com/toradex/meta-toradex-tezi

I’ve attached samples of each here

Thanks @kswain !

Hi Jeremias,

This gives quite a good idea of the torizon boot but can you please let me know if it is possible to change the dtb file in running system and reboot to with new dtb using the uEnv.txt?

I have seen this in TI boards and would be useful for early testing.

Regards
Gaurav

Hi @gauravks,

The boot process I outlined here while largely similar is a little outdated today. With regards to the dtb file that is loaded at boot. At the time of me writing this, the DTB still does get loaded from the root file system partition. The way the file gets chosen/found is via the fdtfile variable in U-Boot. Whatever this variable is, is what gets loaded at boot. By default in U-Boot we have this set to the respective evaluation board device tree.

Given this variable uEnv.txt then locates the dtb where the dtbs are expected to be found on the root file system. By default this path is something like this: /boot/ostree/torizon-{some-checksum}/dtb/

Best Regards,
Jeremias