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
This commit is contained in:
Mitchell Horne 2021-01-15 12:34:54 -04:00
parent 676b7d077c
commit 7b08a307e8
5 changed files with 13 additions and 5 deletions

View File

@ -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

View File

@ -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);
}

View File

@ -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

View File

@ -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"

View File

@ -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}
;;