Author: allanjude (doc committer)
Date: Sun Sep 14 01:57:22 2014
New Revision: 271563
URL: http://svnweb.freebsd.org/changeset/base/271563

Log:
  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

Modified:
  head/usr.sbin/bsdinstall/scripts/zfsboot

Modified: head/usr.sbin/bsdinstall/scripts/zfsboot
==============================================================================
--- head/usr.sbin/bsdinstall/scripts/zfsboot    Sun Sep 14 00:02:40 2014        
(r271562)
+++ head/usr.sbin/bsdinstall/scripts/zfsboot    Sun Sep 14 01:57:22 2014        
(r271563)
@@ -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
@@ -1384,6 +1427,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
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to