This makes the installer use installboot(8) on riscv64.

OK?

Index: riscv64/ramdisk/install.md
===================================================================
RCS file: src/distrib/riscv64/ramdisk/install.md,v
retrieving revision 1.3
diff -u -p -r1.3 install.md
--- riscv64/ramdisk/install.md  2 Aug 2021 21:46:39 -0000       1.3
+++ riscv64/ramdisk/install.md  1 Feb 2022 15:56:06 -0000
@@ -33,15 +33,19 @@
 #
 
 NCPU=$(sysctl -n hw.ncpufound)
-NEWFSARGS_msdos="-F 16 -L boot"
 MOUNT_ARGS_msdos="-o-l"
 
 md_installboot() {
        local _disk=/dev/$1
 
+       if ! installboot -r /mnt ${1}; then
+               echo "\nFailed to install bootblocks."
+               echo "You will not be able to boot OpenBSD from ${1}."
+               exit
+       fi
+
+       # Mount MSDOS partition to do some final tweaks
        mount ${MOUNT_ARGS_msdos} ${_disk}i /mnt/mnt
-       mkdir -p /mnt/mnt/efi/boot
-       cp /mnt/usr/mdec/BOOTRISCV64.EFI /mnt/mnt/efi/boot/bootriscv64.efi
        echo bootriscv64.efi > /mnt/mnt/efi/boot/startup.nsh
 }
 
@@ -53,7 +57,6 @@ md_prep_fdisk() {
        local bootsectorsize="32768"
        local bootsectorend=$(($bootsectorstart + $bootsectorsize))
        local bootfstype="msdos"
-       local newfs_args=${NEWFSARGS_msdos}
 
        while :; do
                _d=whole
@@ -83,8 +86,7 @@ write
 quit
 __EOT
                        echo "done."
-                       disklabel $_disk 2>/dev/null | grep -q "^  i:" || 
disklabel -w -d $_disk
-                       newfs -t ${bootfstype} ${newfs_args} ${_disk}i
+                       installboot -p $_disk
                        return ;;
                [eE]*)
                        # Manually configure the MBR.
Index: riscv64/ramdisk/list
===================================================================
RCS file: src/distrib/riscv64/ramdisk/list,v
retrieving revision 1.5
diff -u -p -r1.5 list
--- riscv64/ramdisk/list        4 Oct 2021 01:34:29 -0000       1.5
+++ riscv64/ramdisk/list        1 Feb 2022 15:56:06 -0000
@@ -62,6 +62,7 @@ LINK  instbin                                 usr/bin/sed
 LINK   instbin                                 usr/bin/signify
 LINK   instbin                                 usr/bin/tee
 LINK   instbin                                 usr/sbin/chroot
+LINK   instbin                                 usr/sbin/installboot
 LINK   instbin                                 usr/sbin/pwd_mkdb
 ARGVLINK ksh                                   -sh
 SPECIAL        rm bin/md5
Index: special/installboot/Makefile
===================================================================
RCS file: src/distrib/special/installboot/Makefile,v
retrieving revision 1.14
diff -u -p -r1.14 Makefile
--- special/installboot/Makefile        20 Jul 2020 14:55:43 -0000      1.14
+++ special/installboot/Makefile        1 Feb 2022 15:56:06 -0000
@@ -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

Reply via email to