installboot on a softraid volume on a GPT disk currently results in
an error.

  # installboot sd2
  Using / as root
  installing bootstrap on /dev/rsd2c
  using first-stage /usr/mdec/biosboot, second-stage /usr/mdec/boot
  sd2: softraid volume with 1 disk(s)
  sd2: installing boot loader on softraid volume
  /usr/mdec/boot is 5 blocks x 16384 bytes
  sd0d: installing boot blocks on /dev/rsd0c, part offset 1104
  master boot record (MBR) at sector 0
        partition 0: type 0xEE offset 1 size 250069679
  installboot: no OpenBSD partition

With the diff below it seems to do the right thing:

  # installboot sd2
  Using / as root
  installing bootstrap on /dev/rsd2c
  using first-stage /usr/mdec/biosboot, second-stage /usr/mdec/boot
  sd2: softraid volume with 1 disk(s)
  sd2: installing boot loader on softraid volume
  /usr/mdec/boot is 5 blocks x 16384 bytes
  copying /usr/mdec/BOOTIA32.EFI to 
/tmp/installboot.LYvsXAQ7uK/efi/BOOT/BOOTIA32.EFI
  copying /usr/mdec/BOOTX64.EFI to 
/tmp/installboot.LYvsXAQ7uK/efi/BOOT/BOOTX64.EFI

Index: i386_installboot.c
===================================================================
RCS file: /cvs/src/usr.sbin/installboot/i386_installboot.c,v
retrieving revision 1.14
diff -u -p -r1.14 i386_installboot.c
--- i386_installboot.c  18 Oct 2015 17:24:25 -0000      1.14
+++ i386_installboot.c  25 Oct 2015 17:44:14 -0000
@@ -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];
Index: i386_installboot.h
===================================================================
RCS file: /cvs/src/usr.sbin/installboot/i386_installboot.h,v
retrieving revision 1.3
diff -u -p -r1.3 i386_installboot.h
--- i386_installboot.h  7 Oct 2015 03:06:46 -0000       1.3
+++ i386_installboot.h  25 Oct 2015 17:44:14 -0000
@@ -55,4 +55,5 @@ int   nlist_elf32(const char *, struct nli
 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);
Index: i386_softraid.c
===================================================================
RCS file: /cvs/src/usr.sbin/installboot/i386_softraid.c,v
retrieving revision 1.4
diff -u -p -r1.4 i386_softraid.c
--- i386_softraid.c     3 Oct 2015 16:56:52 -0000       1.4
+++ i386_softraid.c     25 Oct 2015 17:44:14 -0000
@@ -87,6 +87,12 @@ sr_install_bootblk(int devfd, int vol, i
        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)

Reply via email to