[PATCH 3/3] env: Add single to redundant environment upgrade path

Marek Vasut marek.vasut at mailbox.org
Fri Dec 19 00:09:28 CET 2025


On 12/18/25 2:58 PM, Tom Rini wrote:
> On Wed, Dec 17, 2025 at 11:58:15PM +0100, Marek Vasut wrote:
>> On 12/17/25 9:56 PM, Tom Rini wrote:
>>> On Wed, Dec 17, 2025 at 09:12:33PM +0100, 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.
>>>> 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 <marek.vasut+renesas at mailbox.org>
>>>> ---
>>>> Cc: Heinrich Schuchardt <xypron.glpk at gmx.de>
>>>> Cc: Jerome Forissier <jerome.forissier at linaro.org>
>>>> Cc: Simon Glass <sjg at chromium.org>
>>>> Cc: Tom Rini <trini at konsulko.com>
>>>> Cc: u-boot at lists.denx.de
>>>
>>> For merging, a cover letter makes things so much easier, please add one
>>> for v2. And, I think this needs a Kconfig option. I'm sure you added
>>> this because someone has a valid use case but it's going to grow too
>>> many platforms where that feature isn't likely desired. Thanks.
>> Do you actually observe growth ? Because this is calling existing functions,
>> so the growth has to be in units of bytes tops.
> 
> A good question, I was assuming so but checking xilinx_versal_virt (a
> platform with redundant env) shows yes, it does:
> 01: Merge patch series "fit: print conf node compatibles + use property string constants"
> 05: env: Add single to redundant environment upgrade path
>     aarch64: (for 1/1 boards) all +96.0 text +96.0
>              xilinx_versal_virt: all +96 text +96
>                 u-boot: add: 0/0, grow: 1/0 bytes: 84/0 (84)
>                   function                                   old     new   delta
>                   env_check_redund                           316     400     +84
Correct, and the growth is minimal and gated by ENV_REDUND already.

I think it would still be good not to confuse users with too many 
additional Kconfig symbols, but if you insist, I will add one ?


More information about the U-Boot mailing list