protos/chainload_next: Drop protocol
This commit is contained in:
@@ -113,7 +113,7 @@ Editor control options:
|
||||
*Locally assignable (non protocol specific) options* are:
|
||||
|
||||
* `comment` - An optional comment string that will be displayed by the bootloader on the menu when an entry is selected.
|
||||
* `protocol` - The boot protocol that will be used to boot the kernel/executable. Valid protocols are: `linux`, `limine`, `multiboot` (or `multiboot1`), `multiboot2`, `efi`, `bios`, and `chainload_next`.
|
||||
* `protocol` - The boot protocol that will be used to boot the kernel/executable. Valid protocols are: `linux`, `limine`, `multiboot` (or `multiboot1`), `multiboot2`, `efi`, and `bios`.
|
||||
* `cmdline` - The command line string to be passed to the kernel/executable. Can be omitted.
|
||||
* `kernel_cmdline` - Alias of `cmdline`.
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include <drivers/vga_textmode.h>
|
||||
#include <protos/linux.h>
|
||||
#include <protos/chainload.h>
|
||||
#include <protos/chainload_next.h>
|
||||
#include <protos/multiboot1.h>
|
||||
#include <protos/multiboot2.h>
|
||||
#include <protos/limine.h>
|
||||
@@ -1194,8 +1193,6 @@ noreturn void boot(char *config) {
|
||||
quiet = false;
|
||||
print("Multiboot 2 is not available on non-x86 architectures.\n\n");
|
||||
#endif
|
||||
} else if (!strcmp(proto, "chainload_next")) {
|
||||
chainload_next(config, cmdline);
|
||||
#if defined (BIOS)
|
||||
} else if (!strcmp(proto, "bios_chainload")
|
||||
|| !strcmp(proto, "bios")) {
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdnoreturn.h>
|
||||
#include <protos/chainload_next.h>
|
||||
#include <protos/chainload.h>
|
||||
#include <lib/misc.h>
|
||||
#include <lib/print.h>
|
||||
#include <lib/part.h>
|
||||
|
||||
#if defined (BIOS)
|
||||
static void try(char *config, char *cmdline, struct volume *v) {
|
||||
(void)config;
|
||||
(void)cmdline;
|
||||
bios_chainload_volume(v);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined (UEFI)
|
||||
static void try(char *config, char *cmdline, struct volume *v) {
|
||||
for (int i = 0; i <= v->max_partition + 1; i++) {
|
||||
struct file_handle *image;
|
||||
struct volume *p = volume_get_by_coord(v->is_optical, v->index, i);
|
||||
|
||||
bool old_cif = case_insensitive_fopen;
|
||||
case_insensitive_fopen = true;
|
||||
if ((image = fopen(p, "/EFI/BOOT/BOOTX64.EFI")) == NULL) {
|
||||
case_insensitive_fopen = old_cif;
|
||||
continue;
|
||||
}
|
||||
case_insensitive_fopen = old_cif;
|
||||
|
||||
efi_chainload_file(config, cmdline, image);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
noreturn void chainload_next(char *config, char *cmdline) {
|
||||
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++) {
|
||||
struct volume *v = volume_get_by_coord(false, i, 0);
|
||||
if (v == NULL) {
|
||||
if (wrap) {
|
||||
i = 0;
|
||||
continue;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
try(config, cmdline, v);
|
||||
}
|
||||
|
||||
wrap = false;
|
||||
for (int i = boot_volume->is_optical ? (wrap = true, boot_volume->index + 1) : 0;
|
||||
boot_volume->is_optical ? i != boot_volume->index : true; i++) {
|
||||
struct volume *v = volume_get_by_coord(true, i, 0);
|
||||
if (v == NULL) {
|
||||
if (wrap) {
|
||||
i = 0;
|
||||
continue;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
try(config, cmdline, v);
|
||||
}
|
||||
|
||||
panic(true, "chainload_next: No other bootable device");
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
#ifndef PROTOS__CHAINLOAD_NEXT_H__
|
||||
#define PROTOS__CHAINLOAD_NEXT_H__
|
||||
|
||||
#include <stdnoreturn.h>
|
||||
|
||||
noreturn void chainload_next(char *config, char *cmdline);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user