
Hello,
Am Tue, Jan 25, 2022 at 03:43:29PM +0100 schrieb Wolfgang Denk:
Dear Ying-Chun Liu,
In message 20220125135535.224061-1-grandpaul@gmail.com you wrote:
I've implemented A/B firmware update based on eMMC hw partitions. Normally we have 2 boot partitions on eMMC. One is active and another is inactive. We can then flash the firmware to the inactive one and make it active.
We have been doing software updates using U-Boot scripts etc. for many, many years. But during that time a large number of restrictions and shortcomings became clear. this is why projects like SWUpdate [1] came into life, and U-Boot supports this only with very basic features:
- watchdog support to reset a hanging system
- boot counter to switch to an alternate boot command in case of too many failed boot attempts
That's all. Not more is needed, and not more should be used in U-Boot.
I'm not sure if you know SWUpdate - if not, you should definitely look into it. I strongly recommend not to try to reinvent that wheel - poorly - in U-Boot. We have been there before, and got rid of this approach for a pretty long list of good reasons.
FWIW, if you don't want to reinvent the wheel and evaluate alternatives, you might also want to checkout RAUC [1]. It has builtin support for that eMMC boot partition scenario. The u-boot integration is not as sophisticated as for other bootloaders, but I got that running with u-boot last year on raw NAND flash and it's a lot better than hacking together your own A/B update scheme scripts.
HTH & Greets Alex