Postpone setting gBootDevice until after packagefs

The modules code uses gBootDevice as an indicator that modules can be
loaded from the boot volume. This is not the case until packagefs has
been mounted, though, so we postpone setting gBootDevice.
This commit is contained in:
Ingo Weinhold
2011-07-17 16:55:00 +02:00
parent 718fba99c8
commit 76ca98339d
+10 -4
View File
@@ -469,6 +469,8 @@ vfs_mount_boot_file_system(kernel_args* args)
panic("did not find any boot partitions!"); panic("did not find any boot partitions!");
} }
dev_t bootDevice = -1;
KPartition* bootPartition; KPartition* bootPartition;
while (partitions.Pop(&bootPartition)) { while (partitions.Pop(&bootPartition)) {
KPath path; KPath path;
@@ -487,21 +489,22 @@ vfs_mount_boot_file_system(kernel_args* args)
} }
TRACE(("trying to mount boot partition: %s\n", path.Path())); TRACE(("trying to mount boot partition: %s\n", path.Path()));
gBootDevice = _kern_mount("/boot", path.Path(), fsName, 0, NULL, 0);
if (gBootDevice >= 0) { bootDevice = _kern_mount("/boot", path.Path(), fsName, 0, NULL, 0);
if (bootDevice >= 0) {
dprintf("Mounted boot partition: %s\n", path.Path()); dprintf("Mounted boot partition: %s\n", path.Path());
gReadOnlyBootDevice = readOnly; gReadOnlyBootDevice = readOnly;
break; break;
} }
} }
if (gBootDevice < B_OK) if (bootDevice < B_OK)
panic("could not mount boot device!\n"); panic("could not mount boot device!\n");
// create link for the name of the boot device // create link for the name of the boot device
fs_info info; fs_info info;
if (_kern_read_fs_info(gBootDevice, &info) == B_OK) { if (_kern_read_fs_info(bootDevice, &info) == B_OK) {
char path[B_FILE_NAME_LENGTH + 1]; char path[B_FILE_NAME_LENGTH + 1];
snprintf(path, sizeof(path), "/%s", info.volume_name); snprintf(path, sizeof(path), "/%s", info.volume_name);
@@ -531,6 +534,9 @@ vfs_mount_boot_file_system(kernel_args* args)
} }
} }
// Now that packagefs is mounted, the boot volume is really ready.
gBootDevice = bootDevice;
// Do post-boot-volume module initialization. The module code wants to know // Do post-boot-volume module initialization. The module code wants to know
// whether the module images the boot loader has pre-loaded are the same as // whether the module images the boot loader has pre-loaded are the same as
// on the boot volume. That is the case when booting from hard disk or CD, // on the boot volume. That is the case when booting from hard disk or CD,