git: 7b08a307e88b - main - bsdinstall: riscv-specific tweaks

Mitchell Horne mhorne at FreeBSD.org
Wed Jan 27 23:35:48 UTC 2021


The branch main has been updated by mhorne:

URL: https://cgit.FreeBSD.org/src/commit/?id=7b08a307e88bb1abe17d13d11288392a8e4739ce

commit 7b08a307e88bb1abe17d13d11288392a8e4739ce
Author:     Mitchell Horne <mhorne at FreeBSD.org>
AuthorDate: 2021-01-15 16:34:54 +0000
Commit:     Mitchell Horne <mhorne at FreeBSD.org>
CommitDate: 2021-01-27 23:29:42 +0000

    bsdinstall: riscv-specific tweaks
    
    Make the installer more useful, by allowing it to create a bootable
    installation. Also, enable the menu option for ZFS-on-root.
    
    Like arm64, RISC-V boots by UEFI only, so arm64's partedit
    implementation is renamed and shared among the two platforms.
    
    Reviewed by:    gjb
    MFC after:      5 days
    Differential Revision:  https://reviews.freebsd.org/D28180
---
 usr.sbin/bsdinstall/partedit/Makefile                             | 2 ++
 usr.sbin/bsdinstall/partedit/{partedit_arm64.c => partedit_efi.c} | 7 ++++++-
 usr.sbin/bsdinstall/scripts/auto                                  | 2 +-
 usr.sbin/bsdinstall/scripts/bootconfig                            | 3 ++-
 usr.sbin/bsdinstall/scripts/zfsboot                               | 4 ++--
 5 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/usr.sbin/bsdinstall/partedit/Makefile b/usr.sbin/bsdinstall/partedit/Makefile
index 7d8f0659da25..a250302a1962 100644
--- a/usr.sbin/bsdinstall/partedit/Makefile
+++ b/usr.sbin/bsdinstall/partedit/Makefile
@@ -10,6 +10,8 @@ LIBADD+=	geom ncursesw util dialog m
 PARTEDIT_ARCH= ${MACHINE}
 .if ${MACHINE} == "i386" || ${MACHINE} == "amd64"
 PARTEDIT_ARCH= x86
+.elif ${MACHINE} == "arm64" || ${MACHINE} == "riscv"
+PARTEDIT_ARCH= efi
 .endif
 .if !exists(partedit_${PARTEDIT_ARCH}.c)
 PARTEDIT_ARCH= generic
diff --git a/usr.sbin/bsdinstall/partedit/partedit_arm64.c b/usr.sbin/bsdinstall/partedit/partedit_efi.c
similarity index 92%
rename from usr.sbin/bsdinstall/partedit/partedit_arm64.c
rename to usr.sbin/bsdinstall/partedit/partedit_efi.c
index 934cd30c72f9..85b3b15d1853 100644
--- a/usr.sbin/bsdinstall/partedit/partedit_arm64.c
+++ b/usr.sbin/bsdinstall/partedit/partedit_efi.c
@@ -34,6 +34,11 @@
 
 #include "partedit.h"
 
+/*
+ * partedit implementation for platforms on which the installer only offers
+ * UEFI-based boot. Currently, this includes arm64 and RISC-V.
+ */
+
 /* EFI partition size in bytes */
 #define	EFI_BOOTPART_SIZE	(260 * 1024 * 1024)
 
@@ -94,7 +99,7 @@ const char *
 partcode_path(const char *part_type, const char *fs_type)
 {
 
-	/* No boot partition data for ARM64 */
+	/* No boot partition data. */
 	return (NULL);
 }
 
diff --git a/usr.sbin/bsdinstall/scripts/auto b/usr.sbin/bsdinstall/scripts/auto
index a58a63f2f70c..58e74acb2d92 100755
--- a/usr.sbin/bsdinstall/scripts/auto
+++ b/usr.sbin/bsdinstall/scripts/auto
@@ -301,7 +301,7 @@ PMODES="
 
 CURARCH=$( uname -m )
 case $CURARCH in
-	amd64|arm64|i386)	# Booting ZFS Supported
+	amd64|arm64|i386|riscv)	# Booting ZFS Supported
 		PMODES="
 			'$msg_auto_zfs' '$msg_auto_zfs_desc' '$msg_auto_zfs_help'
 			$PMODES
diff --git a/usr.sbin/bsdinstall/scripts/bootconfig b/usr.sbin/bsdinstall/scripts/bootconfig
index 1593545a1c2e..f07fb3065c23 100755
--- a/usr.sbin/bsdinstall/scripts/bootconfig
+++ b/usr.sbin/bsdinstall/scripts/bootconfig
@@ -51,7 +51,7 @@ if [ "$(uname -m)" = "amd64" ] || [ "$(uname -m)" = "i386" ]; then
 	X86_BOOTMETHOD=$(sysctl -n machdep.bootmethod)
 fi
 
-if [ "$(uname -m)" = "arm64" ] || [ "$X86_BOOTMETHOD" = "UEFI" ]; then
+if [ "$(uname -m)" = "arm64" ] || [ "$(uname -m)" = "riscv" ] || [ "$X86_BOOTMETHOD" = "UEFI" ]; then
 	UFSBOOT_ESPS=$(cat $TMPDIR/bsdinstall-esps 2>/dev/null)
 	ZFSBOOT_DISKS=$(cat $TMPDIR/bsdinstall-zfsboot 2>/dev/null)
 	num_esps=0
@@ -127,6 +127,7 @@ if [ "$(uname -m)" = "arm64" ] || [ "$X86_BOOTMETHOD" = "UEFI" ]; then
 	case $(uname -m) in
 	    arm64)	ARCHBOOTNAME=aa64 ;;
 	    amd64)	ARCHBOOTNAME=x64 ;;
+	    riscv)	ARCHBOOTNAME=riscv64 ;;
     #	    arm)	ARCHBOOTNAME=arm ;; # No other support for arm install
     #	    i386)	ARCHBOOTNAME=ia32 ;; # no support for this in i386 kernels, rare machines
 	    *)		die "Unsupported arch $(uname -m) for UEFI install"
diff --git a/usr.sbin/bsdinstall/scripts/zfsboot b/usr.sbin/bsdinstall/scripts/zfsboot
index eef482b806c5..33cec0ef9ae9 100755
--- a/usr.sbin/bsdinstall/scripts/zfsboot
+++ b/usr.sbin/bsdinstall/scripts/zfsboot
@@ -1554,8 +1554,8 @@ f_dprintf "FSTAB_FMT=[%s]" "$FSTAB_FMT"
 # Determine default boot type
 #
 case $(uname -m) in
-arm64)
-	# We support only UEFI boot for arm64
+arm64|riscv)
+	# We support only UEFI boot for arm64 and riscv.
 	: ${ZFSBOOT_BOOT_TYPE:=UEFI}
 	: ${ZFSBOOT_PARTITION_SCHEME:=GPT}
 	;;


More information about the dev-commits-src-all mailing list