I have set
MENDER_BOOT_PART_SIZE_MB = “0”
in the machine configuration file as we put the bootloader in the mmcblk0boot0 partition of the eMMC. After flashing the resulting sdimg but was surprised to see that there is a 16MiB Gap at the start of the eMMC.
In the hexdump below you can see the U-Boot environment start at 0x1000000 and a big gap between the MBR and the environment in between.
Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type
/dev/mmcblk1p1 384,0,1 1023,3,32 49152 1064959 1015808 496M 83 Linux
/dev/mmcblk1p2 1023,3,32 1023,3,32 1064960 2080767 1015808 496M 83 Linux
/dev/mmcblk1p3 1023,3,32 1023,3,32 2080768 7716863 5636096 2752M 83 Linux
It’s not a major problem as the size of the eMMC is way more that we need but I thought I would ask if this is expected as I see the Boot Partition default size is 16MiB. Or maybe I have missed some other configuration variable?
Anyway we have it working and performing image and package updates and are really impressed with everything so far.
You can optimize this, but the reasoning for this to try to put the redundant U-Boot environment on different blocks. It is actually hard to know where the eMMC firmware will actually store it, but an effort is made it at least
Thanks for the info and it makes sense to put the environments on different blocks so I think I’ll leave this as it is.
We only have one environment currently. Would this still give the 16MiB alignment. I’m just curious now as to how the partition layout is calculated
This raises another question I had, if I enable the redundant environment in the U-Boot configuration which I really should do, will mender update both of them? I suppose it will as the u-boot-fw-utils handle this? Just wanted to check.
You actually should have two, as meta-mender will define this for you magically
I suppose it will as the u-boot-fw-utils handle this? Just wanted to check.
Yes, the u-boot-fw-utils handle this as long it is configured as such in /etc/fw_env.config (it should have two entries representing the two locations). The Mender client will call fw_printenv/fw_getenv directly
If you look at the hexdump in a previous message I only have one at 0x010000000 and looking at the header bytes
01000000 a0 55 12 1f 01 61
I think the fifth byte is whether the environment is the redundant one so for some strange reason it looks like I have only the redundant environment. Very odd. I don’t seem to get any messages in the console about CRC failing for the primary environment.
I think this relates to the fact that you have not yet written to the “redundant”. And “redundant” is a actually a bad name as it is a A/B update strategy applied to the U-Boot environment so it just keeps switching as you write
I never realised that, I thought it was just a “redundant” copy that was kept in case the block containing the original one gets corrupted. After running fw_setenv I get the second environment and the fifth byte is 0x02 for redundant (or copy B) so 0x01 must be for the Copy A.