reuse armv7 installboot for riscv64
authorjsg <jsg@openbsd.org>
Sun, 27 Jun 2021 04:52:01 +0000 (04:52 +0000)
committerjsg <jsg@openbsd.org>
Sun, 27 Jun 2021 04:52:01 +0000 (04:52 +0000)
ok deraadt@

usr.sbin/installboot/Makefile
usr.sbin/installboot/armv7_installboot.c

index 2e81ae5..327f424 100644 (file)
@@ -1,4 +1,4 @@
-#      $OpenBSD: Makefile,v 1.22 2020/07/17 08:03:56 kettenis Exp $
+#      $OpenBSD: Makefile,v 1.23 2021/06/27 04:52:01 jsg Exp $
 
 PROG=          installboot
 SRCS=          installboot.c util.c
@@ -15,7 +15,7 @@ CFLAGS += -DSOFTRAID
 SRCS += i386_installboot.c
 SRCS += i386_nlist.c
 SRCS += i386_softraid.c
-.elif ${MACHINE} == "armv7" || ${MACHINE} == "arm64"
+.elif ${MACHINE} == "armv7" || ${MACHINE} == "arm64" || ${MACHINE} == "riscv64"
 SRCS += armv7_installboot.c
 .elif ${MACHINE} == "hppa"
 CFLAGS += -DBOOTSTRAP
index 0f32884..0c589f1 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: armv7_installboot.c,v 1.9 2021/06/03 13:14:03 deraadt Exp $   */
+/*     $OpenBSD: armv7_installboot.c,v 1.10 2021/06/27 04:52:01 jsg Exp $      */
 /*     $NetBSD: installboot.c,v 1.5 1995/11/17 23:23:50 gwr Exp $ */
 
 /*
@@ -207,7 +207,7 @@ write_filesystem(struct disklabel *dl, char part)
                rslt = -1;
                goto umount;
        }
-#else
+#elif defined(__arm__)
        /*
         * Copy BOOTARM.EFI to /efi/boot/bootarm.efi.
         */
@@ -222,6 +222,21 @@ write_filesystem(struct disklabel *dl, char part)
                rslt = -1;
                goto umount;
        }
+#elif defined(__riscv)
+       /*
+        * Copy BOOTRISCV64.EFI to /efi/boot/bootriscv64.efi.
+        */
+       pathlen = strlen(dst);
+       if (strlcat(dst, "/bootriscv64.efi", sizeof(dst)) >= sizeof(dst)) {
+               rslt = -1;
+               warn("unable to build /bootriscv64.efi path");
+               goto umount;
+       }
+       src = fileprefix(root, "/usr/mdec/BOOTRISCV64.EFI");
+       if (src == NULL) {
+               rslt = -1;
+               goto umount;
+       }
 #endif
        srclen = strlen(src);
        if (verbose)