mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 11/11] boot command: Add timeout support for menu
Date: Mon,  4 Nov 2013 15:04:30 +0100	[thread overview]
Message-ID: <1383573870-11325-12-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1383573870-11325-1-git-send-email-s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 commands/boot.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/commands/boot.c b/commands/boot.c
index 1bec406..91766e0 100644
--- a/commands/boot.c
+++ b/commands/boot.c
@@ -21,6 +21,7 @@
 #include <blspec.h>
 #include <libgen.h>
 #include <malloc.h>
+#include <clock.h>
 #include <boot.h>
 #include <menu.h>
 #include <fs.h>
@@ -30,6 +31,7 @@
 
 static int verbose;
 static int dryrun;
+static int timeout;
 
 /*
  * Start a single boot script. 'path' is a full path to a boot script.
@@ -255,6 +257,9 @@ static void bootsources_menu(char *entries[], int num_entries)
 	back_entry->non_re_ent = 1;
 	menu_add_entry(blspec->menu, back_entry);
 
+	if (timeout >= 0)
+		blspec->menu->auto_select = timeout;
+
 	menu_show(blspec->menu);
 
 	free(back_entry);
@@ -332,8 +337,9 @@ static int do_boot(int argc, char *argv[])
 
 	verbose = 0;
 	dryrun = 0;
+	timeout = -1;
 
-	while ((opt = getopt(argc, argv, "vldm")) > 0) {
+	while ((opt = getopt(argc, argv, "vldmt:")) > 0) {
 		switch (opt) {
 		case 'v':
 			verbose++;
@@ -347,6 +353,9 @@ static int do_boot(int argc, char *argv[])
 		case 'm':
 			do_menu = 1;
 			break;
+		case 't':
+			timeout = simple_strtoul(optarg, NULL, 0);
+			break;
 		}
 	}
 
@@ -415,6 +424,7 @@ BAREBOX_CMD_HELP_OPT  ("-v","Increase verbosity\n")
 BAREBOX_CMD_HELP_OPT  ("-d","Dryrun. See what happens but do no actually boot\n")
 BAREBOX_CMD_HELP_OPT  ("-l","List available boot sources\n")
 BAREBOX_CMD_HELP_OPT  ("-m","Show a menu with boot options\n")
+BAREBOX_CMD_HELP_OPT  ("-t <timeout>","specify timeout for the menu\n")
 BAREBOX_CMD_HELP_END
 
 BAREBOX_CMD_START(boot)
-- 
1.8.4.rc3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      parent reply	other threads:[~2013-11-04 14:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-04 14:04 bootspec work Sascha Hauer
2013-11-04 14:04 ` [PATCH 01/11] kernel-install: Add missing error messages Sascha Hauer
2013-11-04 14:04 ` [PATCH 02/11] blspec: Push device_detect into blspec_scan_device Sascha Hauer
2013-11-04 14:04 ` [PATCH 03/11] blspec: rename _hwdevice functions to _devicename Sascha Hauer
2013-11-04 14:04 ` [PATCH 04/11] blspec: Allow to boot partitions Sascha Hauer
2013-11-04 14:04 ` [PATCH 05/11] blspec: Let scan functions return the number of entries found Sascha Hauer
2013-11-04 14:04 ` [PATCH 06/11] fs: Add function to get cdev by mountpath Sascha Hauer
2013-11-04 14:04 ` [PATCH 07/11] blspec: make cdev optional Sascha Hauer
2013-11-04 22:21   ` Alexander Aring
2013-11-05  7:39     ` Sascha Hauer
2013-11-05  8:22       ` Alexander Aring
2013-11-04 14:04 ` [PATCH 08/11] boot: Print boot entries in the order they are Sascha Hauer
2013-11-04 14:04 ` [PATCH 09/11] boot command: make more flexible Sascha Hauer
2013-11-04 14:04 ` [PATCH 10/11] blspec: Make error message more clear Sascha Hauer
2013-11-04 14:04 ` Sascha Hauer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1383573870-11325-12-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox