summaryrefslogtreecommitdiff
path: root/config/u-boot/x86/patches/0004-Add-an-8sec-autoboot-timeout-on-the-bootflow-menu.patch
blob: 3790e6edd813d38b0f8fc69ad47fe2900e279157 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
From 1b1673e76dae73885089415132284e9a14ecd4ac Mon Sep 17 00:00:00 2001
From: Leah Rowe <info@minifree.org>
Date: Tue, 3 Dec 2024 20:31:32 +0000
Subject: [PATCH 1/1] Add an 8sec autoboot timeout on the bootflow menu

Otherwise, you have to press enter to load from a boot option,
which is unacceptable on headless setups.

If you press the arrow keys to interrupt it, the timer will stop
and you must then press enter to boot an option.

Otherwise, if you just leave U-Boot to do its thing, it will
automatically boot what was selected, e.g. installed OS.

Signed-off-by: Leah Rowe <info@minifree.org>
---
 boot/bootflow_menu.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/boot/bootflow_menu.c b/boot/bootflow_menu.c
index 9d0dc352f9..c788b86cdc 100644
--- a/boot/bootflow_menu.c
+++ b/boot/bootflow_menu.c
@@ -59,7 +59,7 @@ int bootflow_menu_new(struct expo **expp)
 	ret = scene_menu(scn, "main", OBJ_MENU, &menu);
 	ret |= scene_obj_set_pos(scn, OBJ_MENU, MARGIN_LEFT, 100);
 	ret |= scene_txt_str(scn, "title", OBJ_MENU_TITLE, STR_MENU_TITLE,
-			     "U-Boot - Boot Menu", NULL);
+			     "****  The selected menu item will autoboot in a few seconds unless interrupted! ****", NULL);
 	ret |= scene_menu_set_title(scn, OBJ_MENU, OBJ_PROMPT);
 
 	logo = video_get_u_boot_logo();
@@ -185,6 +185,8 @@ int bootflow_menu_run(struct bootstd_priv *std, bool text_mode,
 	uint sel_id;
 	bool done;
 	int ret;
+	int bootflow_delay=8000;
+	bool bootflow_countdown=true;
 
 	cli_ch_init(cch);
 
@@ -231,6 +233,12 @@ int bootflow_menu_run(struct bootstd_priv *std, bool text_mode,
 				schedule();
 				mdelay(2);
 				ichar = cli_ch_process(cch, -ETIMEDOUT);
+				if (bootflow_countdown == true) {
+					bootflow_delay -= 2;
+					if (bootflow_delay <= 0) {
+						ichar='\n';
+					}
+				}
 			}
 			if (!ichar) {
 				ichar = getchar();
@@ -265,6 +273,7 @@ int bootflow_menu_run(struct bootstd_priv *std, bool text_mode,
 				break;
 			}
 		}
+		bootflow_countdown = false;
 	} while (!done);
 
 	if (ret)
-- 
2.39.5