:: commit dacf1fb0a80f6f9f54524566d8b8cf2879ef6c47

mintsuki <mintsuki@protonmail.com> — 2022-07-10 22:27

parents: 148183248d

chainload_next: Pass config through to chainload on UEFI

diff --git a/CONFIG.md b/CONFIG.md
index 728cfeb3..7e67af72 100644
--- a/CONFIG.md
+++ b/CONFIG.md
@@ -133,7 +133,9 @@ Editor control options.
   * `RESOLUTION` - The resolution to be used. This setting takes the form of `<width>x<height>x<bpp>`. If the resolution is not available, Limine will pick another one automatically. Omitting `<bpp>` will default to 32.
 
 * chainload_next protocol:
-  This protocol does not specify any locally assignable key. Will boot the next bootable drive found in the system, if there is one.
+  This protocol does not specify any locally assignable key on BIOS. Will boot the next bootable drive found in the system, if there is one.
+
+  * `RESOLUTION` - For UEFI, the resolution to be used. This setting takes the form of `<width>x<height>x<bpp>`. If the resolution is not available, Limine will pick another one automatically. Omitting `<bpp>` will default to 32.
 
 * multiboot1 and multiboot2 protocols:
   * `KERNEL_PATH` - The URI path of the kernel.
diff --git a/common/protos/chainload.c b/common/protos/chainload.c
index b6f50bc2..93a4610b 100644
--- a/common/protos/chainload.c
+++ b/common/protos/chainload.c
@@ -130,10 +130,10 @@ void chainload(char *config) {
     if ((image = uri_open(image_path)) == NULL)
         panic(true, "chainload: Failed to open image with path `%s`. Is the path correct?", image_path);
 
-    efi_chainload_file(image);
+    efi_chainload_file(config, image);
 }
 
-void efi_chainload_file(struct file_handle *image) {
+void efi_chainload_file(char *config, struct file_handle *image) {
     EFI_STATUS status;
 
     EFI_HANDLE efi_part_handle = image->efi_part_handle;
diff --git a/common/protos/chainload.h b/common/protos/chainload.h
index a462b8a4..c58defe1 100644
--- a/common/protos/chainload.h
+++ b/common/protos/chainload.h
@@ -5,7 +5,7 @@ void chainload(char *config);
 
 #if uefi == 1
 #include <fs/file.h>
-void efi_chainload_file(struct file_handle *image);
+void efi_chainload_file(char *config, struct file_handle *image);
 #endif
 
 #if bios == 1
diff --git a/common/protos/chainload_next.c b/common/protos/chainload_next.c
index 05ba4393..791d5671 100644
--- a/common/protos/chainload_next.c
+++ b/common/protos/chainload_next.c
@@ -7,13 +7,14 @@
 #include <lib/part.h>
 
 #if bios == 1
-static void try(struct volume *v) {
+static void try(char *config, struct volume *v) {
+    (void)config;
     bios_chainload_volume(v);
 }
 #endif
 
 #if uefi == 1
-static void try(struct volume *v) {
+static void try(char *config, struct volume *v) {
     for (int i = 0; i < v->max_partition + 1; i++) {
         struct file_handle *image;
 
@@ -23,14 +24,12 @@ static void try(struct volume *v) {
             continue;
         }
 
-        efi_chainload_file(image);
+        efi_chainload_file(config, image);
     }
 }
 #endif
 
 void chainload_next(char *config) {
-    (void)config;
-
     bool wrap = false;
     for (int i = boot_volume->is_optical ? 0 : (wrap = true, boot_volume->index + 1);
          boot_volume->is_optical ? true : i != boot_volume->index; i++) {
@@ -44,7 +43,7 @@ void chainload_next(char *config) {
             }
         }
 
-        try(v);
+        try(config, v);
     }
 
     wrap = false;
@@ -60,7 +59,7 @@ void chainload_next(char *config) {
             }
         }
 
-        try(v);
+        try(config, v);
     }
 
     panic(true, "chainload_next: No other bootable device");
tab: 248 wrap: offon