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_PATH` - The path to a module.
|
||||
* `MODULE_STRING` - A string to be passed to a module.
|
||||
* chainload protocol:
|
||||
* `DRIVE` - The drive to chainload.
|
||||
* `PARTITION` - The partition to chainload.
|
||||
* Chainload protocol:
|
||||
* `DRIVE` - The BIOS drive (in decimal) 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.
|
||||
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,9 +11,10 @@ void chainload(void) {
|
|||
int part; {
|
||||
char buf[32];
|
||||
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; {
|
||||
char buf[32];
|
||||
|
@ -25,10 +26,14 @@ void chainload(void) {
|
|||
|
||||
deinit_vga_textmode();
|
||||
|
||||
struct part p;
|
||||
get_part(&p, drive, part);
|
||||
if (part != -1) {
|
||||
struct part p;
|
||||
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 (
|
||||
// Jump to real mode
|
||||
|
|
Loading…
Reference in New Issue