On Tue, Dec 23, 2025 at 06:43:00PM +0100, Heinrich Schuchardt wrote: > On 12/23/25 15:31, Marek Vasut wrote: > > Add support for converting single-copy environment to redundant environment. > > In case CRC checks on both redundant environment copies fail, try one more > > CRC check on the primary environment copy and treat it as single > > environment. > > Why would a CRC check suddenly succeed if it has failed before? > > This needs some more explanation. > > > If that check does pass, rewrite the single-copy environment into redundant > > environment format, indicate the environment is valid, and import that as > > usual primary copy of redundant environment. Follow up 'env save' will then > > store two environment copies and the system will continue to operate as > > regular redundant environment system. > > > > Add test which validates this upgrade path. The test starts with spi.bin > > which is pre-populated as single-copy environment and then upgrades that > > environment to dual-copy environment. > > > > Signed-off-by: Marek Vasut <[email protected]> > > --- > > Cc: Heinrich Schuchardt <[email protected]> > > Cc: Jerome Forissier <[email protected]> > > Cc: Simon Glass <[email protected]> > > Cc: Tom Rini <[email protected]> > > Cc: [email protected] > > --- > > V2: - Gate the option behind ENV_REDUNDANT_UPGRADE > > - Fix up mkenvimage path in env test > > --- > > env/Kconfig | 11 ++++++ > > env/common.c | 31 +++++++++++++++- > > test/py/tests/test_env.py | 74 +++++++++++++++++++++++++++++++++++++++ > > 3 files changed, 115 insertions(+), 1 deletion(-) > > > > diff --git a/env/Kconfig b/env/Kconfig > > index 4430669964c..b312f9b5324 100644 > > --- a/env/Kconfig > > +++ b/env/Kconfig > > @@ -489,6 +489,17 @@ config ENV_REDUNDANT > > which is used by env import/export commands which are independent of > > storing variables to redundant location on a non volatile device. > > +config ENV_REDUNDANT_UPGRADE > > + bool "Enable single-copy to redundant environment upgrade support" > > + depends on ENV_REDUNDANT > > + help > > + Normally, redundant environment is expected to always operate on > > + two copies of the environment. However, hardware that may have > > + originally shipped with single-copy environment can be upgraded > > %s/with single-copy/with a single-copy/ > %s/can be/that can be/ > > > + to redundant environment without loss of existing environment > > + content by correctly configuring the location of the redundant > > + environment copy and by enabling this option. > > Why do we have to make this an option? > Shouldn't we always try to restore the environment?
Because the use case here is (I believe) converting a platform which had non-redundant environment to a functional redundant environment. Without making this optional we get size growth on platforms which enable redundant env today (see v1). -- Tom
signature.asc
Description: PGP signature

