[U-Boot] CONFIG_ENV_SIZE_REDUND

Frans Meulenbroeks fransmeulenbroeks at gmail.com
Mon Jan 2 14:28:32 CET 2012


Hi all,

Let me first start off to wish all of you a prosperous 2012.

While browsing through the sources I noticed CONFIG_ENV_SIZE_REDUND and I
am wondering if it carries any use at all.
Why would the redundant env be any different in size than the original one?
Seems odd to me.

A quick grep through the sources revealed that

most of the boards define it to be CONFIG_ENV_SIZE (sometimes with and
sometimes without parenthesis around CONFIG_ENV_SIZE)

8 boards define it to be CONFIG_ENV_SECT_SIZE, but 7 of these also define
CONFIG_ENV_SIZE to be equal to CONFIG_ENV_SECT_SIZE
the weird one is quad100hd.h (whatever that may be) which says:
#define CONFIG_ENV_SIZE_REDUND  (CONFIG_ENV_SECT_SIZE)
but does not define CONFIG_ENV_SIZE. Fortunately the default seems to be
CONFIG_ENV_SECT_SIZE.

and 5 boards define CONFIG_ENV_SIZE_REDUND as a numerical value (e.g.
0x2000) but all identical to CONFIG_ENV_SIZE

This is as far as the configs go
In the sources there exist three places where things are referenced:
tools/envcrc.c says:
# if !defined(CONFIG_ENV_ADDR_REDUND) && defined(CONFIG_ENV_OFFSET_REDUND)
#  define CONFIG_ENV_ADDR_REDUND    (CONFIG_SYS_FLASH_BASE +
CONFIG_ENV_OFFSET_REDUND)
# endif

common/env_flash.c says:
#if defined(CONFIG_ENV_SIZE_REDUND) &&  \
    (CONFIG_ENV_SIZE_REDUND < CONFIG_ENV_SIZE)
#error CONFIG_ENV_SIZE_REDUND should not be less then CONFIG_ENV_SIZE
#endif

and common/env_nand.c says:
#if defined(CONFIG_ENV_SIZE_REDUND) &&  \
    (CONFIG_ENV_SIZE_REDUND != CONFIG_ENV_SIZE)
#error CONFIG_ENV_SIZE_REDUND should be the same as CONFIG_ENV_SIZE
#endif

and finally there is ./include/environment.h which says
# if defined(CONFIG_ENV_ADDR_REDUND) && !defined(CONFIG_ENV_SIZE_REDUND)
#  define CONFIG_ENV_SIZE_REDUND    CONFIG_ENV_SIZE
# endif

I could not find any place where the value is actually used!

Is it meaningful to keep this around? Shouldn't we just remove it ?

Best regards, Frans.


More information about the U-Boot mailing list