summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-09-01 09:43:54 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2015-09-01 09:43:54 +0200
commit69dccb494a0ee5fececc67f2b7afa7b79368a991 (patch)
tree46be84e18d56a7d6a0b3d722cfb402cb93b2f3b3 /commands
parent049fb66d212caf2324e6ef2920c44b59858fc04d (diff)
parentdfd536eb3213a0c29121e0d343963e6fd9ea3111 (diff)
downloadbarebox-69dccb494a0ee5fececc67f2b7afa7b79368a991.tar.gz
barebox-69dccb494a0ee5fececc67f2b7afa7b79368a991.tar.xz
Merge branch 'for-next/misc'
Diffstat (limited to 'commands')
-rw-r--r--commands/boot.c26
-rw-r--r--commands/ubiformat.c1
2 files changed, 26 insertions, 1 deletions
diff --git a/commands/boot.c b/commands/boot.c
index 3341a05ebd..fd58824d98 100644
--- a/commands/boot.c
+++ b/commands/boot.c
@@ -14,6 +14,7 @@
#include <environment.h>
#include <globalvar.h>
#include <magicvar.h>
+#include <watchdog.h>
#include <command.h>
#include <readkey.h>
#include <common.h>
@@ -24,6 +25,7 @@
#include <clock.h>
#include <boot.h>
#include <glob.h>
+#include <init.h>
#include <menu.h>
#include <fs.h>
#include <complete.h>
@@ -71,10 +73,28 @@ out:
return ret;
}
+static unsigned int boot_watchdog_timeout;
+
+static int init_boot_watchdog_timeout(void)
+{
+ return globalvar_add_simple_int("boot.watchdog_timeout",
+ &boot_watchdog_timeout, "%u");
+}
+late_initcall(init_boot_watchdog_timeout);
+
+BAREBOX_MAGICVAR_NAMED(global_watchdog_timeout, global.boot.watchdog_timeout,
+ "Watchdog enable timeout in seconds before booting");
+
static int boot_entry(struct blspec_entry *be)
{
int ret;
+ if (IS_ENABLED(CONFIG_WATCHDOG) && boot_watchdog_timeout) {
+ ret = watchdog_set_timeout(boot_watchdog_timeout);
+ if (ret)
+ pr_warn("Failed to enable watchdog: %s\n", strerror(-ret));
+ }
+
if (be->scriptpath) {
ret = boot_script(be->scriptpath);
} else {
@@ -375,7 +395,7 @@ static int do_boot(int argc, char *argv[])
dryrun = 0;
timeout = -1;
- while ((opt = getopt(argc, argv, "vldmt:")) > 0) {
+ while ((opt = getopt(argc, argv, "vldmt:w:")) > 0) {
switch (opt) {
case 'v':
verbose++;
@@ -392,6 +412,9 @@ static int do_boot(int argc, char *argv[])
case 't':
timeout = simple_strtoul(optarg, NULL, 0);
break;
+ case 'w':
+ boot_watchdog_timeout = simple_strtoul(optarg, NULL, 0);
+ break;
}
}
@@ -477,6 +500,7 @@ BAREBOX_CMD_HELP_OPT ("-v","Increase verbosity")
BAREBOX_CMD_HELP_OPT ("-d","Dryrun. See what happens but do no actually boot")
BAREBOX_CMD_HELP_OPT ("-l","List available boot sources")
BAREBOX_CMD_HELP_OPT ("-m","Show a menu with boot options")
+BAREBOX_CMD_HELP_OPT ("-w SECS","Start watchdog with timeout SECS before booting")
BAREBOX_CMD_HELP_OPT ("-t SECS","specify timeout in SECS")
BAREBOX_CMD_HELP_END
diff --git a/commands/ubiformat.c b/commands/ubiformat.c
index e63f16e351..f9d952cff0 100644
--- a/commands/ubiformat.c
+++ b/commands/ubiformat.c
@@ -779,6 +779,7 @@ BAREBOX_CMD_HELP_OPT("-f FILE\t", "flash image file")
BAREBOX_CMD_HELP_OPT("-e VALUE", "use VALUE as erase counter value for all eraseblocks")
BAREBOX_CMD_HELP_OPT("-x NUM\t", "UBI version number to put to EC headers (default 1)")
BAREBOX_CMD_HELP_OPT("-Q NUM\t", "32-bit UBI image sequence number to use")
+BAREBOX_CMD_HELP_OPT("-y\t", "Assume yes for all questions")
BAREBOX_CMD_HELP_OPT("-q\t", "suppress progress percentage information")
BAREBOX_CMD_HELP_OPT("-v\t", "be verbose")
BAREBOX_CMD_HELP_TEXT("")