diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2015-10-15 19:27:31 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2015-10-15 19:27:31 +0000 |
commit | 9ddda8ba3c731091bbe551dd4efed7adb7a03467 (patch) | |
tree | 9ab07957e480b0290cbf305b6072590b319c775f /usr.sbin | |
parent | db0b7debb73b2751618f37693de1ca38fa18bd4b (diff) |
Add an extra argument to bootstrap() to allow for a limited overlap between an
existing partition and the boot blocks span, and update all callers to require
an overlap limit of zero sectors (thus not changing their behaviour).
Then, add proper support for vax: copy the 2nd-stage boot block to /boot and
install the 1st-stage boot block at the beginning of the disk, retaining the
disklabel; allow for an overlap of up to 16 sectors, which is perfectly fine
as long as your `a' partition is FFS.
Note that regular installs will not even have such an overlap, because the
default OpenBSD span on a disk on vax starts at sector 16, but installation
media use sperific layout which require this.
ok krw@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/installboot/bootstrap.c | 6 | ||||
-rw-r--r-- | usr.sbin/installboot/hppa64_installboot.c | 4 | ||||
-rw-r--r-- | usr.sbin/installboot/hppa_installboot.c | 4 | ||||
-rw-r--r-- | usr.sbin/installboot/installboot.h | 4 | ||||
-rw-r--r-- | usr.sbin/installboot/landisk_installboot.c | 4 | ||||
-rw-r--r-- | usr.sbin/installboot/vax_installboot.c | 23 |
6 files changed, 31 insertions, 14 deletions
diff --git a/usr.sbin/installboot/bootstrap.c b/usr.sbin/installboot/bootstrap.c index c2c6ec3cd01..adabff3767a 100644 --- a/usr.sbin/installboot/bootstrap.c +++ b/usr.sbin/installboot/bootstrap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bootstrap.c,v 1.6 2015/01/16 00:05:12 deraadt Exp $ */ +/* $OpenBSD: bootstrap.c,v 1.7 2015/10/15 19:27:30 miod Exp $ */ /* * Copyright (c) 2013 Joel Sing <jsing@openbsd.org> @@ -32,7 +32,7 @@ #include "installboot.h" void -bootstrap(int devfd, char *dev, char *bootfile) +bootstrap(int devfd, char *dev, char *bootfile, unsigned int overlap_allowance) { struct disklabel dl; struct disklabel *lp; @@ -92,7 +92,7 @@ bootstrap(int devfd, char *dev, char *bootfile) continue; if (DL_GETPSIZE(pp) == 0) continue; - if ((u_int64_t)bootsec <= DL_GETPOFFSET(pp)) + if ((u_int64_t)bootsec <= DL_GETPOFFSET(pp) + overlap_allowance) continue; switch (pp->p_fstype) { case FS_BOOT: diff --git a/usr.sbin/installboot/hppa64_installboot.c b/usr.sbin/installboot/hppa64_installboot.c index 88daf94d901..c23baa0a3a6 100644 --- a/usr.sbin/installboot/hppa64_installboot.c +++ b/usr.sbin/installboot/hppa64_installboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hppa64_installboot.c,v 1.1 2014/01/19 02:58:50 jsing Exp $ */ +/* $OpenBSD: hppa64_installboot.c,v 1.2 2015/10/15 19:27:30 miod Exp $ */ /* * Copyright (c) 2013 Joel Sing <jsing@openbsd.org> @@ -33,5 +33,5 @@ md_loadboot(void) void md_installboot(int devfd, char *dev) { - bootstrap(devfd, dev, stage1); + bootstrap(devfd, dev, stage1, 0); } diff --git a/usr.sbin/installboot/hppa_installboot.c b/usr.sbin/installboot/hppa_installboot.c index 27af0fa0cbd..1568e07658e 100644 --- a/usr.sbin/installboot/hppa_installboot.c +++ b/usr.sbin/installboot/hppa_installboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hppa_installboot.c,v 1.1 2014/01/19 02:58:50 jsing Exp $ */ +/* $OpenBSD: hppa_installboot.c,v 1.2 2015/10/15 19:27:30 miod Exp $ */ /* * Copyright (c) 2013 Joel Sing <jsing@openbsd.org> @@ -33,5 +33,5 @@ md_loadboot(void) void md_installboot(int devfd, char *dev) { - bootstrap(devfd, dev, stage1); + bootstrap(devfd, dev, stage1, 0); } diff --git a/usr.sbin/installboot/installboot.h b/usr.sbin/installboot/installboot.h index 996a574dcc9..114fa590423 100644 --- a/usr.sbin/installboot/installboot.h +++ b/usr.sbin/installboot/installboot.h @@ -1,4 +1,4 @@ -/* $OpenBSD: installboot.h,v 1.9 2015/10/15 04:41:09 deraadt Exp $ */ +/* $OpenBSD: installboot.h,v 1.10 2015/10/15 19:27:30 miod Exp $ */ /* * Copyright (c) 2012, 2013 Joel Sing <jsing@openbsd.org> * @@ -26,7 +26,7 @@ extern char *stage1; extern char *stage2; #ifdef BOOTSTRAP -void bootstrap(int, char *, char *); +void bootstrap(int, char *, char *, unsigned int); #endif int filecopy(const char *, const char *); diff --git a/usr.sbin/installboot/landisk_installboot.c b/usr.sbin/installboot/landisk_installboot.c index 2a613f176c6..a8de186a41f 100644 --- a/usr.sbin/installboot/landisk_installboot.c +++ b/usr.sbin/installboot/landisk_installboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: landisk_installboot.c,v 1.4 2015/10/11 15:36:58 deraadt Exp $ */ +/* $OpenBSD: landisk_installboot.c,v 1.5 2015/10/15 19:27:30 miod Exp $ */ /* * Copyright (c) 2013 Joel Sing <jsing@openbsd.org> @@ -51,5 +51,5 @@ md_installboot(int devfd, char *dev) exit(1); /* Write bootblock into the superblock. */ - bootstrap(devfd, dev, stage1); + bootstrap(devfd, dev, stage1, 0); } diff --git a/usr.sbin/installboot/vax_installboot.c b/usr.sbin/installboot/vax_installboot.c index 1266101d45c..e002a970660 100644 --- a/usr.sbin/installboot/vax_installboot.c +++ b/usr.sbin/installboot/vax_installboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vax_installboot.c,v 1.1 2014/01/19 02:58:50 jsing Exp $ */ +/* $OpenBSD: vax_installboot.c,v 1.2 2015/10/15 19:27:30 miod Exp $ */ /* * Copyright (c) 2013 Joel Sing <jsing@openbsd.org> @@ -16,14 +16,20 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include <stdlib.h> + #include "installboot.h" +char *bootldr; + void md_init(void) { stages = 2; stage1 = "/usr/mdec/xxboot"; - stage2 = "/boot"; + stage2 = "/usr/mdec/boot"; + + bootldr = "/boot"; } void @@ -34,5 +40,16 @@ md_loadboot(void) void md_installboot(int devfd, char *dev) { - bootstrap(devfd, dev, stage1); + /* XXX - is this necessary? */ + sync(); + + bootldr = fileprefix(root, bootldr); + if (bootldr == NULL) + exit(1); + if (!nowrite) + if (filecopy(stage2, bootldr) == -1) + exit(1); + + /* Write bootblock into the superblock. */ + bootstrap(devfd, dev, stage1, 16); } |