[Uboot-stm32] [PATCH 04/16] arm: stm32mp: detect U-Boot version used to save environment

Patrick DELAUNAY patrick.delaunay at st.com
Wed Apr 8 11:38:30 CEST 2020


Dear Wolfgang,

> From: Uboot-stm32 <uboot-stm32-bounces at st-md-mailman.stormreply.com> On
> Behalf Of Wolfgang Denk
> 
> Dear Patrick,
> 
> In message <8607d1778bcd4035807908e4a3a90381 at SFHDAG6NODE3.st.com>
> you wrote:
> >
> > To simplify the test:
> >
> > env_check = " if env info -p -d -q; then env save; fi;"
> 
> All such automatical "env save" actions somewhere in the code give me the
> creeps.  I've seen too often that they did things I nver intended to do or would
> have accepted if I had a chance to decide.
> 
> Use extremely careful, please.

Sure,

In this case, the command "env info -d" tests if the default environment is currently used,
So the user have never updated and saved the environment.

In this case and if the persistent storage is available (option -p), the script "env_check" save the environment.

PS: I take the initial idea from ./include/configs/opos6uldev.h and ./include/configs/apf27.h
 
> From a user point of view, it's me who owns the environment, and nobody should
> mess with my data without me confirming it.

As the save action is performed only when default environment is used, it is done before 
any user modification so I don't think that it is annoying for user.

I also kept the call this feature only in the ST specific bootcmd_stm32mp to allow customization for users or other boards.
(I prefer to don't add it in board_late_init() as it is done in board/intel/edison/edison.c)

The purpose of the "env save" is just to avoid a "Warning" during the boot, 
until the first user action and "env save" command:

Loading Environment from MMC... *** Warning - bad CRC, using default environment

The content of environment before and after the save is identical: it is the default one.
but if it is too aggressive I can kept it for downstream.

Marek do you have a opinion: it is acceptable for DH SOM using STM32MP15x SOC? 


> Best regards,
> 
> Wolfgang Denk
> 

Best Regards

Patrick Delaunay


More information about the U-Boot mailing list