diff options
author | Che-Liang Chiou <clchiou@chromium.org> | 2011-06-23 15:18:55 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2011-08-29 10:39:37 -0700 |
commit | 05359910e5f1695b756b3f78f3ddb4682ae71d42 (patch) | |
tree | 2e014b086135b0cfe86cbc8dd1d4ed5aefddae0a /common/main.c | |
parent | ccef09b77676858d87b62ec57a6691719d552df4 (diff) |
fdt: load boot command from device tree
Load boot command from /config/bootcmd of device tree if none of the
environment variables that set boot command exist. These variables
may include failbootcmd, altbootcmd, and bootcmd.
BUG=chromium-os:16508
TEST=manual
1. Make sure you do not define any CONFIG_BOOTCOMMAND or equivalent
2. Add "bootcmd" property to your /config node of dts:
config {
...
bootcmd = "echo '**** load boot command from fdt! ****'";
};
3. Run u-boot and see that message prints out
Change-Id: I0ca6a777e23c1a8f024fada24ed507dc2e6fd898
Reviewed-on: http://gerrit.chromium.org/gerrit/3150
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Diffstat (limited to 'common/main.c')
-rw-r--r-- | common/main.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/common/main.c b/common/main.c index 2730c6f22f..174377ed2b 100644 --- a/common/main.c +++ b/common/main.c @@ -38,6 +38,10 @@ #include <hush.h> #endif +#ifdef CONFIG_OF_CONTROL +#include <fdt_decode.h> +#endif /* CONFIG_OF_CONTROL */ + #include <post.h> #if defined(CONFIG_SILENT_CONSOLE) || defined(CONFIG_POST) || defined(CONFIG_CMDLINE_EDITING) @@ -373,6 +377,11 @@ void main_loop (void) else #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"); +#endif /* CONFIG_OF_CONTROL */ debug ("### main_loop: bootcmd=\"%s\"\n", s ? s : "<UNDEFINED>"); |