View | Details | Raw Unified | Return to bug 208629
Collapse All | Expand All

(-)usr.sbin/bsdinstall/scripts/zfsboot (-13 / +41 lines)
Lines 112-118 Link Here
112
: ${ZFSBOOT_PARTITION_SCHEME:=}
118
: ${ZFSBOOT_PARTITION_SCHEME:=}
113
119
114
#
120
#
115
# Default partitioning scheme to use on disks
121
# Default boot type to use on disks
116
#
122
#
117
: ${ZFSBOOT_BOOT_TYPE:=}
123
: ${ZFSBOOT_BOOT_TYPE:=}
118
124
Lines 755-760 Link Here
755
	esac
761
	esac
756
762
757
	#
763
	#
764
	# Enable boot pool if encryption is desired
765
	#
766
	[ "$ZFSBOOT_GELI_ENCRYPTION" ] && ZFSBOOT_BOOT_POOL=1
767
768
	#
769
	# ZFSBOOT_BOOT_POOL and BIOS+UEFI boot type are incompatible
770
	#
771
	if [ "$ZFSBOOT_BOOT_POOL" -a "$ZFSBOOT_BOOT_TYPE" = "BIOS+UEFI" ]; then
772
		f_dprintf "$funcname: ZFSBOOT_BOOT_POOL is incompatible with BIOS+UEFI boot type"
773
		msg_error="$msg_error: $funcname" f_show_err \
774
			"ZFSBOOT_BOOT_POOL is incompatible with BIOS+UEFI boot type"
775
		return $FAILURE
776
	fi
777
778
	#
758
	# Destroy whatever partition layout is currently on disk.
779
	# Destroy whatever partition layout is currently on disk.
759
	# NOTE: `-F' required to destroy if partitions still exist.
780
	# NOTE: `-F' required to destroy if partitions still exist.
760
	# NOTE: Failure is ok here, blank disk will have nothing to destroy.
781
	# NOTE: Failure is ok here, blank disk will have nothing to destroy.
Lines 769-779 Link Here
769
	f_eval_catch -d $funcname gpart "$GPART_DESTROY_F" $disk
790
	f_eval_catch -d $funcname gpart "$GPART_DESTROY_F" $disk
770
791
771
	#
792
	#
772
	# Enable boot pool if encryption is desired
773
	#
774
	[ "$ZFSBOOT_GELI_ENCRYPTION" ] && ZFSBOOT_BOOT_POOL=1
775
776
	#
777
	# Lay down the desired type of partition scheme
793
	# Lay down the desired type of partition scheme
778
	#
794
	#
779
	local setsize mbrindex align_small align_big
795
	local setsize mbrindex align_small align_big
Lines 813-819 Link Here
813
		#
829
		#
814
		# 2. Add small freebsd-boot or efi partition
830
		# 2. Add small freebsd-boot or efi partition
815
		#
831
		#
816
		if [ "$ZFSBOOT_BOOT_TYPE" = "UEFI" ]; then
832
		if [ "$ZFSBOOT_BOOT_TYPE" = "UEFI" -o "$ZFSBOOT_BOOT_TYPE" = "BIOS+UEFI" ]; then
817
			f_eval_catch $funcname gpart \
833
			f_eval_catch $funcname gpart \
818
			             "$GPART_ADD_ALIGN_LABEL_WITH_SIZE" \
834
			             "$GPART_ADD_ALIGN_LABEL_WITH_SIZE" \
819
			             "$align_small" efiboot$index efi 800k $disk ||
835
			             "$align_small" efiboot$index efi 800k $disk ||
Lines 821-839 Link Here
821
			f_eval_catch $funcname gpart "$GPART_BOOTCODE_PARTONLY" \
837
			f_eval_catch $funcname gpart "$GPART_BOOTCODE_PARTONLY" \
822
			             /boot/boot1.efifat 1 $disk ||
838
			             /boot/boot1.efifat 1 $disk ||
823
			             return $FAILURE
839
			             return $FAILURE
824
		else
840
		fi
841
842
		if [ "$ZFSBOOT_BOOT_TYPE" = "BIOS" -o "$ZFSBOOT_BOOT_TYPE" = "BIOS+UEFI" ]; then
825
			f_eval_catch $funcname gpart \
843
			f_eval_catch $funcname gpart \
826
			             "$GPART_ADD_ALIGN_LABEL_WITH_SIZE" \
844
			             "$GPART_ADD_ALIGN_LABEL_WITH_SIZE" \
827
			             "$align_small" gptboot$index freebsd-boot \
845
			             "$align_small" gptboot$index freebsd-boot \
828
			             512k $disk || return $FAILURE
846
			             512k $disk || return $FAILURE
829
			f_eval_catch $funcname gpart "$GPART_BOOTCODE_PART" \
847
			if [ "$ZFSBOOT_BOOT_TYPE" = "BIOS" ]; then
830
			             /boot/pmbr /boot/gptzfsboot 1 $disk ||
848
				f_eval_catch $funcname gpart "$GPART_BOOTCODE_PART" \
831
			             return $FAILURE
849
				             /boot/pmbr /boot/gptzfsboot 1 $disk ||
850
				             return $FAILURE
851
			else
852
				f_eval_catch $funcname gpart "$GPART_BOOTCODE_PART" \
853
				             /boot/pmbr /boot/gptzfsboot 2 $disk ||
854
				             return $FAILURE
855
			fi
832
		fi
856
		fi
833
857
834
		# NB: zpool will use the `zfs#' GPT labels
858
		# NB: zpool will use the `zfs#' GPT labels
835
		bootpart=p2 swappart=p2 targetpart=p2
859
		if [ "$ZFSBOOT_BOOT_TYPE" = "BIOS+UEFI" ]; then
836
		[ ${swapsize:-0} -gt 0 ] && targetpart=p3
860
			bootpart=p3 swappart=p3 targetpart=p3
861
			[ ${swapsize:-0} -gt 0 ] && targetpart=p4
862
		else
863
			bootpart=p2 swappart=p2 targetpart=p2
864
			[ ${swapsize:-0} -gt 0 ] && targetpart=p3
865
		fi
837
866
838
		#
867
		#
839
		# Prepare boot pool if enabled (e.g., for geli(8))
868
		# Prepare boot pool if enabled (e.g., for geli(8))
Lines 1256-1261 Link Here
1256
	f_dprintf "$funcname: Modifying directory permissions..."
1285
	f_dprintf "$funcname: Modifying directory permissions..."
1257
	local dir
1286
	local dir
1258
	for dir in /tmp /var/tmp; do
1287
	for dir in /tmp /var/tmp; do
1288
		f_eval_catch $funcname mkdir "$MKDIR_P" \
1289
		             $BSDINSTALL_CHROOT$dir || return $FAILURE
1259
		f_eval_catch $funcname chmod "$CHMOD_MODE" 1777 \
1290
		f_eval_catch $funcname chmod "$CHMOD_MODE" 1777 \
1260
		             $BSDINSTALL_CHROOT$dir || return $FAILURE
1291
		             $BSDINSTALL_CHROOT$dir || return $FAILURE
1261
	done
1292
	done
Lines 1572-1577 Link Here
1572
		if [ "$ZFSBOOT_PARTITION_SCHEME" = "GPT" -a "$ZFSBOOT_BOOT_TYPE" = "BIOS" ]; then
1603
		if [ "$ZFSBOOT_PARTITION_SCHEME" = "GPT" -a "$ZFSBOOT_BOOT_TYPE" = "BIOS" ]; then
1573
			ZFSBOOT_PARTITION_SCHEME="GPT"
1604
			ZFSBOOT_PARTITION_SCHEME="GPT"
1574
			ZFSBOOT_BOOT_TYPE="UEFI"
1605
			ZFSBOOT_BOOT_TYPE="UEFI"
1606
		elif [ "$ZFSBOOT_PARTITION_SCHEME" = "GPT" -a "$ZFSBOOT_BOOT_TYPE" = "UEFI" ]; then
1607
			ZFSBOOT_PARTITION_SCHEME="GPT"
1608
			ZFSBOOT_BOOT_TYPE="BIOS+UEFI"
1575
		elif [ "$ZFSBOOT_PARTITION_SCHEME" = "GPT" ]; then
1609
		elif [ "$ZFSBOOT_PARTITION_SCHEME" = "GPT" ]; then
1576
			ZFSBOOT_PARTITION_SCHEME="MBR"
1610
			ZFSBOOT_PARTITION_SCHEME="MBR"
1577
			ZFSBOOT_BOOT_TYPE="BIOS"
1611
			ZFSBOOT_BOOT_TYPE="BIOS"

Return to bug 208629