[PATCH 11/11] boot command: Add timeout support for menu

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux