[PATCH 2/2] env: add CONFIG_ENV_SECT_SIZE_AUTO

Joakim Tjernlund Joakim.Tjernlund at infinera.com
Wed May 6 11:21:21 CEST 2020


On Wed, 2020-05-06 at 11:11 +0200, Rasmus Villemoes wrote:
> 
> On 06/05/2020 10.59, Joakim Tjernlund wrote:
> > On Wed, 2020-05-06 at 10:47 +0200, Rasmus Villemoes wrote:
> > > At first, I wanted to allow setting CONFIG_ENV_SECT_SIZE to 0 to mean
> > > "use the erase size the chip reports", but that config
> > > option is used in a number of preprocessor conditionals, and shared
> > > between ENV_IS_IN_FLASH and ENV_IS_IN_SPI_FLASH.
> > 
> > I see, It had been good if one could have used 0
> > 
> > > So instead, introduce a new boolean config option, which for now can
> > > only be used with ENV_IS_IN_SPI_FLASH. If left off, there's no change
> > > in behaviour.
> > 
> > Please don't stop at just SPI Flash, we could use this for common NOR flashes too.
> 
> Certainly, but I don't have any such hardware, and the code also seems
> to require a bit more work than the sf.c case due to the preprocessor
> uses. It's quite possible that the
> 
> #if CONFIG_ENV_SECT_SIZE > CONFIG_ENV_SIZE
>   foo; bar;
> #endif
> 
> can be replaced by
> 
> u32 sect_size = CONFIG_ENV_SECT_SIZE;
> if (IS_ENABLED(CONFIG_ENV_SECT_SIZE_AUTO))
>   sect_size = [...however we want to get that info....]
> 
> if (sect_size > CONFIG_ENV_SIZE {
>   foo; bar;
> }
> 
> but then there's the uses of CONFIG_ENV_SECT_SIZE to initialize end_addr
> and end_addr_new. So I think doing the flash.c part requires someone
> with hardware access.

I can test NOR Flash ,I am on an older u-boot ATM but fw_setenv stuff should be simple to backport
How would fw_env.config be dealt with? Just ignored when auto size?

   Jocke


More information about the U-Boot mailing list