Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bsdinstall/scripts/zfsboot
Show First 20 Lines • Show All 207 Lines • ▼ Show 20 Lines | |||||
GPART_SET_ACTIVE='gpart set -a active -i %s "%s"' | GPART_SET_ACTIVE='gpart set -a active -i %s "%s"' | ||||
GPART_SET_LENOVOFIX='gpart set -a lenovofix "%s"' | GPART_SET_LENOVOFIX='gpart set -a lenovofix "%s"' | ||||
GPART_SET_PMBR_ACTIVE='gpart set -a active "%s"' | GPART_SET_PMBR_ACTIVE='gpart set -a active "%s"' | ||||
GRAID_DELETE='graid delete "%s"' | GRAID_DELETE='graid delete "%s"' | ||||
KLDLOAD='kldload %s' | KLDLOAD='kldload %s' | ||||
LN_SF='ln -sf "%s" "%s"' | LN_SF='ln -sf "%s" "%s"' | ||||
MKDIR_P='mkdir -p "%s"' | MKDIR_P='mkdir -p "%s"' | ||||
MOUNT_TYPE='mount -t %s "%s" "%s"' | MOUNT_TYPE='mount -t %s "%s" "%s"' | ||||
NEWFS_ESP='newfs_msdos -F %s -L "%s" "%s"' | |||||
PRINTF_CONF="printf '%s=\"%%s\"\\\n' %s >> \"%s\"" | PRINTF_CONF="printf '%s=\"%%s\"\\\n' %s >> \"%s\"" | ||||
PRINTF_FSTAB='printf "$FSTAB_FMT" "%s" "%s" "%s" "%s" "%s" "%s" >> "%s"' | PRINTF_FSTAB='printf "$FSTAB_FMT" "%s" "%s" "%s" "%s" "%s" "%s" >> "%s"' | ||||
SHELL_TRUNCATE=':> "%s"' | SHELL_TRUNCATE=':> "%s"' | ||||
SWAP_GMIRROR_LABEL='gmirror label swap %s' | SWAP_GMIRROR_LABEL='gmirror label swap %s' | ||||
SYSCTL_ZFS_MIN_ASHIFT_12='sysctl vfs.zfs.min_auto_ashift=12' | SYSCTL_ZFS_MIN_ASHIFT_12='sysctl vfs.zfs.min_auto_ashift=12' | ||||
UMOUNT='umount "%s"' | UMOUNT='umount "%s"' | ||||
ZFS_CREATE_WITH_OPTIONS='zfs create %s "%s"' | ZFS_CREATE_WITH_OPTIONS='zfs create %s "%s"' | ||||
ZFS_MOUNT='zfs mount "%s"' | ZFS_MOUNT='zfs mount "%s"' | ||||
▲ Show 20 Lines • Show All 621 Lines • ▼ Show 20 Lines | ""|GPT*) f_dprintf "$funcname: Creating GPT layout..." | ||||
if [ "$ZFSBOOT_BOOT_TYPE" = "UEFI" -o \ | if [ "$ZFSBOOT_BOOT_TYPE" = "UEFI" -o \ | ||||
"$ZFSBOOT_BOOT_TYPE" = "BIOS+UEFI" ] | "$ZFSBOOT_BOOT_TYPE" = "BIOS+UEFI" ] | ||||
then | then | ||||
f_eval_catch $funcname gpart \ | f_eval_catch $funcname gpart \ | ||||
"$GPART_ADD_ALIGN_LABEL_WITH_SIZE" \ | "$GPART_ADD_ALIGN_LABEL_WITH_SIZE" \ | ||||
"$align_small" efiboot$index efi 200M \ | "$align_small" efiboot$index efi 200M \ | ||||
$disk || return $FAILURE | $disk || return $FAILURE | ||||
f_eval_catch $funcname mkdir "$MKDIR_P" \ | # We'll configure the ESP in bootconfig | ||||
"$BSDINSTALL_TMPETC/esp" || | |||||
return $FAILURE | |||||
f_eval_catch $funcname newfs_msdos "$NEWFS_ESP" "16" \ | |||||
"EFISYS" "/dev/${disk}p1" || | |||||
return $FAILURE | |||||
f_eval_catch $funcname mount "$MOUNT_TYPE" "msdosfs" \ | |||||
"/dev/${disk}p1" \ | |||||
"$BSDINSTALL_TMPETC/esp" || | |||||
return $FAILURE | |||||
f_eval_catch $funcname mkdir "$MKDIR_P" \ | |||||
"$BSDINSTALL_TMPETC/esp/efi/boot" || | |||||
return $FAILURE | |||||
f_eval_catch $funcname cp "$COPY" "/boot/loader.efi" \ | |||||
"$BSDINSTALL_TMPETC/esp/efi/boot/$ZFSBOOT_ESP_NAME" || | |||||
return $FAILURE | |||||
f_eval_catch $funcname echo "$ECHO_OVERWRITE" \ | |||||
"$ZFSBOOT_ESP_NAME" \ | |||||
"$BSDINSTALL_TMPETC/esp/efi/boot/startup.nsh" || | |||||
return $FAILURE | |||||
f_eval_catch $funcname umount "$UMOUNT" \ | |||||
"$BSDINSTALL_TMPETC/esp" || | |||||
return $FAILURE | |||||
fi | fi | ||||
if [ "$ZFSBOOT_BOOT_TYPE" = "BIOS" -o \ | if [ "$ZFSBOOT_BOOT_TYPE" = "BIOS" -o \ | ||||
"$ZFSBOOT_BOOT_TYPE" = "BIOS+UEFI" ] | "$ZFSBOOT_BOOT_TYPE" = "BIOS+UEFI" ] | ||||
then | then | ||||
f_eval_catch $funcname gpart \ | f_eval_catch $funcname gpart \ | ||||
"$GPART_ADD_ALIGN_LABEL_WITH_SIZE" \ | "$GPART_ADD_ALIGN_LABEL_WITH_SIZE" \ | ||||
"$align_small" gptboot$index \ | "$align_small" gptboot$index \ | ||||
▲ Show 20 Lines • Show All 703 Lines • ▼ Show 20 Lines | *) | ||||
if [ "$bootmethod" = "UEFI" ]; then | if [ "$bootmethod" = "UEFI" ]; then | ||||
: ${ZFSBOOT_BOOT_TYPE:=BIOS+UEFI} | : ${ZFSBOOT_BOOT_TYPE:=BIOS+UEFI} | ||||
: ${ZFSBOOT_PARTITION_SCHEME:=GPT} | : ${ZFSBOOT_PARTITION_SCHEME:=GPT} | ||||
else | else | ||||
: ${ZFSBOOT_BOOT_TYPE:=BIOS} | : ${ZFSBOOT_BOOT_TYPE:=BIOS} | ||||
: ${ZFSBOOT_PARTITION_SCHEME:=GPT} | : ${ZFSBOOT_PARTITION_SCHEME:=GPT} | ||||
fi | fi | ||||
;; | ;; | ||||
esac | |||||
# | |||||
# The EFI loader installed in the ESP (EFI System Partition) must | |||||
# have the expected name in order to load correctly. | |||||
# | |||||
[ "$ZFSBOOT_ESP_NAME" ] || case "${UNAME_m:-$( uname -m )}" in | |||||
arm64) ZFSBOOT_ESP_NAME=BOOTaa64.efi ;; | |||||
arm) ZFSBOOT_ESP_NAME=BOOTarm.efi ;; | |||||
i386) ZFSBOOT_ESP_NAME=BOOTia32.efi ;; | |||||
amd64) ZFSBOOT_ESP_NAME=BOOTx64.efi ;; | |||||
*) | |||||
f_dprintf "Unsupported architecture: %s" $UNAME_m | |||||
f_die | |||||
esac | esac | ||||
# | # | ||||
# Loop over the main menu until we've accomplished what we came here to do | # Loop over the main menu until we've accomplished what we came here to do | ||||
# | # | ||||
while :; do | while :; do | ||||
if ! f_interactive; then | if ! f_interactive; then | ||||
retval=$DIALOG_OK | retval=$DIALOG_OK | ||||
▲ Show 20 Lines • Show All 185 Lines • Show Last 20 Lines |