Default back to text mode instead of VBE, add DEFAULT_ENTRY config option

This commit is contained in:
mintsuki 2020-09-29 21:48:34 +02:00
parent 562e3c7c88
commit 2f7d3c378d
4 changed files with 30 additions and 14 deletions

View File

@ -21,9 +21,10 @@ Some *local assignments* are shared between entries using any *protocol*, while
*Globally assignable* keys are:
* `TIMEOUT` - Specifies the timeout in seconds before the first *entry* is automatically booted.
* `TEXTMODE` - If set to `on`, do not use graphical VESA framebuffer for the boot menu.
* `THEME_BLACK`, `THEME_RED`, `THEME_GREEN`, `THEME_BROWN`, `THEME_BLUE`, `THEME_MAGENTA`, `THEME_CYAN`, `THEME_GREY`, `THEME_WHITE` - Specifies the colors used by the terminal (RRGGBB).
* `THEME_MARGIN` - Set the amount of margin around the terminal.
* `DEFAULT_ENTRY` - 0-based entry index of the entry which will be automatically selected at startup. If unspecified, it is `0`.
* `GRAPHICS` - If set to `yes`, do use graphical VESA framebuffer for the boot menu.
* `THEME_BLACK`, `THEME_RED`, `THEME_GREEN`, `THEME_BROWN`, `THEME_BLUE`, `THEME_MAGENTA`, `THEME_CYAN`, `THEME_GREY`, `THEME_WHITE` - Specifies the colors used by the terminal (RRGGBB). Ignored if `GRAPHICS` is not `yes`.
* `THEME_MARGIN` - Set the amount of margin around the terminal. Ignored if `GRAPHICS` is not `yes`.
*Locally assignable (non protocol specific)* keys are:
* `PROTOCOL` - The boot protocol that will be used to boot the kernel. Valid protocols are: `linux`, `stivale`, `stivale2`, `chainload`.

Binary file not shown.

View File

@ -21,8 +21,21 @@ char *menu(int boot_drive) {
char buf[16];
// If there is no TEXTMODE config key or the value is not "on", enable graphics
if (config_get_value(buf, 0, 16, "TEXTMODE") == NULL || strcmp(buf, "on")) {
int selected_entry = 0;
if (config_get_value(buf, 0, 16, "DEFAULT_ENTRY")) {
selected_entry = (int)strtoui(buf);
}
int timeout = 5;
if (config_get_value(buf, 0, 16, "TIMEOUT")) {
timeout = (int)strtoui(buf);
}
if (!timeout)
goto autoboot;
// If there is GRAPHICS config key and the value is "yes", enable graphics
if (config_get_value(buf, 0, 16, "GRAPHICS") && !strcmp(buf, "yes")) {
// default scheme
int margin = 64;
uint32_t colourscheme[] = {
@ -104,15 +117,7 @@ char *menu(int boot_drive) {
yesbg:;
}
int timeout;
if (!config_get_value(buf, 0, 16, "TIMEOUT")) {
timeout = 5;
} else {
timeout = (int)strtoui(buf);
}
disable_cursor();
int selected_entry = 0;
bool skip_timeout = false;
refresh:

View File

@ -1,4 +1,6 @@
DEFAULT_ENTRY=2
TIMEOUT=3
GRAPHICS=yes
THEME_BLACK=80000000
THEME_RED=aa0000
@ -14,7 +16,7 @@ THEME_MARGIN=64
BACKGROUND_PARTITION=0
BACKGROUND_PATH=bg.bmp
:MyOS
:MyOS 0
PROTOCOL=stivale2
@ -29,3 +31,11 @@ PROTOCOL=stivale2
KERNEL_PARTITION=0
KERNEL_PATH=boot/test.elf
KERNEL_CMDLINE=something
:MyOS 2
PROTOCOL=stivale2
KERNEL_PARTITION=0
KERNEL_PATH=boot/test.elf
KERNEL_CMDLINE=something