:: commit ec9d33d28f1245a2f1efa69f81832c20d860f1dd

mintsuki <mintsuki@protonmail.com> — 2022-08-09 13:03

parents: c02f8ef8cc

stivale(2): Add deprecation warnings

diff --git a/common/menu.c b/common/menu.c
index 1de13838..c01c691d 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -100,6 +100,7 @@ static const char *VALID_KEYS[] = {
     "DRIVE",
     "PARTITION",
     "IMAGE_PATH",
+    "DEPRECATION_WARNING",
     NULL
 };
 
diff --git a/common/protos/stivale.c b/common/protos/stivale.c
index 374d5be8..d5d050ea 100644
--- a/common/protos/stivale.c
+++ b/common/protos/stivale.c
@@ -58,6 +58,16 @@ bool stivale_load_by_anchor(void **_anchor, const char *magic,
 }
 
 noreturn void stivale_load(char *config, char *cmdline) {
+    char *depr_warn = config_get_value(config, 0, "DEPRECATION_WARNING");
+    if (depr_warn == NULL || strcmp(depr_warn, "no") != 0) {
+        print("WARNING: The stivale protocol is deprecated in Limine and will be removed as of version 4.x.\n");
+        print("         It is recommended to move to either the Limine boot protocol or multiboot2.\n");
+        print("         To silence this warning add DEPRECATION_WARNING=no to the boot entry.\n");
+        print("\n");
+        print("Press any key or wait 5 seconds to continue booting...\n");
+        pit_sleep_and_quit_on_keypress(5);
+    }
+
     struct stivale_struct *stivale_struct = ext_mem_alloc(sizeof(struct stivale_struct));
 
     // BIOS or UEFI?
diff --git a/common/protos/stivale2.c b/common/protos/stivale2.c
index c1caf11a..2aef1996 100644
--- a/common/protos/stivale2.c
+++ b/common/protos/stivale2.c
@@ -79,6 +79,16 @@ void stivale2_term_callback(uint64_t, uint64_t, uint64_t, uint64_t, uint64_t);
 #endif
 
 noreturn void stivale2_load(char *config, char *cmdline) {
+    char *depr_warn = config_get_value(config, 0, "DEPRECATION_WARNING");
+    if (depr_warn == NULL || strcmp(depr_warn, "no") != 0) {
+        print("WARNING: The stivale2 protocol is deprecated in Limine and will be removed as of version 4.x.\n");
+        print("         It is recommended to move to either the Limine boot protocol or multiboot2.\n");
+        print("         To silence this warning add DEPRECATION_WARNING=no to the boot entry.\n");
+        print("\n");
+        print("Press any key or wait 5 seconds to continue booting...\n");
+        pit_sleep_and_quit_on_keypress(5);
+    }
+
     struct stivale2_struct *stivale2_struct = ext_mem_alloc(sizeof(struct stivale2_struct));
 
     struct file_handle *kernel_file;
tab: 248 wrap: offon