Chainloading a Custom U-Boot from the Toradex Preinstalled U-Boot (without replacing it)

Hello,

I am working on a Yocto-based project for the Verdin iMX8M Plus, using Mender for OTA updates.
To allow Mender to interact correctly with the bootloader (A/B partition logic, rollback variables, bootcount, etc.), I need to use a custom U-Boot built with the Mender patches.

However, I would like to avoid overwriting the factory Toradex U-Boot stored in the eMMC. My goals are:

  • keeping the board easily recoverable through Toradex Easy Installer (TEZI),
  • avoiding the risk of bricking the module if my custom bootloader is incorrect,
  • keeping Toradex’s default bootloader untouched for safety.

What I would like to achieve

I want the preinstalled Toradex U-Boot to load and run my own custom U-Boot, stored on a partition (for example a FAT partition on the SD card or eMMC), using a boot.scr script.

In short:

Toradex U-Boot (factory) → boot.scr → load my custom U-Boot binary → my U-Boot starts and boots the kernel/rootfs.

This is a classic chainloading scenario:
I do not replace the Toradex bootloader; I only ask it to jump to my second-stage U-Boot.


Binary format used

I do not have an ELF U-Boot image, only a binary file produced by Yocto:

flash.bin-verdin-imx8mp-sd

I would like to use this binary for the chainloading process.

If required, I can also consider using a different format such as a raw SPL or a u-boot.bin, depending on what is most appropriate for a second-stage boot on the Verdin iMX8MP.


Proposed method

  1. Place the custom U-Boot binary (e.g., flash.bin-verdin-imx8mp-sd) on a FAT partition accessible by the Toradex U-Boot.

  2. Create a boot.cmd script that:

    • loads the binary into RAM (fatload mmc X:Y ${loadaddr} flash.bin-verdin-imx8mp-sd),
    • jumps to it using go ${loadaddr}.
  3. Convert boot.cmd to boot.scr with mkimage.

  4. Let the Toradex U-Boot execute this script during boot.


Questions for the Toradex team

  1. Is chainloading a second U-Boot binary from the factory U-Boot supported or recommended on the Verdin iMX8MP?

  2. Is there a preferred binary format for chainloading on this platform?

    • For example: u-boot.bin, SPL-only, flash.bin, or another image type.
  3. Are there any hardware initialization constraints to be aware of (DRAM already initialized, MMU state, caches enabled, etc.) when jumping from the first U-Boot to the second?

  4. Is there a recommended storage location for the boot.scr and the custom U-Boot binary so that the Toradex U-Boot picks them up cleanly?

  5. More generally, what is Toradex’s recommended approach for using a custom Mender-enabled U-Boot while keeping the factory Toradex U-Boot intact for recovery (TEZI, Easy Installer, etc.)?


Thank you very much for your assistance.

Hi, I’m the Toradex AI Assistant.

I might make mistakes or occasionally get you wrong. Our support team will step in if needed.


U-Boot Chainloading on Verdin iMX8M Plus

I understand your goal to chainload a custom Mender-enabled U-Boot while preserving the factory Toradex U-Boot for recovery purposes. Let me address your questions based on the available documentation.

Binary Format and Build Process

For the Verdin iMX8M Plus, U-Boot uses upstream sources and builds to the imx-boot binary format (1). The specific configuration for your module is verdin-imx8mp_defconfig (1). Since these modules use upstream U-Boot, you can follow the instructions in the U-Boot documentation for building (2).

Boot Script and DistroBoot Integration

The Toradex U-Boot uses DistroBoot (Generic Distro Configuration Concept) which scans for boot configuration files including boot.scr (3). The boot process follows this sequence based on the boot_targets variable (3):

  • U-Boot scans predefined boot targets looking for standard boot configuration files or U-Boot boot scripts (boot.scr)
  • The boot_targets variable defines the order (e.g., mmc1 mmc2 dhcp for Verdin iMX8M Plus) (3)

Storage Location Recommendations

Based on the DistroBoot behavior, you should place your boot.scr script on the boot partition that U-Boot scans. The system uses variables like:

  • devtype and devnum set automatically while scanning each entry in boot_targets (3)
  • distro_bootpart for the partition number of the boot device (3)

File Loading Commands

The documentation confirms that ext4load works properly in Torizon OS 7 U-Boot on Verdin iMX8M Plus (4). You can use commands like:

ext4load mmc 2:2 ${loadaddr} /path/to/your/binary

(4)

Important Considerations

Hardware Initialization: The iMX8M Plus has complex initialization requirements. The standard boot process involves ATF (ARM Trusted Firmware) before U-Boot (5). Chainloading a complete U-Boot binary may face challenges because:

  1. The hardware is already initialized by the first-stage bootloader
  2. Memory controllers, clocks, and other subsystems are configured
  3. The second U-Boot may attempt to re-initialize already configured hardware

Alternative Approach: Instead of chainloading a complete U-Boot binary, consider customizing the existing Toradex U-Boot through:

  • Device tree modifications for Mender support
  • Environment variable customization for A/B partition logic
  • Custom boot scripts that implement the Mender boot logic

Recommended Approach

Rather than chainloading a complete U-Boot binary, I recommend:

  1. Customize the existing Toradex U-Boot by adding Mender-specific environment variables and boot logic
  2. Use boot scripts to implement A/B partition switching and rollback functionality
  3. Preserve the factory bootloader while extending its functionality through scripts and environment variables

This approach maintains compatibility with TEZI while providing the Mender functionality you need.

Best regards, Toradex AI Assistant.


Did you like my answer? :+1: :-1:

If I answered your question, please tick the “Solution” checkbox.

For follow-up questions to me, please use @ToradexAI in your post.

Hi @stan!

The answer from Toradex AI summarizes the idea here.

Theoretically, it is possible, but we do not recommend or support it. We recommend customizing U-Boot to implement Mender OTA functionality.

It is important to reiterate that we do not support Mender OTA updates officially. Our official and supported approach is Torizon Cloud, which provides OTA updates, remote access, fleet management, and more, so keep in mind that we haven’t tested what you are trying to achieve.

Besides that, I saw you opened another two threads in the past few days, so I’ll keep the support in this one and redirect the other two to this thread. Please do not open another thread if the subject is the same as this one. Instead, keep replying here.

Best regards.