[PATCH 2/2] env: mmc: Add support for redundant env in both eMMC boot partitions
Tom Rini
trini at konsulko.com
Fri Oct 15 18:42:07 CEST 2021
On Wed, Oct 06, 2021 at 06:29:54PM +0200, Marek Vasut wrote:
> Currently the MMC environment driver supports storing redundant environment
> only in one eMMC partition at different offsets. This is sub-optimal, since
> if this one boot partition is erased, both copies of environment are lost.
> Since the eMMC has two boot partitions, add support for storing one copy of
> environment in each of the two boot partitions.
>
> To enable this functionality, select CONFIG_SYS_REDUNDAND_ENVIRONMENT to
> indicate redundant environment should be used. Set CONFIG_SYS_MMC_ENV_PART
> to 1 to indicate environment should be stored in eMMC boot partition. Set
> CONFIG_ENV_OFFSET equal to CONFIG_ENV_OFFSET_REDUND, and both to the offset
> from start of eMMC boot partition where the environment should be located.
>
> Signed-off-by: Marek Vasut <marex at denx.de>
> Cc: Fabio Estevam <festevam at gmail.com>
> Cc: Jaehoon Chung <jh80.chung at samsung.com>
> Cc: Peng Fan <peng.fan at nxp.com>
> Cc: Stefano Babic <sbabic at denx.de>
> ---
> env/mmc.c | 47 ++++++++++++++++++++++++++++++++++++++++++-----
> 1 file changed, 42 insertions(+), 5 deletions(-)
>
> diff --git a/env/mmc.c b/env/mmc.c
> index e111d8e5881..465b104559b 100644
> --- a/env/mmc.c
> +++ b/env/mmc.c
> @@ -26,6 +26,18 @@
>
> DECLARE_GLOBAL_DATA_PTR;
>
> +/*
> + * In case the environment is redundant, stored in eMMC hardware boot
> + * partition and the environment and redundant environment offsets are
> + * identical, store the environment and redundant environment in both
> + * eMMC boot partitions, one copy in each.
> + * */
> +#if (defined(CONFIG_SYS_REDUNDAND_ENVIRONMENT) && \
> + (CONFIG_SYS_MMC_ENV_PART == 1) && \
> + (CONFIG_ENV_OFFSET == CONFIG_ENV_OFFSET_REDUND))
> +#define ENV_MMC_HWPART_REDUND
> +#endif
This needs to be documented in more than just the header, it should be
in Kconfig at least. And if we could enable this directly via a Kconfig
option instead, that would be even better.
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20211015/f4948be0/attachment.sig>
More information about the U-Boot
mailing list