:: commit c9cc7bbb669559c54fb5bf92ae3200f0d5fbb34c

mintsuki <mintsuki@protonmail.com> — 2025-01-10 12:53

parents: 96a703141e

protos: Make 'path' option standard to pick executable to boot for all protos

diff --git a/CONFIG.md b/CONFIG.md
index d31b73cf..c4343e40 100644
--- a/CONFIG.md
+++ b/CONFIG.md
@@ -120,7 +120,8 @@ Editor control options:
 *Locally assignable (protocol specific) options* are:
 
 * Linux protocol:
-  * `kernel_path` - The path of the kernel.
+  * `path` - The path of the kernel.
+  * `kernel_path` - Alias of `path`.
   * `module_path` - The path to a module (such as initramfs). This option can be specified multiple times to specify multiple modules.
   * `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.
   * `textmode` - If set to `yes`, prefer text mode. (BIOS only)
@@ -151,7 +152,8 @@ Editor control options:
   * `textmode` - If set to `yes`, prefer text mode. (BIOS only)
 
 * EFI Chainload protocol:
-  * `image_path` - Path of the EFI application to chainload.
+  * `path` - Path of the EFI application to chainload.
+  * `image_path` - Alias of `path`.
   * `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.
 
 * BIOS Chainload protocol:
diff --git a/common/protos/chainload.c b/common/protos/chainload.c
index f59dda66..ae4cdd36 100644
--- a/common/protos/chainload.c
+++ b/common/protos/chainload.c
@@ -201,9 +201,12 @@ void bios_chainload_volume(struct volume *p) {
 #elif defined (UEFI)
 
 noreturn void chainload(char *config, char *cmdline) {
-    char *image_path = config_get_value(config, 0, "IMAGE_PATH");
-    if (image_path == NULL)
-        panic(true, "chainload: IMAGE_PATH not specified");
+    char *image_path = config_get_value(config, 0, "PATH");
+    if (image_path == NULL) {
+        image_path = config_get_value(config, 0, "IMAGE_PATH");
+    } else {
+        panic(true, "chainload: Image path not specified");
+    }
 
     struct file_handle *image;
     if ((image = uri_open(image_path)) == NULL)
diff --git a/common/protos/linux.c b/common/protos/linux.c
index 66482057..72fe82be 100644
--- a/common/protos/linux.c
+++ b/common/protos/linux.c
@@ -288,9 +288,13 @@ struct boot_params {
 noreturn void linux_load(char *config, char *cmdline) {
     struct file_handle *kernel_file;
 
-    char *kernel_path = config_get_value(config, 0, "KERNEL_PATH");
-    if (kernel_path == NULL)
-        panic(true, "linux: KERNEL_PATH not specified");
+    char *kernel_path = config_get_value(config, 0, "PATH");
+    if (kernel_path == NULL) {
+        kernel_path = config_get_value(config, 0, "KERNEL_PATH");
+    }
+    if (kernel_path == NULL) {
+        panic(true, "linux: Kernel path not specified");
+    }
 
     print("linux: Loading kernel `%#`...\n", kernel_path);
 
diff --git a/common/protos/linux_risc.c b/common/protos/linux_risc.c
index 9f9f91f9..a5a62db5 100644
--- a/common/protos/linux_risc.c
+++ b/common/protos/linux_risc.c
@@ -409,9 +409,12 @@ noreturn void linux_load(char *config, char *cmdline) {
 
     struct file_handle *kernel_file;
 
-    char *kernel_path = config_get_value(config, 0, "KERNEL_PATH");
+    char *kernel_path = config_get_value(config, 0, "PATH");
     if (kernel_path == NULL) {
-        panic(true, "linux: KERNEL_PATH not specified");
+        kernel_path = config_get_value(config, 0, "KERNEL_PATH");
+    }
+    if (kernel_path == NULL) {
+        panic(true, "linux: Kernel path not specified");
     }
 
     print("linux: Loading kernel `%#`...\n", kernel_path);
tab: 248 wrap: offon