| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: md.c,v 1.20.2.7 2020/10/15 19:36:51 bouyer Exp $ */ | | 1 | /* $NetBSD: md.c,v 1.20.2.8 2020/11/04 13:31:23 sborrill Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright 1997 Piermont Information Systems Inc. | | 4 | * Copyright 1997 Piermont Information Systems Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Based on code written by Philip A. Nelson for Piermont Information | | 7 | * Based on code written by Philip A. Nelson for Piermont Information |
8 | * Systems Inc. | | 8 | * Systems Inc. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -563,32 +563,34 @@ md_check_mbr(struct disk_partitions *par | | | @@ -563,32 +563,34 @@ md_check_mbr(struct disk_partitions *par |
563 | | | 563 | |
564 | if ((fl & MBR_BS_EXTLBA) && | | 564 | if ((fl & MBR_BS_EXTLBA) && |
565 | (biosdisk == NULL || !(biosdisk->bi_flags & BIFLAG_EXTINT13))) { | | 565 | (biosdisk == NULL || !(biosdisk->bi_flags & BIFLAG_EXTINT13))) { |
566 | /* Need unsupported LBA reads to read boot sectors */ | | 566 | /* Need unsupported LBA reads to read boot sectors */ |
567 | if (quiet) | | 567 | if (quiet) |
568 | return 0; | | 568 | return 0; |
569 | | | 569 | |
570 | msg_display(MSG_no_extended_bootmenu); | | 570 | msg_display(MSG_no_extended_bootmenu); |
571 | if (!ask_noyes(NULL)) | | 571 | if (!ask_noyes(NULL)) |
572 | return 1; | | 572 | return 1; |
573 | } | | 573 | } |
574 | | | 574 | |
575 | /* Sort out the name of the mbr code we need */ | | 575 | /* Sort out the name of the mbr code we need */ |
576 | if (names > 0 || fl & (NETBSD_NAMED | ACTIVE_NAMED)) { | | 576 | if (names > 1 || |
| | | 577 | (parts->num_part > 1 && (fl & (NETBSD_NAMED | ACTIVE_NAMED)))) { |
577 | /* Need bootselect code */ | | 578 | /* Need bootselect code */ |
578 | fl |= MBR_BS_ACTIVE; | | 579 | fl |= MBR_BS_ACTIVE; |
579 | bootcode = fl & MBR_BS_EXTLBA ? _PATH_BOOTEXT : _PATH_BOOTSEL; | | 580 | bootcode = fl & MBR_BS_EXTLBA ? _PATH_BOOTEXT : _PATH_BOOTSEL; |
580 | } else | | 581 | } else { |
581 | bootcode = _PATH_MBR; | | 582 | bootcode = _PATH_MBR; |
| | | 583 | } |
582 | | | 584 | |
583 | fl &= MBR_BS_ACTIVE | MBR_BS_EXTLBA; | | 585 | fl &= MBR_BS_ACTIVE | MBR_BS_EXTLBA; |
584 | | | 586 | |
585 | /* Look at what is installed */ | | 587 | /* Look at what is installed */ |
586 | ofl = mbri->mbrb.mbrbs_flags; | | 588 | ofl = mbri->mbrb.mbrbs_flags; |
587 | if (ofl == 0) { | | 589 | if (ofl == 0) { |
588 | /* Check there is some bootcode at all... */ | | 590 | /* Check there is some bootcode at all... */ |
589 | if (mbri->mbr.mbr_magic != htole16(MBR_MAGIC) || | | 591 | if (mbri->mbr.mbr_magic != htole16(MBR_MAGIC) || |
590 | mbri->mbr.mbr_jmpboot[0] == 0 || | | 592 | mbri->mbr.mbr_jmpboot[0] == 0 || |
591 | mbr_root_above_chs(inst_start)) | | 593 | mbr_root_above_chs(inst_start)) |
592 | /* Existing won't do, force update */ | | 594 | /* Existing won't do, force update */ |
593 | fl |= MBR_BS_NEWMBR; | | 595 | fl |= MBR_BS_NEWMBR; |
594 | } | | 596 | } |