From fe1620b1a6c26a325bc6edf326f96c6f89b07776 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 11 Jul 2011 17:08:48 -0700 Subject: 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 Reviewed-by: Tom Wai-Hong Tam --- common/main.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'common/main.c') diff --git a/common/main.c b/common/main.c index 174377ed2bb..953b134c231 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 : ""); -- cgit v1.2.3