Confusion about i.MX8MM Redundant Boot

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Confusion about i.MX8MM Redundant Boot

160 Views
Sampo
Contributor III

I am attempting to use Redundant Boot to implement robust bootloader update. And I have partly succeeded, but I have witnessed some confusing behavior.

We are using i.MX8MM with eMMC. The eMMC has two boot partitions. We are using U-Boot compiled with Yocto from the uboot-imx Github repository.

I am successfully able to create the Secondary Image Table on partition boot0. If the bootloader at address 0x42 does not work, the secondary bootloader at address 0x1000 + 0x42 is loaded just as intended.

But now for the confusion: If boot1 does not contain a valid bootloader, the device will not boot. U-Boot gives the following error:

mmc_load_image_raw_sector: mmc block read error
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###

If boot0 at address 0x42 contains a valid bootloader, the device boots, regardless of what boot1 contains.

I did a bit of debugging, and SPL is attempting to read from boot1 when PERSIST_SECONDARY_BOOT is 1 but the bootloader is on boot0. This the code that causes this is in uboot-imx/arch/arm/mach-imx/imx8m/soc.c:

/*
* Swap the eMMC boot partitions in case there was a
* fallback event (i.e. primary image was corrupted
* and that corruption was recognized by the BootROM),
* so the SPL loads the rest of the U-Boot from the
* correct eMMC boot partition, since the BootROM
* leaves the boot partition set to the corrupted one.
*/
if (part == 1)
part = 2;
else if (part == 2)
part = 1;
continue;

I initially thought this was a bug in U-Boot, and I commented out the code. But this caused secondary boot to fail altogether, where before it worked. As far as I understood it, secondary boot happens inside one eMMC boot partition, and the contents of the other partition should not effect the boot. But clearly it does.

Am I understanding something wrong, or is there a bug in U-Boot?

Labels (1)
0 Kudos
Reply
4 Replies

131 Views
Rita_Wang
NXP TechSupport
NXP TechSupport

Which version BSP are you using? How do you download images to the emmc?Using the uuu tool?

0 Kudos
Reply

130 Views
Sampo
Contributor III

I am using target imx8mm_evk with Yocto kirkstone release (version 4.0.4).

I update the bootloader with dd as instructed here: https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/i-MX-8MQ-ROM-Redundant-Boot-for-expansio...

Following those instructions, I can successfully get the device to start from boot0 secondary bootloader.  I have verified from both the eMMC registers and PERSIST_SECONDARY_BOOT that this is the case. But if I for example use dd to write boot1 full of zeroes, the device does not boot anymore. And I don't understand why, boot1 should not affect starting of the device in any way.

0 Kudos
Reply

104 Views
Rita_Wang
NXP TechSupport
NXP TechSupport

For the Redundant Boot procedure :

  1. Program primary image to boot0 and secondary image to boot1.
  2. In u-boot, set boot partition with partconf command.

  Then in boot, when one image boot failed, e.g., image in boot0, ROM will try to boot from boot1.

0 Kudos
Reply

99 Views
hustdage
Contributor II

 

 

The following link shows, the redunant boot is in the same partition  using tag to know the offset.

It could not swtich dfferent boot partiton.

https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/i-MX-8MQ-ROM-Redundant-Boot-for-expansio...

 

Also, I found this link is the same as above using tag.

https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/i-MX8MM-SDCARD-Secondary-Boot-Demo/ta-p/...

 

What you said I believe is i.MX8XP, which can switch between boot1 and boot2.

https://community.nxp.com/t5/i-MX-Community-Articles/i-MX8QXP-eMMC-Secondary-Boot/ba-p/1257704#M45