misc: Warn about missing limine.sys only when necessary

This commit is contained in:
mintsuki 2021-03-21 09:44:07 +01:00
parent eaeab80c4a
commit 04bef1ce1a
1 changed files with 9 additions and 3 deletions

View File

@ -29,6 +29,7 @@ struct volume *boot_volume;
#if defined (bios)
bool stage3_loaded = false;
static bool stage3_found = false;
extern symbol stage3_addr;
extern symbol limine_sys_size;
@ -38,12 +39,11 @@ static bool stage3_init(struct volume *part) {
if (fopen(&stage3, part, "/limine.sys")
&& fopen(&stage3, part, "/boot/limine.sys")) {
print("Stage 3 file not found!\n"
"Have you copied limine.sys to the root or /boot directories of\n"
"one of the partitions on the boot device?\n");
return false;
}
stage3_found = true;
if (stage3.size != (size_t)limine_sys_size) {
print("limine.sys size incorrect.\n");
return false;
@ -98,6 +98,12 @@ void entry(uint8_t boot_drive, int boot_from) {
}
);
if (!stage3_found)
print("\n"
"!! Stage 3 file not found!\n"
"!! Have you copied limine.sys to the root or /boot directories of\n"
"!! one of the partitions on the boot device?\n\n");
if (!stage3_loaded)
panic("Failed to load stage 3.");