summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorallanjude <allanjude@FreeBSD.org>2014-09-14 01:57:22 +0000
committerallanjude <allanjude@FreeBSD.org>2014-09-14 01:57:22 +0000
commitcb96a5f02eac7ab02b87d9ca054a0236e7a76c62 (patch)
tree8cf097008aedd238f94cf50879ad862ef6771879 /usr.sbin
parent36b9d96b9212d462aaadce44fe978d69389dbba7 (diff)
downloadFreeBSD-src-cb96a5f02eac7ab02b87d9ca054a0236e7a76c62.zip
FreeBSD-src-cb96a5f02eac7ab02b87d9ca054a0236e7a76c62.tar.gz
Make the root-on-zfs part of the installer warn a user who booted the installer via UEFI that we do not support booting ZFS via UEFI yet
PR: 193595 Approved by: nwhitehorn MFC after: 5 days Sponsored by: ScaleEngine Inc. CR: https://reviews.freebsd.org/D782
Diffstat (limited to 'usr.sbin')
-rwxr-xr-xusr.sbin/bsdinstall/scripts/zfsboot58
1 files changed, 58 insertions, 0 deletions
diff --git a/usr.sbin/bsdinstall/scripts/zfsboot b/usr.sbin/bsdinstall/scripts/zfsboot
index 6833349..d139b77 100755
--- a/usr.sbin/bsdinstall/scripts/zfsboot
+++ b/usr.sbin/bsdinstall/scripts/zfsboot
@@ -293,6 +293,7 @@ msg_swap_mirror_help="Mirror swap partitions for redundancy, breaks crash dumps"
msg_swap_size="Swap Size"
msg_swap_size_help="Customize how much swap space is allocated to each selected disk"
msg_these_disks_are_too_small="These disks are too small given the amount of requested\nswap (%s) and/or geli(8) (%s) partitions, which would\ntake 50%% or more of each of the following selected disk\ndevices (not recommended):\n\n %s\n\nRecommend changing partition size(s) and/or selecting a\ndifferent set of devices."
+msg_uefi_not_supported="The FreeBSD UEFI loader does not currently support booting root-on-ZFS. Your system will need to boot in legacy (CSM) mode.\nDo you want to continue?"
msg_unable_to_get_disk_capacity="Unable to get disk capacity of \`%s'"
msg_unsupported_partition_scheme="%s is an unsupported partition scheme"
msg_user_cancelled="User Cancelled."
@@ -687,6 +688,48 @@ dialog_menu_layout()
return $DIALOG_OK
}
+# dialog_uefi_prompt
+#
+# Confirm that the user wants to continue with the installation on a BIOS
+# system when they have booted with UEFI
+#
+dialog_uefi_prompt()
+{
+ local title="$DIALOG_TITLE"
+ local btitle="$DIALOG_BACKTITLE"
+ local prompt # Calculated below
+ local hline="$hline_arrows_tab_enter"
+
+ local height=8 width=50 prefix=" "
+ local plen=${#prefix} list= line=
+ local max_width=$(( $width - 3 - $plen ))
+
+ local yes no defaultno extra_args format
+ if [ "$USE_XDIALOG" ]; then
+ yes=ok no=cancel defaultno=default-no
+ extra_args="--wrap --left"
+ format="$msg_uefi_not_supported"
+ else
+ yes=yes no=no defaultno=defaultno
+ extra_args="--cr-wrap"
+ format="$msg_uefi_not_supported"
+ fi
+
+ # Add height for Xdialog(1)
+ [ "$USE_XDIALOG" ] && height=$(( $height + $height / 5 + 3 ))
+
+ prompt=$( printf "$format" )
+ f_dprintf "%s: UEFI prompt" "$0"
+ $DIALOG \
+ --title "$title" \
+ --backtitle "$btitle" \
+ --hline "$hline" \
+ --$yes-label "$msg_yes" \
+ --$no-label "$msg_no" \
+ $extra_args \
+ --yesno "$prompt" $height $width
+}
+
# zfs_create_diskpart $disk $index
#
# For each block device to be used in the zpool, rather than just create the
@@ -1384,6 +1427,21 @@ f_dprintf "BSDINSTALL_TMPETC=[%s]" "$BSDINSTALL_TMPETC"
f_dprintf "FSTAB_FMT=[%s]" "$FSTAB_FMT"
#
+# If the system was booted with UEFI, warn the user that FreeBSD can't do
+# ZFS with UEFI yet
+#
+if f_interactive; then
+ bootmethod=$(sysctl -n machdep.bootmethod)
+ f_dprintf "machdep.bootmethod=[%s]" "$bootmethod"
+ if [ "$bootmethod" != "BIOS" ]; then
+ dialog_uefi_prompt
+ retval=$?
+ f_dprintf "uefi_prompt=[%s]" "$retval"
+ [ $retval -eq $DIALOG_OK ] || f_die
+ fi
+fi
+
+#
# Loop over the main menu until we've accomplished what we came here to do
#
while :; do
OpenPOWER on IntegriCloud