From 76ca98339d0b98f4f3c17c510ddcf134bb001cab Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sun, 3 Jul 2011 11:24:56 +0200 Subject: [PATCH] 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. --- src/system/kernel/fs/vfs_boot.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/system/kernel/fs/vfs_boot.cpp b/src/system/kernel/fs/vfs_boot.cpp index cd1e681327..f7657ab45d 100644 --- a/src/system/kernel/fs/vfs_boot.cpp +++ b/src/system/kernel/fs/vfs_boot.cpp @@ -469,6 +469,8 @@ vfs_mount_boot_file_system(kernel_args* args) panic("did not find any boot partitions!"); } + dev_t bootDevice = -1; + KPartition* bootPartition; while (partitions.Pop(&bootPartition)) { KPath path; @@ -487,21 +489,22 @@ vfs_mount_boot_file_system(kernel_args* args) } 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()); gReadOnlyBootDevice = readOnly; break; } } - if (gBootDevice < B_OK) + if (bootDevice < B_OK) panic("could not mount boot device!\n"); // create link for the name of the boot device 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]; 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 // 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,