Added a second pass to the boot device retrieval in case nothing has been found.
Right now, the size of the device is ignored in the second pass. Maybe this helps with bug #357. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16917 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -141,7 +141,7 @@ compute_check_sum(KDiskDevice *device, off_t offset)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
is_boot_device(kernel_args *args, KDiskDevice *device)
|
is_boot_device(kernel_args *args, KDiskDevice *device, bool strict)
|
||||||
{
|
{
|
||||||
disk_identifier &disk = args->boot_disk.identifier;
|
disk_identifier &disk = args->boot_disk.identifier;
|
||||||
|
|
||||||
@@ -163,7 +163,8 @@ is_boot_device(kernel_args *args, KDiskDevice *device)
|
|||||||
switch (disk.device_type) {
|
switch (disk.device_type) {
|
||||||
case UNKNOWN_DEVICE:
|
case UNKNOWN_DEVICE:
|
||||||
// test if the size of the device matches
|
// test if the size of the device matches
|
||||||
if (device->Size() != disk.device.unknown.size)
|
// (the BIOS might have given us the wrong value here, though)
|
||||||
|
if (strict && device->Size() != disk.device.unknown.size)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// check if the check sums match, too
|
// check if the check sums match, too
|
||||||
@@ -250,16 +251,26 @@ get_boot_partitions(kernel_args *args, PartitionStack &partitions)
|
|||||||
PartitionStack &fPartitions;
|
PartitionStack &fPartitions;
|
||||||
} visitor(*args, partitions);
|
} visitor(*args, partitions);
|
||||||
|
|
||||||
|
bool strict = true;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
KDiskDevice *device;
|
KDiskDevice *device;
|
||||||
int32 cookie = 0;
|
int32 cookie = 0;
|
||||||
while ((device = manager->NextDevice(&cookie)) != NULL) {
|
while ((device = manager->NextDevice(&cookie)) != NULL) {
|
||||||
if (!is_boot_device(args, device))
|
if (!is_boot_device(args, device, strict))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (device->VisitEachDescendant(&visitor) != NULL)
|
if (device->VisitEachDescendant(&visitor) != NULL)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!partitions.IsEmpty() || !strict)
|
||||||
|
break;
|
||||||
|
|
||||||
|
// we couldn't find any potential boot devices, try again less strict
|
||||||
|
strict = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!args->boot_disk.user_selected) {
|
if (!args->boot_disk.user_selected) {
|
||||||
// sort partition list (ie. when booting from CD, CDs should come first in the list)
|
// sort partition list (ie. when booting from CD, CDs should come first in the list)
|
||||||
qsort(partitions.Array(), partitions.CountItems(), sizeof(KPartition *),
|
qsort(partitions.Array(), partitions.CountItems(), sizeof(KPartition *),
|
||||||
|
|||||||
Reference in New Issue
Block a user