diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index 2996362cdf..705cde7db8 100644 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -633,6 +633,11 @@ char *getenv(const char *name) hsearch_r(e, FIND, &ep, &env_htab, 0); return ep ? ep->data : NULL; + } else { +#ifdef CONFIG_ENV_SIZE_MAX +/* for first time set maximum */ +#define CONFIG_ENV_SIZE CONFIG_ENV_SIZE_MAX +#endif } /* restricted capabilities before import */ diff --git a/include/environment.h b/include/environment.h index 9bcc7fd61b..225987121b 100644 --- a/include/environment.h +++ b/include/environment.h @@ -153,6 +153,10 @@ extern char *env_name_spec; #define ENV_SIZE (CONFIG_ENV_RANGE - ENV_HEADER_SIZE) #endif +#ifndef CONFIG_ENV_SIZE_MAX +#define CONFIG_ENV_SIZE_MAX CONFIG_ENV_SIZE +#endif + typedef struct environment_s { uint32_t crc; /* CRC32 over data bytes */ #ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT