Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F133137227
D51028.id159129.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
7 KB
Referenced Files
None
Subscribers
None
D51028.id159129.diff
View Options
diff --git a/usr.sbin/bsdinstall/scripts/zfsboot b/usr.sbin/bsdinstall/scripts/zfsboot
--- a/usr.sbin/bsdinstall/scripts/zfsboot
+++ b/usr.sbin/bsdinstall/scripts/zfsboot
@@ -86,7 +86,7 @@
#
# Create a separate boot pool?
-# NB: Automatically set when using geli(8) or MBR
+# NB: Automatically set when using geli(8)
#
: ${ZFSBOOT_BOOT_POOL=}
@@ -96,12 +96,12 @@
: ${ZFSBOOT_BOOT_POOL_CREATE_OPTIONS:=}
#
-# Default name for boot pool when enabled (e.g., geli(8) or MBR)
+# Default name for boot pool when enabled (e.g., geli(8))
#
: ${ZFSBOOT_BOOT_POOL_NAME:=bootpool}
#
-# Default size for boot pool when enabled (e.g., geli(8) or MBR)
+# Default size for boot pool when enabled (e.g., geli(8))
#
: ${ZFSBOOT_BOOT_POOL_SIZE:=2g}
@@ -790,7 +790,7 @@
# Check for unknown partition scheme before proceeding further
case "$ZFSBOOT_PARTITION_SCHEME" in
- ""|MBR|GPT*) : known good ;;
+ ""|GPT*) : known good ;;
*)
f_dprintf "$funcname: %s is an unsupported partition scheme" \
"$ZFSBOOT_PARTITION_SCHEME"
@@ -825,14 +825,11 @@
#
# Lay down the desired type of partition scheme
#
- local setsize mbrindex align_small align_big
+ local setsize align_small align_big
#
# If user has requested 4 K alignment, add these params to the
# gpart add calls. With GPT, we align large partitions to 1 M for
- # improved performance on SSDs. MBR does not always play well with gaps
- # between partitions, so all alignment is only 4k for that case.
- # With MBR, we align the BSD partition that contains the MBR, otherwise
- # the system fails to boot.
+ # improved performance on SSDs.
#
if [ "$ZFSBOOT_FORCE_4K_SECTORS" ]; then
align_small="-a 4k"
@@ -974,90 +971,6 @@
/dev/$disk$targetpart
;;
- MBR) f_dprintf "$funcname: Creating MBR layout..."
- #
- # Enable boot pool if encryption is desired
- #
- [ "$ZFSBOOT_GELI_ENCRYPTION" ] && ZFSBOOT_BOOT_POOL=1
- #
- # 1. Create MBR layout (no labels)
- #
- f_eval_catch $funcname gpart "$GPART_CREATE" mbr $disk ||
- return $FAILURE
- f_eval_catch $funcname gpart "$GPART_BOOTCODE" /boot/mbr \
- $disk || return $FAILURE
-
- #
- # 2. Add freebsd slice with all available space
- #
- f_eval_catch $funcname gpart "$GPART_ADD_ALIGN" \
- "$align_small" freebsd $disk || return $FAILURE
- f_eval_catch $funcname gpart "$GPART_SET_ACTIVE" 1 $disk ||
- return $FAILURE
- # Pedantically nuke any old labels
- f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \
- /dev/${disk}s1
- # Pedantically nuke any old scheme
- f_eval_catch -d $funcname gpart "$GPART_DESTROY_F" ${disk}s1
-
- #
- # 3. Write BSD scheme to the freebsd slice
- #
- f_eval_catch $funcname gpart "$GPART_CREATE" BSD ${disk}s1 ||
- return $FAILURE
-
- # NB: ZFS pools will use s1a (no labels)
- bootpart=s1a swappart=s1b targetpart=s1d mbrindex=4
-
- #
- # Always prepare a boot pool on MBR
- # Do not align this partition, there must not be a gap
- #
- ZFSBOOT_BOOT_POOL=1
- f_eval_catch $funcname gpart \
- "$GPART_ADD_ALIGN_INDEX_WITH_SIZE" \
- "" 1 freebsd-zfs ${bootsize}b ${disk}s1 ||
- return $FAILURE
- # Pedantically nuke any old labels
- f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \
- /dev/$disk$bootpart
- if [ "$ZFSBOOT_GELI_ENCRYPTION" ]; then
- # Pedantically detach targetpart for later
- f_eval_catch -d $funcname geli \
- "$GELI_DETACH_F" \
- /dev/$disk$targetpart
- fi
-
- #
- # 4. Add freebsd-swap partition
- #
- if [ ${swapsize:-0} -gt 0 ]; then
- f_eval_catch $funcname gpart \
- "$GPART_ADD_ALIGN_INDEX_WITH_SIZE" \
- "$align_small" 2 freebsd-swap \
- ${swapsize}b ${disk}s1 || return $FAILURE
- # Pedantically nuke any old labels on the swap
- f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \
- /dev/${disk}s1b
- fi
-
- #
- # 5. Add freebsd-zfs partition for zroot
- #
- if [ "$ZFSBOOT_POOL_SIZE" ]; then
- f_eval_catch $funcname gpart "$GPART_ADD_ALIGN_INDEX_WITH_SIZE" \
- "$align_small" $mbrindex freebsd-zfs $ZFSBOOT_POOL_SIZE ${disk}s1 || return $FAILURE
- else
- f_eval_catch $funcname gpart "$GPART_ADD_ALIGN_INDEX" \
- "$align_small" $mbrindex freebsd-zfs ${disk}s1 || return $FAILURE
- fi
- f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \
- /dev/$disk$targetpart # Pedantic
- f_eval_catch $funcname dd "$DD_WITH_OPTIONS" \
- /boot/zfsboot /dev/${disk}s1 count=1 ||
- return $FAILURE
- ;;
-
esac # $ZFSBOOT_PARTITION_SCHEME
# Update fstab(5)
@@ -1102,7 +1015,7 @@
local zroot_vdevtype="$2"
local zroot_vdevs= # Calculated below
local swap_devs= # Calculated below
- local boot_vdevs= # Used for geli(8) and/or MBR layouts
+ local boot_vdevs= # Used for geli(8) layouts
shift 2 # poolname vdev_type
local disks="$*" disk
local isswapmirror
@@ -1191,7 +1104,6 @@
f_dprintf "$funcname: With 4K sectors..."
f_eval_catch $funcname sysctl "$SYSCTL_ZFS_MIN_ASHIFT_12" \
|| return $FAILURE
- sysctl kern.geom.part.mbr.enforce_chs=0
fi
local n=0
for disk in $disks; do
@@ -1415,40 +1327,6 @@
"bootfs=\"$zroot_name/$zroot_bootfs\"" "$zroot_name" ||
return $FAILURE
- # MBR boot loader touch-up
- if [ "$ZFSBOOT_PARTITION_SCHEME" = "MBR" ]; then
- # Export the pool(s)
- f_dprintf "$funcname: Temporarily exporting ZFS pool(s)..."
- f_eval_catch $funcname zpool "$ZPOOL_EXPORT" "$zroot_name" ||
- return $FAILURE
- if [ "$ZFSBOOT_BOOT_POOL" ]; then
- f_eval_catch $funcname zpool "$ZPOOL_EXPORT" \
- "$bootpool_name" || return $FAILURE
- fi
-
- f_dprintf "$funcname: Updating MBR boot loader on disks..."
- # Stick the ZFS boot loader in the "convenient hole" after
- # the ZFS internal metadata
- for disk in $disks; do
- f_eval_catch $funcname dd "$DD_WITH_OPTIONS" \
- /boot/zfsboot /dev/$disk$bootpart \
- "skip=1 seek=1024" || return $FAILURE
- done
-
- # Re-import the ZFS pool(s)
- f_dprintf "$funcname: Re-importing ZFS pool(s)..."
- f_eval_catch $funcname zpool "$ZPOOL_IMPORT_WITH_OPTIONS" \
- "-o altroot=\"$BSDINSTALL_CHROOT\"" \
- "$zroot_name" || return $FAILURE
- if [ "$ZFSBOOT_BOOT_POOL" ]; then
- # Import the bootpool, but do not mount it yet
- f_eval_catch $funcname zpool \
- "$ZPOOL_IMPORT_WITH_OPTIONS" \
- "-o altroot=\"$BSDINSTALL_CHROOT\" -N" \
- "$bootpool_name" || return $FAILURE
- fi
- fi
-
# Remount bootpool and create symlink(s)
if [ "$ZFSBOOT_BOOT_POOL" ]; then
f_eval_catch $funcname zfs "$ZFS_MOUNT" "$bootpool_name" ||
@@ -1793,7 +1671,7 @@
fi
;;
?" $msg_partition_scheme")
- # Toggle between GPT (BIOS), GPT (UEFI) and MBR
+ # Toggle between partition schemes
if [ "$ZFSBOOT_PARTITION_SCHEME" = "GPT" -a \
"$ZFSBOOT_BOOT_TYPE" = "BIOS" ]
then
@@ -1805,9 +1683,6 @@
ZFSBOOT_PARTITION_SCHEME="GPT"
ZFSBOOT_BOOT_TYPE="BIOS+UEFI"
elif [ "$ZFSBOOT_PARTITION_SCHEME" = "GPT" ]; then
- ZFSBOOT_PARTITION_SCHEME="MBR"
- ZFSBOOT_BOOT_TYPE="BIOS"
- elif [ "$ZFSBOOT_PARTITION_SCHEME" = "MBR" ]; then
ZFSBOOT_PARTITION_SCHEME="GPT + Active"
ZFSBOOT_BOOT_TYPE="BIOS"
elif [ "$ZFSBOOT_PARTITION_SCHEME" = "GPT + Active" ]; then
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Oct 24, 7:08 AM (25 m, 5 s)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
c3/24/923092789ae5c3c5bd7f4ddf8bec
Default Alt Text
D51028.id159129.diff (7 KB)
Attached To
Mode
D51028: bsdinstall: Remove support for ZFS + MBR disk layouts
Attached
Detach File
Event Timeline
Log In to Comment