[U-Boot] [RFC PATCH] env: add default env size for CONFIG_ENV_IS_NOWHERE

when CONFIG_ENV_IS_NOWHERE is enabled, it is still need to define CONFIG_ENV_SIZE. So, add a default size (1024 Bytes) to avoid compile error if not define CONFIG_ENV_SIZE
Signed-off-by: Bo Shen voice.shen@gmail.com
--- The default value for CONFIG_ENV_SIZE (1024 Bytes) maybe not the better choice, consider runtime decided, however failed.
This patch is only compile testing with CONFIG_ENV_IS_NOWHERE enable ---
include/environment.h | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/include/environment.h b/include/environment.h index 46a3554..52a7769 100644 --- a/include/environment.h +++ b/include/environment.h @@ -146,6 +146,12 @@ extern unsigned long nand_env_oob_offset; extern char *env_name_spec; #endif
+#ifdef CONFIG_ENV_IS_NOWHERE +# ifndef CONFIG_ENV_SIZE +# define CONFIG_ENV_SIZE 0x400 +# endif +#endif + #define ENV_SIZE (CONFIG_ENV_SIZE - ENV_HEADER_SIZE)
typedef struct environment_s {

Dear Bo Shen,
In message 1376230503-25331-1-git-send-email-voice.shen@gmail.com you wrote:
when CONFIG_ENV_IS_NOWHERE is enabled, it is still need to define CONFIG_ENV_SIZE. So, add a default size (1024 Bytes) to avoid compile error if not define CONFIG_ENV_SIZE
I don;t understand the rationale for this patch. In which way is the environment seize for the CONFIG_ENV_IS_NOWHERE case different from any other cases? For these, we do not define a default either, so why should we handle this case differently?
In any cse, the needed environment seize if a pretty board specific thing, and I think it makes sense to let the user define it.
Best regards,
Wolfgang Denk

Hi Wolfgang Denk,
On 8/11/2013 10:50 PM, Wolfgang Denk wrote:
Dear Bo Shen,
In message 1376230503-25331-1-git-send-email-voice.shen@gmail.com you wrote:
when CONFIG_ENV_IS_NOWHERE is enabled, it is still need to define CONFIG_ENV_SIZE. So, add a default size (1024 Bytes) to avoid compile error if not define CONFIG_ENV_SIZE
I don;t understand the rationale for this patch. In which way is the environment seize for the CONFIG_ENV_IS_NOWHERE case different from any other cases? For these, we do not define a default either, so why should we handle this case differently?
In my opinion, there is a little different. The CONFIG_ENV_IS_NOWHERE case only store environment in volatile memory (e.g. DDR SDRAM) while not store in non-volatile device.
At first glance of CONFIG_ENV_IS_NOWHERE, I think no need to define the CONFIG_ENV_SIZE, actually, it needs to define the CONFIG_ENV_SIZE. So, I think add a default value will be better (Maybe another choice to add a description in README file to specify how to use CONFIG_ENV_IS_NOWHERE).
In any cse, the needed environment seize if a pretty board specific thing, and I think it makes sense to let the user define it.
Yes, the environment size is a pretty board specific thing. So, in this patch, there is an option for user to define it.
Best regards,
Wolfgang Denk
Best Regards, Bo Shen

Dear Bo Shen,
In message 5208DE04.1000405@gmail.com you wrote:
At first glance of CONFIG_ENV_IS_NOWHERE, I think no need to define the CONFIG_ENV_SIZE, actually, it needs to define the CONFIG_ENV_SIZE. So, I think add a default value will be better (Maybe another choice to add a description in README file to specify how to use CONFIG_ENV_IS_NOWHERE).
I cannot see in which way the required environment size in this case is different from all other cases. To me, a default size makes little sense - it is just a chance to miss setting a suitable value, so it bites you later (at run time) instead of earlyin development.
In any cse, the needed environment seize if a pretty board specific thing, and I think it makes sense to let the user define it.
Yes, the environment size is a pretty board specific thing. So, in this patch, there is an option for user to define it.
I think the user should always set this to a useful (for him) value. For example, you think 1 KiB is a useful size, I would think it is too small. Ask two other people, and you will hear three other different numbers.
Best regards,
Wolfgang Denk

On Sun, Aug 11, 2013 at 02:15:03PM +0000, Bo Shen wrote:
when CONFIG_ENV_IS_NOWHERE is enabled, it is still need to define CONFIG_ENV_SIZE. So, add a default size (1024 Bytes) to avoid compile error if not define CONFIG_ENV_SIZE
The problem is that ENV_SIZE is also a limiting factor on how big the run-time copy of the environment may be, not just how much space we use when writing to a backing store, so NAK.
participants (3)
-
Bo Shen
-
Tom Rini
-
Wolfgang Denk