From 1279dad923719578ac37f7e1ecfb009d9108a9d9 Mon Sep 17 00:00:00 2001 From: Antony Arun T Date: Mon, 19 Feb 2018 16:11:21 +0530 Subject: [PATCH] ipq806x: Customized environment size handling To save space in NOR flash, environment loading from flash is handled differently for NOR and NAND. The size for NOR flash environment is taken from partition size itself. Change-Id: I588471b679fad0e96b836d43dc1a0136c5400fc1 Signed-off-by: Antony Arun T --- common/cmd_nvedit.c | 5 +++++ include/environment.h | 4 ++++ 2 files changed, 9 insertions(+) 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