chainload_next: Pass config through to chainload on UEFI

This commit is contained in:
mintsuki 2022-07-11 00:27:22 +02:00
parent abd641bba0
commit 4511827780
4 changed files with 12 additions and 11 deletions

View File

@ -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.

View File

@ -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;

View File

@ -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

View File

@ -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");