summaryrefslogtreecommitdiff
path: root/common/main.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2011-07-11 17:08:48 -0700
committerSimon Glass <sjg@chromium.org>2011-08-29 10:58:52 -0700
commitfe1620b1a6c26a325bc6edf326f96c6f89b07776 (patch)
treeb411635c3486473684f0b64fb5dc012b52cd1f12 /common/main.c
parent243e5fea60e15413bbffe63a9d8051e4d7b9ec52 (diff)
fdt: Allow fdt to override the bootcmd
This changes things so that fdt can override the bootcmd in U-Boot. We need this for the flasher, and it is not an unreasonable thing to have. Developers will be able to change this by removing the bootcmd from the fdt if required. BUG=chromium-os:17187 TEST=build U-Boot, burn to board with cros_bundle_firmware Change-Id: Ic68763390ee41564a36dc58e86f4ff3196bb283e Reviewed-on: http://gerrit.chromium.org/gerrit/3907 Tested-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
Diffstat (limited to 'common/main.c')
-rw-r--r--common/main.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/common/main.c b/common/main.c
index 174377ed2b..953b134c23 100644
--- a/common/main.c
+++ b/common/main.c
@@ -277,7 +277,9 @@ void main_loop (void)
int rc = 1;
int flag;
#endif
-
+#ifdef CONFIG_OF_CONTROL
+ char *env;
+#endif
#if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0)
char *s;
int bootdelay;
@@ -378,9 +380,10 @@ void main_loop (void)
#endif /* CONFIG_BOOTCOUNT_LIMIT */
s = getenv ("bootcmd");
#ifdef CONFIG_OF_CONTROL
- /* Load bootcmd from fdt if none of above env variables exist. */
- if (!s)
- s = fdt_decode_get_config_string(gd->blob, "bootcmd");
+ /* Allow the fdt to override the boot command */
+ env = fdt_decode_get_config_string(gd->blob, "bootcmd");
+ if (env)
+ s = env;
#endif /* CONFIG_OF_CONTROL */
debug ("### main_loop: bootcmd=\"%s\"\n", s ? s : "<UNDEFINED>");