Only enter graphical terminal mode for menu
diff --git a/Makefile b/Makefile
index 33d055d5..5528fa63 100644
--- a/Makefile
+++ b/Makefile
@@ -32,7 +32,7 @@ echfs-test: test.img all
echfs-utils -m -p0 test.img import test/test.elf boot/test.elf
echfs-utils -m -p0 test.img import test/limine.cfg limine.cfg
./limine-install src/limine.bin test.img
- qemu-system-x86_64 -hda test.img -debugcon stdio
+ qemu-system-x86_64 -hda test.img -debugcon stdio -enable-kvm
ext2-test: test.img all
$(MAKE) -C test
diff --git a/limine.bin b/limine.bin
index c0cbc09c..90577a52 100644
Binary files a/limine.bin and b/limine.bin differ
diff --git a/src/lib/term.c b/src/lib/term.c
index 1f87dfcf..2bb85da7 100644
--- a/src/lib/term.c
+++ b/src/lib/term.c
@@ -24,6 +24,7 @@ void (*set_text_bg)(int bg);
static int rows, cols;
void term_vbe(void) {
+ term_deinit();
vbe_tty_init(&rows, &cols);
raw_putchar = vbe_putchar;
@@ -39,6 +40,7 @@ void term_vbe(void) {
}
void term_textmode(void) {
+ term_deinit();
init_vga_textmode(&rows, &cols);
raw_putchar = text_putchar;
diff --git a/src/main.c b/src/main.c
index 4edbd029..f541b02e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -61,29 +61,22 @@ void main(int boot_drive) {
init_e820();
init_memmap();
- char buf[32];
-
- if (config_get_value(buf, 0, 32, "GRAPHICS")) {
- if (!strcmp(buf, "on")) {
- term_vbe();
- }
- }
-
char *cmdline = menu();
- if (!config_get_value(buf, 0, 32, "KERNEL_PROTO")) {
- if (!config_get_value(buf, 0, 32, "PROTOCOL")) {
+ char proto[32];
+ if (!config_get_value(proto, 0, 32, "KERNEL_PROTO")) {
+ if (!config_get_value(proto, 0, 32, "PROTOCOL")) {
panic("PROTOCOL not specified");
}
}
- if (!strcmp(buf, "stivale")) {
+ if (!strcmp(proto, "stivale")) {
stivale_load(cmdline, boot_drive);
- } else if (!strcmp(buf, "stivale2")) {
+ } else if (!strcmp(proto, "stivale2")) {
stivale2_load(cmdline, boot_drive);
- } else if (!strcmp(buf, "linux")) {
+ } else if (!strcmp(proto, "linux")) {
linux_load(cmdline, boot_drive);
- } else if (!strcmp(buf, "chainload")) {
+ } else if (!strcmp(proto, "chainload")) {
chainload();
} else {
panic("Invalid protocol specified");
diff --git a/src/menu.c b/src/menu.c
index cf1f139a..09b12129 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -17,15 +17,21 @@ static char config_entry_name[1024];
char *menu(void) {
cmdline = balloc(CMDLINE_MAX);
- int timeout; {
- char buf[32];
- if (!config_get_value(buf, 0, 32, "TIMEOUT")) {
- timeout = 5;
- } else {
- timeout = (int)strtoui(buf);
+ char buf[16];
+
+ if (config_get_value(buf, 0, 16, "GRAPHICS")) {
+ if (!strcmp(buf, "on")) {
+ term_vbe();
}
}
+ 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;
@@ -85,6 +91,7 @@ refresh:
}
}
clear(true);
+ term_textmode();
return cmdline;
case 'e':
config_set_entry(selected_entry);
@@ -97,6 +104,7 @@ refresh:
print("\n\n> ");
gets(cmdline, cmdline, CMDLINE_MAX);
clear(true);
+ term_textmode();
return cmdline;
}
}
