How to configure "dual boot" support

I am currently building a custom image based on the tdx-reference-minimal-image on a verdin imx8mp SoM.

While looking into implementing a system update process (using meta-swupdate), I have been looking at how to use/activate the second bootloader (mmcblkboot1).

My ultimate configuration would be to have dual bootloader, bootfs and rootfs. The first “set” of these would be flashed using tezi installer image, the “alternative set” would have the relevant partitions defined in the initial tezi image, but would have their content provided by the first update applied.
I believe I have all these things in place, and I am able to use boot env vars to configure which u-boot and rootfs partitions to use, but how can I swap to using the alternative bootloader?

Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Hello!

To configure a dual boot system on your Verdin iMX8MP SoM, you can effectively use U-Boot environment variables to manage which bootloader and root filesystem are used during the boot process. Here’s a concise guide to help you set this up:

  1. Understand U-Boot Environment Variables: U-Boot uses environment variables to determine the boot sequence. The bootcmd variable is particularly important as it defines the default boot command executed after a timeout.

  2. Define Boot Partitions: Ensure that both sets of bootloaders, bootfs, and rootfs are correctly partitioned on your storage device. You should have separate partitions for each set, such as mmcblkboot0 and mmcblkboot1 for bootloaders.

  3. Modify U-Boot Environment: Access the U-Boot console during boot by interrupting the boot process. You can then modify the environment variables to point to the desired bootloader and root filesystem. For example:

    • Set the bootloader partition: setenv bootpart 1 or setenv bootpart 2 depending on which bootloader you want to use.
    • Update the bootcmd to use the selected boot partition: setenv bootcmd 'run bootpart${bootpart}'.
  4. Switch Bootloaders: To switch between bootloaders, change the bootpart variable and save the environment:

    • setenv bootpart 2 (to switch to the second bootloader)
    • saveenv (to save the changes)
  5. Automate the Process: If you want to automate the switching process, you can script the logic in U-Boot to check conditions or use external inputs (like a GPIO pin) to decide which bootloader to use.

  6. Testing: After setting up, test the boot process to ensure that the system correctly switches between the bootloaders as expected.

By configuring these environment variables, you can effectively manage a dual boot setup on your Verdin iMX8MP SoM. This approach allows you to dynamically select which bootloader and root filesystem to use, facilitating updates and redundancy.

I hope this helps you set up your dual boot system smoothly!

Best regards,
Toradex AI Assistant.

Please, also check if these links can help you solve your problem:

Verdin-imx8mp custom u-boot via uuu.

Maybe I used the wrong terminology here.

By bootloader I was refering to the imx-boot which, from what I can tell, is stored in the mmcblk2boot0 “partition”.
How can I select to use the version of this from the mmcblk2boot1 “partition”?

My understanding of the boot process is:
imx-boot → boot env → u-boot → kernel → rootfs

Regards,

Hello,

The imx8mp has 2 bootcontainers mmcblk2boot0 and mmcblk2boot1. The bootenv is completely independent from the containers. There is just a one copy by default, but the redundancy and location/storage type could be changed in u-boot.

Selection between containers (boot partitions) could be done in u-boot as well as in use-space:

# u-boot
# select between partitions
mmc partconf 2 1 <1 or 2> 0

# user-space
mmc bootpart enable <1 or 2> 1 /dev/mmcblk2

Andy

@Andy99

Thanks, that is exactly what I was looking for.
I assume 1 refers to ...boot0 and 2 to ...boot1?

My current testing would appear to not understand that “user-space” command. Is there something in need to add to the image for that to be available?

Regards,

I assume 1 refers to ...boot0 and 2 to ...boot1?

Correct

My current testing would appear to not understand that “user-space” command. Is there something in need to add to the image for that to be available?

You have to install mmc-utils.

Andy

1 Like