mbr: Relax MBR validation requirements. Closes #195

This commit is contained in:
mintsuki 2022-07-16 17:32:27 +02:00
parent 4dc295c9d8
commit ffb4ba6f55
2 changed files with 0 additions and 30 deletions

View File

@ -247,13 +247,6 @@ struct mbr_entry {
bool is_valid_mbr(struct volume *volume) {
// Check if actually valid mbr
uint16_t hint = 0;
volume_read(volume, &hint, 218, sizeof(uint16_t));
if (hint != 0)
return false;
volume_read(volume, &hint, 444, sizeof(uint16_t));
if (hint != 0 && hint != 0x5a5a)
return false;
volume_read(volume, &hint, 510, sizeof(uint16_t));
if (hint != 0xaa55)

View File

@ -615,29 +615,6 @@ int main(int argc, char *argv[]) {
uint8_t hint8 = 0;
uint16_t hint16 = 0;
device_read(&hint16, 218, sizeof(uint16_t));
hint16 = ENDSWAP(hint16);
if (hint16 != 0) {
if (!force_mbr) {
mbr = 0;
} else {
hint16 = 0;
hint16 = ENDSWAP(hint16);
device_write(&hint16, 218, sizeof(uint16_t));
}
}
device_read(&hint16, 444, sizeof(uint16_t));
hint16 = ENDSWAP(hint16);
if (hint16 != 0 && hint16 != 0x5a5a) {
if (!force_mbr) {
mbr = 0;
} else {
hint16 = 0;
hint16 = ENDSWAP(hint16);
device_write(&hint16, 444, sizeof(uint16_t));
}
}
device_read(&hint16, 510, sizeof(uint16_t));
hint16 = ENDSWAP(hint16);