diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2011-07-05 18:34:11 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2011-07-05 18:34:11 +0000 |
commit | a0e2c3ceda584c5abcc43c59b8b6926c767747d1 (patch) | |
tree | 76289b9afeaf62655931c07f51e71260670db12c /sys | |
parent | 24e606317be93cd6904cbc21866009dc7aa1e954 (diff) |
Don't write /boot to sector 0 on non-floppy devices. Non-floppy
devices must have an OpenBSD MBR partition to install /boot into.
But search anything except floppy devices (e.g. vnd) for such a
partition.
Feedback & ok deraadt@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/amd64/stand/installboot/installboot.c | 10 | ||||
-rw-r--r-- | sys/arch/i386/stand/installboot/installboot.c | 10 |
2 files changed, 12 insertions, 8 deletions
diff --git a/sys/arch/amd64/stand/installboot/installboot.c b/sys/arch/amd64/stand/installboot/installboot.c index 1877b07bbdd..0434eeed25a 100644 --- a/sys/arch/amd64/stand/installboot/installboot.c +++ b/sys/arch/amd64/stand/installboot/installboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: installboot.c,v 1.21 2011/07/05 17:38:54 krw Exp $ */ +/* $OpenBSD: installboot.c,v 1.22 2011/07/05 18:34:10 krw Exp $ */ /* $NetBSD: installboot.c,v 1.5 1995/11/17 23:23:50 gwr Exp $ */ /* @@ -233,9 +233,11 @@ write_bootblocks(int devfd, struct disklabel *dl) sync(); sleep(1); } - if (dl->d_type != 0 && dl->d_type != DTYPE_FLOPPY && - dl->d_type != DTYPE_VND) { - /* Find OpenBSD partition. */ + /* + * Find OpenBSD partition. Floppies are special, getting an + * everything-in-one /boot starting at sector 0. + */ + if (dl->d_type != DTYPE_FLOPPY) { start = findopenbsd(devfd, dl); if (start == (u_int)-1) errx(1, "no OpenBSD partition"); diff --git a/sys/arch/i386/stand/installboot/installboot.c b/sys/arch/i386/stand/installboot/installboot.c index cf43ed3a60e..5beecb783f3 100644 --- a/sys/arch/i386/stand/installboot/installboot.c +++ b/sys/arch/i386/stand/installboot/installboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: installboot.c,v 1.64 2011/07/05 17:38:54 krw Exp $ */ +/* $OpenBSD: installboot.c,v 1.65 2011/07/05 18:34:10 krw Exp $ */ /* $NetBSD: installboot.c,v 1.5 1995/11/17 23:23:50 gwr Exp $ */ /* @@ -229,9 +229,11 @@ write_bootblocks(int devfd, struct disklabel *dl) sync(); sleep(1); } - if (dl->d_type != 0 && dl->d_type != DTYPE_FLOPPY && - dl->d_type != DTYPE_VND) { - /* Find OpenBSD partition. */ + /* + * Find OpenBSD partition. Floppies are special, getting an + * everything-in-one /boot starting at sector 0. + */ + if (dl->d_type != DTYPE_FLOPPY) { start = findopenbsd(devfd, dl); if (start == (u_int)-1) errx(1, "no OpenBSD partition"); |