summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Sperling <stsp@cvs.openbsd.org>2015-10-25 21:21:16 +0000
committerStefan Sperling <stsp@cvs.openbsd.org>2015-10-25 21:21:16 +0000
commit46f9eb587558159280e866cdf87be2671d347387 (patch)
tree2e2f0056af8b8cd36819c8e65ac59f49874ae6a1
parent4de863f9ffcc7109cab38b676da78eaccd6d443b (diff)
Fix installboot(8) on i386/amd64 when softraid is on top of GPT.
ok krw deraadt
-rw-r--r--usr.sbin/installboot/i386_installboot.c5
-rw-r--r--usr.sbin/installboot/i386_installboot.h3
-rw-r--r--usr.sbin/installboot/i386_softraid.c8
3 files changed, 11 insertions, 5 deletions
diff --git a/usr.sbin/installboot/i386_installboot.c b/usr.sbin/installboot/i386_installboot.c
index 0369cb9515c..be0f42c6fc2 100644
--- a/usr.sbin/installboot/i386_installboot.c
+++ b/usr.sbin/installboot/i386_installboot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: i386_installboot.c,v 1.14 2015/10/18 17:24:25 rpe Exp $ */
+/* $OpenBSD: i386_installboot.c,v 1.15 2015/10/25 21:21:15 stsp Exp $ */
/* $NetBSD: installboot.c,v 1.5 1995/11/17 23:23:50 gwr Exp $ */
/*
@@ -88,7 +88,6 @@ struct sym_data pbr_symbols[] = {
static void devread(int, void *, daddr_t, size_t, char *);
static u_int findopenbsd(int, struct disklabel *);
-static int findgptefisys(int, struct disklabel *);
static int getbootparams(char *, int, struct disklabel *);
static char *loadproto(char *, long *);
@@ -448,7 +447,7 @@ again:
return ((u_int)-1);
}
-static int
+int
findgptefisys(int devfd, struct disklabel *dl)
{
struct gpt_partition gp[NGPTPARTITIONS];
diff --git a/usr.sbin/installboot/i386_installboot.h b/usr.sbin/installboot/i386_installboot.h
index fcb09f772a3..315e19279af 100644
--- a/usr.sbin/installboot/i386_installboot.h
+++ b/usr.sbin/installboot/i386_installboot.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: i386_installboot.h,v 1.3 2015/10/07 03:06:46 krw Exp $ */
+/* $OpenBSD: i386_installboot.h,v 1.4 2015/10/25 21:21:15 stsp Exp $ */
/*
* Copyright (c) 2011 Joel Sing <jsing@openbsd.org>
* Copyright (c) 2010 Otto Moerbeek <otto@openbsd.org>
@@ -55,4 +55,5 @@ int nlist_elf32(const char *, struct nlist *);
void pbr_set_symbols(char *, char *, struct sym_data *);
void sym_set_value(struct sym_data *, char *, u_int32_t);
void write_bootblocks(int, char *, struct disklabel *);
+int findgptefisys(int, struct disklabel *);
void write_efisystem(struct disklabel *, char);
diff --git a/usr.sbin/installboot/i386_softraid.c b/usr.sbin/installboot/i386_softraid.c
index 9a943c99aee..ff3d10c41b6 100644
--- a/usr.sbin/installboot/i386_softraid.c
+++ b/usr.sbin/installboot/i386_softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: i386_softraid.c,v 1.4 2015/10/03 16:56:52 krw Exp $ */
+/* $OpenBSD: i386_softraid.c,v 1.5 2015/10/25 21:21:15 stsp Exp $ */
/*
* Copyright (c) 2012 Joel Sing <jsing@openbsd.org>
*
@@ -87,6 +87,12 @@ sr_install_bootblk(int devfd, int vol, int disk)
if (dl.d_type == 0)
warnx("disklabel type unknown");
+ part = findgptefisys(diskfd, &dl);
+ if (part != -1) {
+ write_efisystem(&dl, (char)part);
+ return;
+ }
+
/* Determine poffset and set symbol value. */
pp = &dl.d_partitions[part - 'a'];
if (pp->p_offseth != 0)