diff --git a/src/boot.c b/src/boot.c index 33a0001..608d346 100644 --- a/src/boot.c +++ b/src/boot.c @@ -21,6 +21,7 @@ #include "string.h" // memset #include "util.h" // irqtimer_calc #include "tcgbios.h" // tpm_* +#include "rf_config.h" /**************************************************************** * Helper search functions @@ -680,8 +681,6 @@ get_keystroke(int msec) * Boot menu and BCV execution ****************************************************************/ -#define DEFAULT_BOOTMENU_WAIT 2500 - static const char menuchars[] = { '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', @@ -696,30 +695,36 @@ interactive_bootmenu(void) { if (! CONFIG_BOOTMENU) return; - int show_boot_menu = romfile_loadint("etc/show-boot-menu", 1); - if (!show_boot_menu) + if (!RF_CONF_SHOW_BOOT_MENU) return; // skip menu if only one boot device and no TPM - if (show_boot_menu == 2 && !tpm_can_show_menu() + if (RF_CONF_SHOW_BOOT_MENU == 2 && !tpm_can_show_menu() && !hlist_empty(&BootList) && !BootList.first->next) { dprintf(1, "Only one boot device present. Skip boot menu.\n"); printf("\n"); return; } - - int menutime = romfile_loadint("etc/boot-menu-wait", DEFAULT_BOOTMENU_WAIT); - int menukey = romfile_loadint("etc/boot-menu-key", 1); + + int menukey; + if (RF_CONF_OBSCURE_MODE) { + menukey = RF_CONF_OBSCURE_BOOT_MENU_KEY; + } else { + menukey = RF_CONF_BOOT_MENU_KEY; + } + int scan_code; - if (menutime >= 0) { + if (RF_CONF_BOOT_MENU_WAIT >= 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); + if (RF_CONF_OBSCURE_MODE) { + printf(rf_conf_obscure_bootmsg); + } else { + printf(rf_conf_bootmsg); + } - scan_code = get_keystroke(menutime); + scan_code = get_keystroke(RF_CONF_BOOT_MENU_WAIT); if (scan_code != menukey) return; } @@ -727,7 +732,7 @@ interactive_bootmenu(void) while (get_keystroke(0) >= 0) ; - printf("Select boot device:\n\n"); + printf("\nBoot devices:\n"); wait_threads(); // Show menu items diff --git a/src/bootsplash.c b/src/bootsplash.c index a657195..1592aac 100644 --- a/src/bootsplash.c +++ b/src/bootsplash.c @@ -52,6 +52,10 @@ enable_vga_console(void) call16_int10(&br); // Write to screen. - printf("SeaBIOS (version %s)\n", VERSION); + if (RF_CONF_OBSCURE_MODE) { + printf(rf_conf_obscure_welcome); + } else { + printf("SeaBIOS (version %s)\n", VERSION); + } display_uuid(); } diff --git a/src/rf_config.h b/src/rf_config.h index 0171751..577d34f 100644 --- a/src/rf_config.h +++ b/src/rf_config.h @@ -1,6 +1,18 @@ #ifndef _RF_CONFIG_H #define _RF_CONFIG_H +// New configuration options #define RF_CONF_COREBOOT_BOOTSPLASH 500 // 500 ms before clearing Coreboot bootsplash +#define RF_CONF_OBSCURE_MODE 1 // Remove SeaBIOS branding for 'Security through obscurity' +#define RF_CONF_OBSCURE_BOOT_MENU_KEY 133 // 133 is F11 +const char* rf_conf_obscure_bootmsg = "Waiting for boot menu combination...\n"; +const char* rf_conf_obscure_welcome = "HOJUIX Bootloader 1.0.0\n"; // "Seabios (Version)" alternative + +// Old configuration options moved from file-based config +#define RF_CONF_SHOW_BOOT_MENU 1 // etc/show-boot-menu +#define RF_CONF_BOOT_MENU_WAIT 2500 // etc/boot-menu-wait +#define RF_CONF_BOOT_MENU_KEY 1 // etc/boot-menu-key +const char* rf_conf_bootmsg = "Press ESC for boot menu.\n"; + #endif