mirror of
https://github.com/limine-bootloader/limine
synced 2024-11-28 19:33:09 +03:00
main: Add autodetection prompt instead of doing it automatically
This commit is contained in:
parent
79970493d8
commit
ec4b01865c
@ -24,6 +24,7 @@
|
||||
#include <pxe/tftp.h>
|
||||
#include <drivers/disk.h>
|
||||
#include <sys/lapic.h>
|
||||
#include <lib/readline.h>
|
||||
|
||||
void stage3_common(void);
|
||||
|
||||
@ -162,8 +163,11 @@ void stage3_common(void) {
|
||||
print("Boot partition: %d\n", boot_volume->partition);
|
||||
}
|
||||
|
||||
bool disable_timeout = false;
|
||||
|
||||
menu_again:;
|
||||
char *cmdline;
|
||||
char *config = menu(&cmdline);
|
||||
char *config = menu(&cmdline, disable_timeout);
|
||||
|
||||
char *proto = config_get_value(config, 0, "PROTOCOL");
|
||||
if (proto == NULL) {
|
||||
@ -199,6 +203,13 @@ autodetect:
|
||||
print("WARNING: Incorrect protocol specified for kernel.\n");
|
||||
}
|
||||
|
||||
print(" Attempting autodetection.\n");
|
||||
goto autodetect;
|
||||
print(" Press A to attempt autodetection or any other key to return to menu.\n");
|
||||
|
||||
int c = getchar();
|
||||
if (c == 'a' || c == 'A') {
|
||||
goto autodetect;
|
||||
} else {
|
||||
disable_timeout = true;
|
||||
goto menu_again;
|
||||
}
|
||||
}
|
||||
|
@ -513,7 +513,7 @@ static size_t print_tree(const char *shift, size_t level, size_t base_index, siz
|
||||
return max_entries;
|
||||
}
|
||||
|
||||
char *menu(char **cmdline) {
|
||||
char *menu(char **cmdline, bool disable_timeout) {
|
||||
menu_branding = config_get_value(NULL, 0, "MENU_BRANDING");
|
||||
if (menu_branding == NULL)
|
||||
menu_branding = "Limine " LIMINE_VERSION;
|
||||
@ -544,6 +544,10 @@ char *menu(char **cmdline) {
|
||||
timeout = strtoui(timeout_config, NULL, 10);
|
||||
}
|
||||
|
||||
if (disable_timeout) {
|
||||
skip_timeout = true;
|
||||
}
|
||||
|
||||
bool editor_enabled = true;
|
||||
char *editor_enabled_config = config_get_value(NULL, 0, "EDITOR_ENABLED");
|
||||
if (!strcmp(editor_enabled_config, "no")) editor_enabled = false;
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifndef __MENU_H__
|
||||
#define __MENU_H__
|
||||
|
||||
char *menu(char **cmdline_ret);
|
||||
#include <stdbool.h>
|
||||
|
||||
char *menu(char **cmdline_ret, bool disable_timeout);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user