Index: usr.sbin/bsdinstall/scripts/zfsboot =================================================================== --- usr.sbin/bsdinstall/scripts/zfsboot +++ usr.sbin/bsdinstall/scripts/zfsboot @@ -211,6 +211,7 @@ LN_SF='ln -sf "%s" "%s"' MKDIR_P='mkdir -p "%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_FSTAB='printf "$FSTAB_FMT" "%s" "%s" "%s" "%s" "%s" "%s" >> "%s"' SHELL_TRUNCATE=':> "%s"' @@ -850,9 +851,22 @@ "$GPART_ADD_ALIGN_LABEL_WITH_SIZE" \ "$align_small" efiboot$index efi 200M $disk || return $FAILURE - f_eval_catch $funcname gpart "$GPART_BOOTCODE_PARTONLY" \ - /boot/boot1.efifat 1 $disk || - return $FAILURE + + f_eval_catch $funcname mkdir "$MKDIR_P" \ + "$BSDINSTALL_TMPETC/esp" || return $FAILURE + f_eval_catch $funcname newfs_msdos "$NEWFS_ESP" "16" "EFI" \ + "/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 "cp /boot/boot1.efi \ + ${BSDINSTALL_TMPETC}/esp/efi/boot/${ZFSBOOT_ESP_NAME}" || + return $FAILURE + f_eval_catch $funcname umount "$UMOUNT" "$BSDINSTALL_TMPETC/esp" || + return $FAILURE fi if [ "$ZFSBOOT_BOOT_TYPE" = "BIOS" -o "$ZFSBOOT_BOOT_TYPE" = "BIOS+UEFI" ]; then @@ -1565,6 +1579,24 @@ : ${ZFSBOOT_BOOT_TYPE:=BIOS} : ${ZFSBOOT_PARTITION_SCHEME:=GPT} fi + +# +# The EFI loader installed in the ESP (EFI System Partition) must +# have the expected name in order to load correctly. +# + +case "$( uname -m )" in + "arm64") + : ${ZFSBOOT_ESP_NAME:=BOOTaa64.efi} + ;; + "arm") + : ${ZFSBOOT_ESP_NAME:=BOOTarm.efi} + ;; + "i386") + : ${ZFSBOOT_ESP_NAME:=BOOTia32.efi} + ;; +esac +: ${ZFSBOOT_ESP_NAME:=BOOTx64.efi} # # Loop over the main menu until we've accomplished what we came here to do