summaryrefslogtreecommitdiff
path: root/arch/arm
diff options
context:
space:
mode:
authorDoug Anderson <dianders@chromium.org>2011-07-13 14:33:32 -0700
committerSimon Glass <sjg@chromium.org>2011-08-29 10:58:55 -0700
commite336c3847646d91dfec8baa22f84f429b68c7241 (patch)
treea27f844f97dce7b90f9310aa0254926aa4538d66 /arch/arm
parent45fa8192bffa521a03abffc4b91c850586bbf25a (diff)
CHROMIUM: ARM: Allow the FDT to specify that the env loads early.
This is intended for using with the 'legacy' image to allow us to update the enviroment shipped with the image. BUG=chromium-os:17196 TEST=With ebuild changes, saw that legacy firmware loaded env and non-legacy got default. Change-Id: Iee19df02123ab2502e4803c25c94318b0e834f6d Reviewed-on: http://gerrit.chromium.org/gerrit/4056 Tested-by: Doug Anderson <dianders@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/lib/board.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index 8b314dd6715..e4c0d62f33c 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -475,6 +475,24 @@ void board_init_f (ulong bootflag)
static char *failed = "*** failed ***\n";
#endif
+/*
+ * Tell if it's OK to load the environment early in boot.
+ *
+ * If CONFIG_OF_LOAD_ENVIRONMENT is defined, we'll check with the FDT to see
+ * if this is OK (defaulting to saying it's not OK).
+ *
+ * NOTE: Loading the environment early can be a bad idea if security is
+ * important, since no verification is done on the environment.
+ */
+static int should_load_env(void)
+{
+#ifdef CONFIG_OF_LOAD_ENVIRONMENT
+ return fdt_decode_get_config_int(gd->blob, "load_env", 0);
+#else
+ return 1;
+#endif
+}
+
/************************************************************************
*
* This is the next part if the initialization sequence: we are now
@@ -570,12 +588,11 @@ 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 (should_load_env())
+ env_relocate();
+ else
+ env_set_default();
#if defined(CONFIG_CMD_PCI) || defined(CONFIG_PCI)
arm_pci_init();