summaryrefslogtreecommitdiffstats
path: root/commands/bootm.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-09-22 11:52:34 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2013-09-24 09:03:18 +0200
commit68e6eceae99c694dff8bb3c26924b8643012189a (patch)
tree480a58fc89b002a57394773e3c617c6ab40a8351 /commands/bootm.c
parentb15c5eeecfbe4e4d1167b67a897d6c61dbae4251 (diff)
downloadbarebox-68e6eceae99c694dff8bb3c26924b8643012189a.tar.gz
barebox-68e6eceae99c694dff8bb3c26924b8643012189a.tar.xz
bootm: Add dryrun support
This adds support for checking the bootm command without actually booting. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands/bootm.c')
-rw-r--r--commands/bootm.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/commands/bootm.c b/commands/bootm.c
index 927c2fbc5e..44facd4c55 100644
--- a/commands/bootm.c
+++ b/commands/bootm.c
@@ -46,7 +46,7 @@
#include <magicvar.h>
#include <asm-generic/memory_layout.h>
-#define BOOTM_OPTS_COMMON "ca:e:vo:f"
+#define BOOTM_OPTS_COMMON "ca:e:vo:fd"
#ifdef CONFIG_CMD_BOOTM_INITRD
#define BOOTM_OPTS BOOTM_OPTS_COMMON "L:r:"
@@ -101,6 +101,9 @@ static int do_bootm(int argc, char *argv[])
case 'f':
data.force = 1;
break;
+ case 'd':
+ data.dryrun = 1;
+ break;
default:
break;
}
@@ -125,17 +128,23 @@ static int do_bootm(int argc, char *argv[])
data.initrd_file = initrd_file;
ret = bootm_boot(&data);
+ if (ret) {
+ printf("handler failed with: %s\n", strerror(-ret));
+ goto err_out;
+ }
- printf("handler failed with %s\n", strerror(-ret));
+ if (data.dryrun)
+ printf("Dryrun. Aborted\n");
err_out:
- return 1;
+ return ret ? 1 : 0;
}
BAREBOX_CMD_HELP_START(bootm)
BAREBOX_CMD_HELP_USAGE("bootm [OPTIONS] image\n")
BAREBOX_CMD_HELP_SHORT("Boot an application image.\n")
BAREBOX_CMD_HELP_OPT ("-c", "crc check uImage data\n")
+BAREBOX_CMD_HELP_OPT ("-d", "dryrun. Check data, but do not run\n")
#ifdef CONFIG_CMD_BOOTM_INITRD
BAREBOX_CMD_HELP_OPT ("-r <initrd>","specify an initrd image\n")
BAREBOX_CMD_HELP_OPT ("-L <load addr>","specify initrd load address\n")