diff options
author | 2016-09-01 16:14:51 +0000 | |
---|---|---|
committer | 2016-09-01 16:14:51 +0000 | |
commit | 4aa298a1bc9cfebe452331decc8cd9adcb51c968 (patch) | |
tree | b0ab4b77b08918b845eafee2904c905a280f002e | |
parent | The fork+exec diff broke "what?!", the ps_what field determines the (diff) | |
download | wireguard-openbsd-4aa298a1bc9cfebe452331decc8cd9adcb51c968.tar.xz wireguard-openbsd-4aa298a1bc9cfebe452331decc8cd9adcb51c968.zip |
EFI firmware has been encountered that is (from our point of view) confused
about the disk size. Making the protective MBR created by fdisk invalid as
fdisk used the 'correct' disk size.
So just do what MS does and put UINT32_MAX into the EE partition size field,
no matter what the disk size is. Lets tom@'s Dell boot.
ok kettenis@ tom@
-rw-r--r-- | sbin/fdisk/mbr.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/sbin/fdisk/mbr.c b/sbin/fdisk/mbr.c index 6af58f5dcf0..37faae048f1 100644 --- a/sbin/fdisk/mbr.c +++ b/sbin/fdisk/mbr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mbr.c,v 1.65 2015/12/30 17:21:39 krw Exp $ */ +/* $OpenBSD: mbr.c,v 1.66 2016/09/01 16:14:51 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -60,13 +60,16 @@ MBR_init_GPT(struct mbr *mbr) memset(&mbr->part, 0, sizeof(mbr->part)); - /* Use whole disk, starting after MBR. */ + /* Use whole disk, starting after MBR. + * + * Always set the partition size to UINT32_MAX (as MS does). EFI + * firmware has been encountered that lies in unpredictable ways + * about the size of the disk, thus making it impossible to boot + * such devices. + */ mbr->part[0].id = DOSPTYP_EFI; mbr->part[0].bs = 1; - if (sz > UINT32_MAX) - mbr->part[0].ns = UINT32_MAX; - else - mbr->part[0].ns = sz - 1; + mbr->part[0].ns = UINT32_MAX; /* Fix up start/length fields. */ PRT_fix_CHS(&mbr->part[0]); |