Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Sep 2014 17:03:52 +0000 (UTC)
From:      Allan Jude <allanjude@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r271790 - stable/10/usr.sbin/bsdinstall/scripts
Message-ID:  <201409181703.s8IH3qfU047502@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: allanjude (doc committer)
Date: Thu Sep 18 17:03:52 2014
New Revision: 271790
URL: http://svnweb.freebsd.org/changeset/base/271790

Log:
  MFC r271563:
  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:	re (gjb), nwhitehorn
  Sponsored by:	ScaleEngine Inc.

Modified:
  stable/10/usr.sbin/bsdinstall/scripts/zfsboot
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/bsdinstall/scripts/zfsboot
==============================================================================
--- stable/10/usr.sbin/bsdinstall/scripts/zfsboot	Thu Sep 18 17:01:45 2014	(r271789)
+++ stable/10/usr.sbin/bsdinstall/scripts/zfsboot	Thu Sep 18 17:03:52 2014	(r271790)
@@ -293,6 +293,7 @@ msg_swap_mirror_help="Mirror swap partit
 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
@@ -1383,6 +1426,21 @@ f_dprintf "BSDINSTALL_TMPETC=[%s]" "$BSD
 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



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