From 2547049a5ab685e3f67dc81e58365cc55205fe1a Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 30 Jun 2011 18:56:53 -0700 Subject: Add CONFIG_DELAY_ENVIRONMENT to delay environment loading This option delays loading of the environment until later, so that only the default environment will be available to U-Boot. BUG=chromium-os:17055 TEST=build U-Boot with option enabled, see that environment is not available Change-Id: I99a25b468fb5d14310b00eb3fd4c3e6a0c5cbe2b Reviewed-on: http://gerrit.chromium.org/gerrit/3534 Reviewed-by: Simon Glass Tested-by: Simon Glass --- README | 6 ++++++ arch/arm/lib/board.c | 4 ++++ common/env_common.c | 5 +++++ include/common.h | 3 +++ 4 files changed, 18 insertions(+) diff --git a/README b/README index 8f91d8cc620..501a52d5586 100644 --- a/README +++ b/README @@ -2537,6 +2537,12 @@ Configuration Settings: cases. This setting can be used to tune behaviour; see lib/hashtable.c for details. +- CONFIG_DELAY_ENVIRONMENT + Normally the environment is loaded when the board is + intialized so that it is available to U-Boot. This inhibits + that so that the environment is not available until + explicitly loaded later by U-Boot code. + The following definitions that deal with the placement and management of environment data (variable area); in general, we support the following configurations: diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index c3dcbba1ee9..a043648b261 100644 --- a/arch/arm/lib/board.c +++ b/arch/arm/lib/board.c @@ -569,8 +569,12 @@ void board_init_r (gd_t *id, ulong dest_addr) dataflash_print_info(); #endif +#ifdef CONFIG_DELAY_ENVIRONMENT + env_set_default(); +#else /* initialize environment */ env_relocate (); +#endif #if defined(CONFIG_CMD_PCI) || defined(CONFIG_PCI) arm_pci_init(); diff --git a/common/env_common.c b/common/env_common.c index c3e6388ac0b..745cd51b38e 100644 --- a/common/env_common.c +++ b/common/env_common.c @@ -246,6 +246,11 @@ void env_relocate (void) } } +void env_set_default(void) +{ + set_default_env(NULL); +} + #ifdef CONFIG_AUTO_COMPLETE int env_complete(char *var, int maxv, char *cmdv[], int bufsz, char *buf) { diff --git a/include/common.h b/include/common.h index c037b361915..4fb8315d129 100644 --- a/include/common.h +++ b/include/common.h @@ -287,6 +287,9 @@ int saveenv (void); int inline setenv (char *, char *); #else int setenv (char *, char *); + +/* Set environment to the default value */ +void env_set_default(void); #endif /* CONFIG_PPC */ #ifdef CONFIG_ARM # include -- cgit v1.2.3