diff options
author | Che-Liang Chiou <clchiou@chromium.org> | 2012-10-25 20:31:07 +0400 |
---|---|---|
committer | Gerald Van Baren <gvb@unssw.com> | 2012-11-13 08:14:57 +0400 |
commit | 224b72e639e87040a1845cf9795b45417e064bba (patch) | |
tree | 409c0d71c5fa609f68a8d642d9dbc3930ea3cea3 /common/main.c | |
parent | 202ff7537558edfd759b400cfe9e56c56fc7868c (diff) | |
download | u-boot-224b72e639e87040a1845cf9795b45417e064bba.tar.xz |
fdt: Load boot command from device tree
Load boot command from /config/bootcmd of device tree if present.
Signed-off-by: Tom Wai-Hong Tam <waihong@chromium.org>
Signed-off-by: Che-Liang Chiou <clchiou@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/main.c')
-rw-r--r-- | common/main.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/common/main.c b/common/main.c index 592ce077d2..48bed95386 100644 --- a/common/main.c +++ b/common/main.c @@ -30,6 +30,7 @@ #include <common.h> #include <watchdog.h> #include <command.h> +#include <fdtdec.h> #include <malloc.h> #include <version.h> #ifdef CONFIG_MODEM_SUPPORT @@ -40,6 +41,10 @@ #include <hush.h> #endif +#ifdef CONFIG_OF_CONTROL +#include <fdtdec.h> +#endif + #include <post.h> #include <linux/ctype.h> #include <menu.h> @@ -284,7 +289,10 @@ void main_loop (void) int rc = 1; int flag; #endif - +#if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0) && \ + defined(CONFIG_OF_CONTROL) + char *env; +#endif #if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0) char *s; int bootdelay; @@ -380,6 +388,12 @@ void main_loop (void) else #endif /* CONFIG_BOOTCOUNT_LIMIT */ s = getenv ("bootcmd"); +#ifdef CONFIG_OF_CONTROL + /* Allow the fdt to override the boot command */ + env = fdtdec_get_config_string(gd->fdt_blob, "bootcmd"); + if (env) + s = env; +#endif /* CONFIG_OF_CONTROL */ debug ("### main_loop: bootcmd=\"%s\"\n", s ? s : "<UNDEFINED>"); |