Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Feb 2021 14:54:50 GMT
From:      Mitchell Horne <mhorne@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: c415d0df47fc - stable/13 - bsdinstall: riscv-specific tweaks
Message-ID:  <202102011454.111EsoqQ070320@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by mhorne:

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

commit c415d0df47fc4b144c029263fac47ad4df81a803
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2021-01-15 16:34:54 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2021-02-01 14:54:09 +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
    
    (cherry picked from commit 7b08a307e88bb1abe17d13d11288392a8e4739ce)
---
 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}
 	;;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202102011454.111EsoqQ070320>