This change adds a 'force-boot-menu' runtime configuration such that
if a non-zero value is set and 'show-boot-menu' is also non-zero,
SeaBIOS will show the boot menu without a timeout.
This is similar to GRUB having a timeout set to '-1' and originally I
wanted to implement it that way but the function to retrieve an
integer retrieves an unsigned one so I thought this "boolean"
configuration is a good way to implement it.
Tested on ASUS KGPE-D16.
From b1d69c8da90ab9ec25cc3f35ed5ee651e8405ff1 Mon Sep 17 00:00:00 2001
From: Daniel Khodabakhsh <d.khodabakhsh(a)gmail.com>
Date: Thu, 7 Nov 2024 18:46:16 -0800
Subject: [PATCH] Add force-boot-menu runtime configuration.
---
docs/Runtime_config.md | 1 +
src/boot.c | 32 +++++++++++++++++++-------------
2 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/docs/Runtime_config.md b/docs/Runtime_config.md
index 5795382b..af4da96a 100644
--- a/docs/Runtime_config.md
+++ b/docs/Runtime_config.md
@@ -177,6 +177,7 @@ There are several additional configuration options
available in the
| boot-menu-message | Customize the text boot menu message.
Normally, when in text mode SeaBIOS will report the string "\\nPress
ESC for boot menu.\\n\\n". This field allows the string to be changed.
(This is a string field, and is added as a file containing the raw
string.)
| boot-menu-key | Controls which key activates the boot menu.
The value stored is the DOS scan code (eg, 0x86 for F12, 0x01 for
Esc). If this field is set, be sure to also customize the
**boot-menu-message** field above.
| boot-menu-wait | Amount of time (in milliseconds) to wait at
the boot menu prompt before selecting the default boot.
+| force-boot-menu | Forces the display of the boot menu unless
the value is 0. **show-boot-menu** must also be set to 1. The default
is 0.
| boot-fail-wait | If no boot devices are found SeaBIOS will
reboot after 60 seconds. Set this to the amount of time (in
milliseconds) to customize the reboot delay or set to -1 to disable
rebooting when no boot devices are found
| extra-pci-roots | If the target machine has multiple
independent root buses set this to a positive value. The SeaBIOS PCI
probe will then search for the given number of extra root buses.
| ps2-keyboard-spinup | Some laptops that emulate PS2 keyboards don't
respond to keyboard commands immediately after powering on. One may
specify the amount of time (in milliseconds) here to allow as
additional time for the keyboard to become responsive. When this field
is set, SeaBIOS will repeatedly attempt to detect the keyboard until
the keyboard is found or the specified timeout is reached.
diff --git a/src/boot.c b/src/boot.c
index 1effd802..9bcb2480 100644
--- a/src/boot.c
+++ b/src/boot.c
@@ -708,20 +708,26 @@ interactive_bootmenu(void)
return;
}
- while (get_keystroke(0) >= 0)
- ;
-
- char *bootmsg = romfile_loadfile("etc/boot-menu-message", NULL);
+ // Show boot splash and proceed with booting if force_boot_menu
== 0 (default),
+ // otherwise force display menu
+ int force_boot_menu = romfile_loadint("etc/force-boot-menu", 0);
int menukey = romfile_loadint("etc/boot-menu-key", 1);
- printf("%s", bootmsg ?: "\nPress ESC for boot menu.\n\n");
- free(bootmsg);
-
- u32 menutime = romfile_loadint("etc/boot-menu-wait",
DEFAULT_BOOTMENU_WAIT);
- enable_bootsplash();
- int scan_code = get_keystroke(menutime);
- disable_bootsplash();
- if (scan_code != menukey)
- return;
+ int scan_code;
+ if (force_boot_menu == 0) {
+ while (get_keystroke(0) >= 0)
+ ;
+
+ char *bootmsg = romfile_loadfile("etc/boot-menu-message", NULL);
+ printf("%s", bootmsg ?: "\nPress ESC for boot menu.\n\n");
+ free(bootmsg);
+
+ u32 menutime = romfile_loadint("etc/boot-menu-wait",
DEFAULT_BOOTMENU_WAIT);
+ enable_bootsplash();
+ scan_code = get_keystroke(menutime);
+ disable_bootsplash();
+ if (scan_code != menukey)
+ return;
+ }
while (get_keystroke(0) >= 0)
;
--
2.46.0