mirror of
https://github.com/limine-bootloader/limine
synced 2024-12-25 15:26:50 +03:00
Add support for chainloading another bootsector
This commit is contained in:
parent
85a4106691
commit
ed8e7b962b
@ -42,9 +42,9 @@ Some *local assignments* are shared between entries using any *protocol*, while
|
|||||||
* `MODULE_PARTITION` - Partition index of a module.
|
* `MODULE_PARTITION` - Partition index of a module.
|
||||||
* `MODULE_PATH` - The path to a module.
|
* `MODULE_PATH` - The path to a module.
|
||||||
* `MODULE_STRING` - A string to be passed to a module.
|
* `MODULE_STRING` - A string to be passed to a module.
|
||||||
* chainload protocol:
|
* Chainload protocol:
|
||||||
* `DRIVE` - The drive to chainload.
|
* `DRIVE` - The BIOS drive (in decimal) to chainload.
|
||||||
* `PARTITION` - The partition to chainload.
|
* `PARTITION` - The partition index (in decimal) to chainload (if omitted, chainload the drive's bootsector).
|
||||||
|
|
||||||
Note that one can define these 3 variable multiple times to specify multiple modules.
|
Note that one can define these 3 variable multiple times to specify multiple modules.
|
||||||
The entries will be matched in order. E.g.: the 1st partition entry will be matched
|
The entries will be matched in order. E.g.: the 1st partition entry will be matched
|
||||||
|
BIN
qloader2.bin
BIN
qloader2.bin
Binary file not shown.
@ -11,10 +11,11 @@ void chainload(void) {
|
|||||||
int part; {
|
int part; {
|
||||||
char buf[32];
|
char buf[32];
|
||||||
if (!config_get_value(buf, 0, 32, "PARTITION")) {
|
if (!config_get_value(buf, 0, 32, "PARTITION")) {
|
||||||
panic("PARTITION not specified");
|
part = -1;
|
||||||
}
|
} else {
|
||||||
part = (int)strtoui(buf);
|
part = (int)strtoui(buf);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
int drive; {
|
int drive; {
|
||||||
char buf[32];
|
char buf[32];
|
||||||
if (!config_get_value(buf, 0, 32, "DRIVE")) {
|
if (!config_get_value(buf, 0, 32, "DRIVE")) {
|
||||||
@ -25,10 +26,14 @@ void chainload(void) {
|
|||||||
|
|
||||||
deinit_vga_textmode();
|
deinit_vga_textmode();
|
||||||
|
|
||||||
|
if (part != -1) {
|
||||||
struct part p;
|
struct part p;
|
||||||
get_part(&p, drive, part);
|
get_part(&p, drive, part);
|
||||||
|
|
||||||
read_partition(drive, &p, (void *)0x7c00, 0, 512);
|
read_partition(drive, &p, (void *)0x7c00, 0, 512);
|
||||||
|
} else {
|
||||||
|
read(drive, (void *)0x7c00, 0, 512);
|
||||||
|
}
|
||||||
|
|
||||||
asm volatile (
|
asm volatile (
|
||||||
// Jump to real mode
|
// Jump to real mode
|
||||||
|
Loading…
Reference in New Issue
Block a user