Good evening,
My development team is currently working on bringing up a board based on the i.MX8M Mini. We already have a similar board based on the i.MX8M Nano, so we're reusing most of the code where possible.
On the i.MX8M Nano board, we had a system in U-Boot/SPL to calculate the appropriate offset to read/write the imx-boot image from, based on the boot partition used: BOOT1, BOOT2 or User Data. This is because we verified via trial and error that the ROM loader can load the SPL from either of these partitions, so we need to make sure that:
- The SPL also loads the U-Boot image from the same partition/offset
- When writing a new imx-boot image to the eMMC, make sure it's in the same partition/offset as the current image
See the following log of the commit that adds this logic into our code:
ccimx8m: spl: consider the eMMC boot partition on U-Boot jump
The ROM loader of the i.MX8MNano expects the boot image at the
following offset:
- If booting from microSD or eMMC User Data area
offset of 0x40 sectors (to skip a GPT)
- If booting from eMMC BOOT1 or BOOT2 partitions
offset of 0 (since we don't expect a GPT anywhere)
The function spl_mmc_get_uboot_raw_sector() was assuming an offset
of 0 if the boot device was the eMMC, no matter the selected
boot partition.
However, this code doesn't work as intended on the i.MX8M Mini version of the board, because we think the ROM loader is always trying to load the SPL from the User Data partition. When reading/writing the imx-boot image from SPL/U-Boot, the eMMC seems to be configured to boot from the BOOT partitions, but then the ROM loader is always loading whatever's in the User Data partition.
For reference, this is our implementation (including how we parse the boot partition from the eMMC config):
#define UBOOT_RAW_SECTOR_OFFSET 0x40
unsigned long spl_mmc_get_uboot_raw_sector(struct mmc *mmc)
{
u32 boot_dev = spl_boot_device();
int part;
switch (boot_dev) {
case BOOT_DEVICE_MMC1:
/* microSD card */
return CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR;
case BOOT_DEVICE_MMC2:
/* eMMC */
part = (mmc->part_config >> 3) & PART_ACCESS_MASK;
/*
* On the BOOT partitions, the bootloader is stored
* at offset 0.
*/
if (part == 1 || part == 2)
return CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR -
UBOOT_RAW_SECTOR_OFFSET;
/*
* On the User Data area the boot loader is expected
* at UBOOT_RAW_SECTOR_OFFSET offset.
*/
return CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR;
}
return CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR;
}
My question is: is this expected behavior? Is it true that the 8M Nano ROM loader can boot from either BOOT or User Data partitions, while the 8M Mini ROM loader always boots from User Data? If not, is there any explanation behind this behavior?
Many thanks in advance,
Gabriel