Always show boot menu when show-boot-menu is set to 3.
A good use case for that is when you want to use SeaBIOS as secondary payload on Coreboot (for example, for GRUB2) and you need it only to boot from USB stick or stuff like that.
Signed-off-by: Timothy Redaelli tredaelli@redhat.com --- docs/Runtime_config.md | 2 +- src/boot.c | 33 ++++++++++++++++++--------------- 2 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/docs/Runtime_config.md b/docs/Runtime_config.md index 5795382b..89c01f90 100644 --- a/docs/Runtime_config.md +++ b/docs/Runtime_config.md @@ -173,7 +173,7 @@ There are several additional configuration options available in the
| Filename | Description |---------------------|--------------------------------------------------- -| 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. +| 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, 3: Always display boot menu without requiring a key press. 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. diff --git a/src/boot.c b/src/boot.c index 1effd802..cab41f62 100644 --- a/src/boot.c +++ b/src/boot.c @@ -708,21 +708,24 @@ interactive_bootmenu(void) return; }
- while (get_keystroke(0) >= 0) - ; - - char *bootmsg = romfile_loadfile("etc/boot-menu-message", NULL); - 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 menukey = 0, scan_code; + // wait for keypress + if (show_boot_menu != 3) { + while (get_keystroke(0) >= 0) + ; + + char *bootmsg = romfile_loadfile("etc/boot-menu-message", NULL); + 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(); + scan_code = get_keystroke(menutime); + disable_bootsplash(); + if (scan_code != menukey) + return; + } while (get_keystroke(0) >= 0) ;