BootManager: different error when no MBR is found

We were using the same "no space available" message used when the first
partition starts too early. Be more specific here to make it clearer
what the problem is.

Fixes #7087.
This commit is contained in:
Adrien Destugues
2014-11-21 18:14:10 +01:00
parent 1f8b3fdb7e
commit 4011cb5d30
3 changed files with 28 additions and 8 deletions
@@ -297,12 +297,18 @@ BootManagerController::_CreateErrorEntryPage()
{
BString description;
if (fCollectPartitionsStatus == B_PARTITION_TOO_SMALL) {
if (fCollectPartitionsStatus == B_ENTRY_NOT_FOUND) {
description << B_TRANSLATE_COMMENT("Partition table not compatible",
"Title") << "\n\n"
<< B_TRANSLATE("The partition table of the first hard disk is not "
"compatible with Boot Manager.\n"
"Boot Manager needs 2 KB available space before the first "
"Boot Manager only works with IBM PC MBR partitions.");
} else if (fCollectPartitionsStatus == B_PARTITION_TOO_SMALL) {
description << B_TRANSLATE_COMMENT("First partition starts too early",
"Title") << "\n\n"
<< B_TRANSLATE("The first partition on the disk starts too early "
"and does not leave enough space free for a boot menu.\n"
"Boot Manager needs 2 KiB available space before the first "
"partition.");
} else {
description << B_TRANSLATE_COMMENT("Error reading partition table",
+16 -3
View File
@@ -164,9 +164,22 @@ DriveItem::DrawItem(BView* owner, BRect frame, bool complete)
if (fCanBeInstalled != B_OK) {
owner->SetHighColor(140, 0, 0);
owner->MovePenBy(fBaselineOffset, 0);
owner->DrawString(fCanBeInstalled == B_PARTITION_TOO_SMALL
? B_TRANSLATE_COMMENT("No space available!", "Cannot install")
: B_TRANSLATE_COMMENT("Cannot access!", "Cannot install"));
const char* message;
switch (fCanBeInstalled) {
case B_PARTITION_TOO_SMALL:
message = B_TRANSLATE_COMMENT("No space available!",
"Cannot install");
break;
case B_ENTRY_NOT_FOUND:
message = B_TRANSLATE_COMMENT("Incompatible format!",
"Cannot install");
break;
default:
message = B_TRANSLATE_COMMENT("Cannot access!",
"Cannot install");
break;
}
owner->DrawString(message);
}
owner->PopState();
+4 -3
View File
@@ -318,11 +318,12 @@ LegacyBootMenu::CanBeInstalled(const BootDrive& drive)
PartitionVisitor visitor;
device.VisitEachDescendant(&visitor);
if (!visitor.HasPartitions())
return B_ENTRY_NOT_FOUND;
// Enough space to write boot menu to drive?
if (!visitor.HasPartitions()
|| visitor.FirstOffset() < (int)sizeof(kBootLoader)) {
if (visitor.FirstOffset() < (int)sizeof(kBootLoader))
return B_PARTITION_TOO_SMALL;
}
return B_OK;
}