:: commit 32192f73a4f52dcc90960ce35400dc50390fe0be

mintsuki <mintsuki@protonmail.com> — 2021-08-16 22:58

parents: b2e66e5a2d

docs: Document TEXTMODE option

diff --git a/CONFIG.md b/CONFIG.md
index ce460473..57f57687 100644
--- a/CONFIG.md
+++ b/CONFIG.md
@@ -102,6 +102,7 @@ Some keys take *URIs* as values; these are described in the next section.
   to the 1st module string entry that appear, and so on.
   * `RESOLUTION` - The resolution to be used should the kernel request a graphical framebuffer. This setting takes the form of `<width>x<height>x<bpp>` and *overrides* any resolution requested by the kernel, or automatic resolution requests. If the resolution is not available, Limine will pick another one automatically. Omitting `<bpp>` will default to 32.
   * `KASLR` - For relocatable kernels, if set to `no`, disable kernel address space layout randomisation. KASLR is enabled by default.
+  * `TEXTMODE` - If set to `yes`, prefer text mode if the kernel has no video mode requirements. (Only for stivale2)
 * Chainload protocol on BIOS:
   * `DRIVE` - The 1-based BIOS drive to chainload.
   * `PARTITION` - The 1-based BIOS partition to chainload, if omitted, chainload drive.
diff --git a/stage23/menu.c b/stage23/menu.c
index 92393acc..6720472f 100644
--- a/stage23/menu.c
+++ b/stage23/menu.c
@@ -82,6 +82,8 @@ static const char *VALID_KEYS[] = {
     "TERMINAL_FONT",
     "THEME_COLOURS",
     "THEME_COLORS",
+    "THEME_BRIGHT_COLOURS",
+    "THEME_BRIGHT_COLORS",
     "THEME_BACKGROUND",
     "THEME_FOREGROUND",
     "THEME_MARGIN",
@@ -94,6 +96,9 @@ static const char *VALID_KEYS[] = {
     "EDITOR_HIGHLIGHTING",
     "EDITOR_VALIDATION",
     "VERBOSE",
+    "RANDOMISE_MEMORY",
+    "RANDOMIZE_MEMORY",
+    "COMMENT",
     "PROTOCOL",
     "CMDLINE",
     "KERNEL_CMDLINE",
@@ -101,11 +106,11 @@ static const char *VALID_KEYS[] = {
     "MODULE_PATH",
     "MODULE_STRING",
     "RESOLUTION",
+    "TEXTMODE",
     "KASLR",
     "DRIVE",
     "PARTITION",
     "IMAGE_PATH",
-    "COMMENT",
     NULL
 };
 
diff --git a/stage23/protos/stivale2.c b/stage23/protos/stivale2.c
index 9a42014f..50ee39e5 100644
--- a/stage23/protos/stivale2.c
+++ b/stage23/protos/stivale2.c
@@ -382,19 +382,16 @@ failed_to_load_header_section:
 
     size_t req_width = 0, req_height = 0, req_bpp = 0;
 
+    if (hdrtag != NULL) {
+        req_width = hdrtag->framebuffer_width;
+        req_height = hdrtag->framebuffer_height;
+        req_bpp = hdrtag->framebuffer_bpp;
+    }
+
     char *resolution = config_get_value(config, 0, "RESOLUTION");
     if (resolution != NULL)
         parse_resolution(&req_width, &req_height, &req_bpp, resolution);
 
-    if (hdrtag != NULL) {
-        if (hdrtag->framebuffer_width)
-            req_width  = hdrtag->framebuffer_width;
-        if (hdrtag->framebuffer_height)
-            req_height = hdrtag->framebuffer_height;
-        if (hdrtag->framebuffer_bpp)
-            req_bpp    = hdrtag->framebuffer_bpp;
-    }
-
     struct stivale2_header_tag_any_video *avtag = get_tag(&stivale2_hdr, STIVALE2_HEADER_TAG_ANY_VIDEO_ID);
 
 #if uefi == 1
diff --git a/test/stivale2.c b/test/stivale2.c
index c91927dd..a69577a2 100644
--- a/test/stivale2.c
+++ b/test/stivale2.c
@@ -112,6 +112,11 @@ void stivale2_main(struct stivale2_struct *info) {
                 e9_printf("\tBlue mask size:  %d", f->blue_mask_shift);
                 break;
             }
+            case STIVALE2_STRUCT_TAG_TEXTMODE_ID: {
+                struct stivale2_struct_tag_textmode *tm = (struct stivale2_struct_tag_textmode *)tag;
+                e9_puts("Textmode tag");
+                break;
+            }
             case STIVALE2_STRUCT_TAG_EDID_ID: {
                 struct stivale2_struct_tag_edid *edid = (struct stivale2_struct_tag_edid *)tag;
 
tab: 248 wrap: offon