chainload: Assume boot drive if DRIVE parameter is omitted
This commit is contained in:
parent
69529b1269
commit
3fa7d9d1fa
|
@ -123,8 +123,8 @@ Some keys take *URIs* as values; these are described in the next section.
|
|||
* `KASLR` - For relocatable kernels, if set to `no`, disable kernel address space layout randomisation. KASLR is enabled by default.
|
||||
* `TEXTMODE` - If set to `yes`, prefer text mode if the kernel has no video mode requirements. (Only for stivale2)
|
||||
* Chainload protocol on BIOS:
|
||||
* `DRIVE` - The 1-based BIOS drive to chainload.
|
||||
* `PARTITION` - The 1-based BIOS partition to chainload, if omitted, chainload drive.
|
||||
* `DRIVE` - The 1-based BIOS drive to chainload, if omitted, assume boot drive.
|
||||
* `PARTITION` - The 1-based BIOS partition to chainload, if omitted, chainload drive (MBR).
|
||||
* Chainload protocol on UEFI:
|
||||
* `IMAGE_PATH` - URI of the EFI application to chainload.
|
||||
* `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.
|
||||
|
|
|
@ -87,20 +87,21 @@ void chainload(char *config) {
|
|||
int drive; {
|
||||
char *drive_config = config_get_value(config, 0, "DRIVE");
|
||||
if (drive_config == NULL) {
|
||||
panic(true, "chainload: DRIVE not specified");
|
||||
}
|
||||
drive = boot_volume->index;
|
||||
} else {
|
||||
val = strtoui(drive_config, NULL, 10);
|
||||
if (val < 1 || val > 256) {
|
||||
panic(true, "chainload: BIOS drive number outside range 1-256");
|
||||
}
|
||||
drive = val;
|
||||
}
|
||||
}
|
||||
|
||||
struct volume *p = volume_get_by_coord(false, drive, part);
|
||||
|
||||
size_t rows, cols;
|
||||
init_vga_textmode(&rows, &cols, false);
|
||||
|
||||
struct volume *p = volume_get_by_coord(false, drive, part);
|
||||
|
||||
volume_read(p, (void *)0x7c00, 0, 512);
|
||||
|
||||
spinup(p->drive);
|
||||
|
|
Loading…
Reference in New Issue