summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2015-01-19 20:21:34 -0700
committerSimon Glass <sjg@chromium.org>2015-01-30 15:52:14 -0700
commit1f32ae95784acee8a2233043aa18bf1b3a4974d7 (patch)
tree9c3a1cdabed1efa774a7ff8326f29bdf18ea1814
parent3b4a7f99c954afad308d9c5a4513c856eb9a84b9 (diff)
downloadu-boot-imx-1f32ae95784acee8a2233043aa18bf1b3a4974d7.zip
u-boot-imx-1f32ae95784acee8a2233043aa18bf1b3a4974d7.tar.gz
u-boot-imx-1f32ae95784acee8a2233043aa18bf1b3a4974d7.tar.bz2
sandbox: Add a -D option to use a default device tree
It is painful to specify the full path to the device tree with the -d option. It is normally kept in the same directory as U-Boot, so provide an option to use this by default. Signed-off-by: Simon Glass <sjg@chromium.org>
-rw-r--r--arch/sandbox/cpu/start.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c
index 42353d8..097f29a 100644
--- a/arch/sandbox/cpu/start.c
+++ b/arch/sandbox/cpu/start.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <os.h>
#include <cli.h>
+#include <malloc.h>
#include <asm/getopt.h>
#include <asm/io.h>
#include <asm/sections.h>
@@ -102,6 +103,25 @@ static int sandbox_cmdline_cb_fdt(struct sandbox_state *state, const char *arg)
}
SANDBOX_CMDLINE_OPT_SHORT(fdt, 'd', 1, "Specify U-Boot's control FDT");
+static int sandbox_cmdline_cb_default_fdt(struct sandbox_state *state,
+ const char *arg)
+{
+ const char *fmt = "%s.dtb";
+ char *fname;
+ int len;
+
+ len = strlen(state->argv[0]) + strlen(fmt) + 1;
+ fname = os_malloc(len);
+ if (!fname)
+ return -ENOMEM;
+ snprintf(fname, len, fmt, state->argv[0]);
+ state->fdt_fname = fname;
+
+ return 0;
+}
+SANDBOX_CMDLINE_OPT_SHORT(default_fdt, 'D', 0,
+ "Use the default u-boot.dtb control FDT in U-Boot directory");
+
static int sandbox_cmdline_cb_interactive(struct sandbox_state *state,
const char *arg)
{