loader: load all available file/partitioning system modules.

* This fixes booting on virtualbox with UEFI, where it
  fails to identify CDs as BOOT_METHOD_CD, such that the
  write_overlay driver doesn't get loaded, causing a
  panic in the kernel trying to mount the boot device.

Change-Id: I1f23b4c4195668752357735368f4668b73f75980
This commit is contained in:
Jessica Hamilton 2019-04-25 05:08:22 +00:00
parent 0f00993773
commit bab060e9dd

View File

@ -258,31 +258,11 @@ load_modules(stage2_args* args, BootVolume& volume)
}
// and now load all partitioning and file system modules
// needed to identify the boot volume
if (!gBootVolume.GetBool(BOOT_VOLUME_BOOTED_FROM_IMAGE, false)
&& gBootVolume.GetInt32(BOOT_METHOD, BOOT_METHOD_DEFAULT)
!= BOOT_METHOD_CD) {
// iterate over the mounted volumes and load their file system
Partition *partition;
if (gRoot->GetPartitionFor(volume.RootDirectory(), &partition)
== B_OK) {
while (partition != NULL) {
load_module(volume, partition->ModuleName());
partition = partition->Parent();
}
}
} else {
// The boot image should only contain the file system
// needed to boot the system, so we just load it.
// ToDo: this is separate from the fall back from above
// as this piece will survive a more intelligent module
// loading approach...
char path[B_FILE_NAME_LENGTH];
snprintf(path, sizeof(path), "%s/%s", sAddonPaths[0], "file_systems");
load_modules_from(volume, path);
}
char path[B_FILE_NAME_LENGTH];
snprintf(path, sizeof(path), "%s/%s", sAddonPaths[0], "file_systems");
load_modules_from(volume, path);
snprintf(path, sizeof(path), "%s/%s", sAddonPaths[0], "partitioning_systems");
load_modules_from(volume, path);
return B_OK;
}