-/* $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>
#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;
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:
-/* $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>
void
md_installboot(int devfd, char *dev)
{
- bootstrap(devfd, dev, stage1);
+ bootstrap(devfd, dev, stage1, 0);
}
-/* $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>
void
md_installboot(int devfd, char *dev)
{
- bootstrap(devfd, dev, stage1);
+ bootstrap(devfd, dev, stage1, 0);
}
-/* $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>
*
extern char *stage2;
#ifdef BOOTSTRAP
-void bootstrap(int, char *, char *);
+void bootstrap(int, char *, char *, unsigned int);
#endif
int filecopy(const char *, const char *);
-/* $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>
exit(1);
/* Write bootblock into the superblock. */
- bootstrap(devfd, dev, stage1);
+ bootstrap(devfd, dev, stage1, 0);
}
-/* $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>
* 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
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);
}