docs/Runtime_config.md | 1 + src/boot.c | 32 +++++++++++++++++++------------- 2 files changed, 20 insertions(+), 13 deletions(-)
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@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
From b1d69c8da90ab9ec25cc3f35ed5ee651e8405ff1 Mon Sep 17 00:00:00 2001
From: Daniel Khodabakhsh <d.khodabakhsh@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
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org
After poking around I realised boot-fail-wait supports a negative
integer input, so instead of introducing a new configuration I made a
change to support negative integer input for boot-menu-wait.
Please disregard the previous patch and consider this one instead:
From 17a5b1cd90a10661652911a541afc13b69709ebf Mon Sep 17 00:00:00 2001
From: Daniel Khodabakhsh <d.khodabakhsh@gmail.com>
Date: Thu, 7 Nov 2024 18:46:16 -0800
Subject: [PATCH] Force display of the boot menu when boot-menu-wait is a
negative number.
---
docs/Runtime_config.md | 2 +-
src/boot.c | 29 ++++++++++++++++-------------
2 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/docs/Runtime_config.md b/docs/Runtime_config.md
index 5795382b..f5e0cbd5 100644
--- a/docs/Runtime_config.md
+++ b/docs/Runtime_config.md
@@ -176,7 +176,7 @@ There are several additional configuration options
available in the
| show-boot-menu | Controls the display of the boot menu. Valid
values are 0: Disable the boot menu, 1: Display boot menu
unconditionally, 2: Skip boot menu if only one device is present. The
default is 1.
| 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.
+| boot-menu-wait | Amount of time (in milliseconds) to wait at
the boot menu prompt before selecting the default boot. Set to a
negative number such as -1 to force the display of the boot menu.
| 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..5c37dafd 100644
--- a/src/boot.c
+++ b/src/boot.c
@@ -708,20 +708,23 @@ interactive_bootmenu(void)
return;
}
- while (get_keystroke(0) >= 0)
- ;
-
- char *bootmsg = romfile_loadfile("etc/boot-menu-message", NULL);
+ int menutime = romfile_loadint("etc/boot-menu-wait",
DEFAULT_BOOTMENU_WAIT);
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 (menutime >= 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);
+
+ enable_bootsplash();
+ scan_code = get_keystroke(menutime);
+ disable_bootsplash();
+ if (scan_code != menukey)
+ return;
+ }
while (get_keystroke(0) >= 0)
;
--
2.46.0
From 17a5b1cd90a10661652911a541afc13b69709ebf Mon Sep 17 00:00:00 2001
From: Daniel Khodabakhsh <d.khodabakhsh@gmail.com>
Date: Thu, 7 Nov 2024 18:46:16 -0800
Subject: [PATCH] Force display of the boot menu when boot-menu-wait is a
negative number.
---
docs/Runtime_config.md | 2 +-
src/boot.c | 29 ++++++++++++++++-------------
2 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/docs/Runtime_config.md b/docs/Runtime_config.md
index 5795382b..f5e0cbd5 100644
--- a/docs/Runtime_config.md
+++ b/docs/Runtime_config.md
@@ -176,7 +176,7 @@ There are several additional configuration options available in the
| show-boot-menu | Controls the display of the boot menu. Valid values are 0: Disable the boot menu, 1: Display boot menu unconditionally, 2: Skip boot menu if only one device is present. The default is 1.
| 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.
+| boot-menu-wait | Amount of time (in milliseconds) to wait at the boot menu prompt before selecting the default boot. Set to a negative number such as -1 to force the display of the boot menu.
| 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..5c37dafd 100644
--- a/src/boot.c
+++ b/src/boot.c
@@ -708,20 +708,23 @@ interactive_bootmenu(void)
return;
}
- while (get_keystroke(0) >= 0)
- ;
-
- char *bootmsg = romfile_loadfile("etc/boot-menu-message", NULL);
+ int menutime = romfile_loadint("etc/boot-menu-wait", DEFAULT_BOOTMENU_WAIT);
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 (menutime >= 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);
+
+ enable_bootsplash();
+ scan_code = get_keystroke(menutime);
+ disable_bootsplash();
+ if (scan_code != menukey)
+ return;
+ }
while (get_keystroke(0) >= 0)
;
--
2.46.0
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org
On Mon, Nov 11, 2024 at 03:41:16AM +0000, Daniel Khodabakhsh wrote: > After poking around I realised boot-fail-wait supports a negative > integer input, so instead of introducing a new configuration I made a > change to support negative integer input for boot-menu-wait. > Please disregard the previous patch and consider this one instead: > > From 17a5b1cd90a10661652911a541afc13b69709ebf Mon Sep 17 00:00:00 2001 > From: Daniel Khodabakhsh <d.khodabakhsh@gmail.com> > Date: Thu, 7 Nov 2024 18:46:16 -0800 > Subject: [PATCH] Force display of the boot menu when boot-menu-wait is a > negative number. Looks good to me. take care, Gerd _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org
© 2016 - 2024 Red Hat, Inc.