Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F135852324
D42150.id129371.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D42150.id129371.diff
View Options
diff --git a/usr.sbin/bsdinstall/scripts/bootconfig b/usr.sbin/bsdinstall/scripts/bootconfig
--- a/usr.sbin/bsdinstall/scripts/bootconfig
+++ b/usr.sbin/bsdinstall/scripts/bootconfig
@@ -85,7 +85,28 @@
efibootmgr --create --activate --label "$FREEBSD_BOOTLABEL" --loader "${mntpt}/${FREEBSD_BOOTNAME}" > /dev/null
}
-f_dialog_title "Boot Configuration"
+install_uefi_loader()
+{
+ mkdir -p "${mntpt}/${FREEBSD_BOOTDIR}" "${mntpt}/${BOOTDIR}"
+ cp "$BSDINSTALL_CHROOT/boot/loader.efi" "${mntpt}/${FREEBSD_BOOTNAME}"
+ #
+ # The following shouldn't be necessary. UEFI defines a way to
+ # specifically select what to boot (which we do via
+ # efibootmgr). However, virtual environments often times lack
+ # support for the NV variables efibootmgr sets. In addition,
+ # some UEFI implementations have features that interfere with
+ # the setting of these variables. To combat that, we install the
+ # default removable media boot file as a fallback if it doesn't
+ # exist. We don't install it all the time since that can
+ # interfere with other installations on the drive (like rEFInd).
+ #
+ if [ ! -f "${mntpt}/${BOOTNAME}" ]; then
+ cp "$BSDINSTALL_CHROOT/boot/loader.efi" "${mntpt}/${BOOTNAME}"
+ fi
+
+}
+
+f_dialog_title "Boot configuration"
f_dialog_backtitle "$OSNAME Installer"
if [ `uname -m` == powerpc ]; then
@@ -100,7 +121,8 @@
fi
# Update the ESP (EFI System Partition) with the new bootloader if we have an ESP
-if [ -n "$(awk '{if ($2=="/boot/efi") printf("%s\n",$1);}' $PATH_FSTAB)" ]; then
+ESPBOOT=$(awk '{if ($2=="/boot/efi") printf("%s\n",$1);}' $PATH_FSTAB)
+if [ -n "$ESPBOOT" ]; then
case $(uname -m) in
arm64) ARCHBOOTNAME=aa64 ;;
amd64) ARCHBOOTNAME=x64 ;;
@@ -109,6 +131,15 @@
# i386) ARCHBOOTNAME=ia32 ;; # no support for this in i386 kernels, rare machines
*) die "Unsupported arch $(uname -m) for UEFI install"
esac
+ ESPS=$(cat ${TMPDIR}/bsdinstall-esps 2>/dev/null)
+ num_esps=0
+
+ if [ -n "$ESPS" ]; then
+ for esp in $ESPS; do
+ num_esps=$((num_esps + 1))
+ done
+ fi
+
BOOTDIR="/efi/boot"
BOOTNAME="${BOOTDIR}/boot${ARCHBOOTNAME}.efi"
FREEBSD_BOOTDIR="/efi/freebsd"
@@ -116,28 +147,26 @@
mntpt="$BSDINSTALL_CHROOT/boot/efi"
f_dprintf "Installing loader.efi onto ESP"
- mkdir -p "${mntpt}/${FREEBSD_BOOTDIR}" "${mntpt}/${BOOTDIR}"
- cp "$BSDINSTALL_CHROOT/boot/loader.efi" "${mntpt}/${FREEBSD_BOOTNAME}"
- #
- # The following shouldn't be necessary. UEFI defines a way to
- # specifically select what to boot (which we do via
- # efibootmgr). However, virtual environments often times lack
- # support for the NV variables efibootmgr sets. In addition,
- # some UEFI implementations have features that interfere with
- # the setting of these variables. To combat that, we install the
- # default removable media boot file as a fallback if it doesn't
- # exist. We don't install it all the time since that can
- # interfere with other installations on the drive (like rEFInd).
- #
- if [ ! -f "${mntpt}/${BOOTNAME}" ]; then
- cp "$BSDINSTALL_CHROOT/boot/loader.efi" "${mntpt}/${BOOTNAME}"
- fi
+ install_uefi_loader
if [ "$BSDINSTALL_CONFIGCURRENT" ]; then
update_uefi_bootentry
fi
+ if [ -n "$ESPS" ] && [ $num_esps -gt 1 ]; then
+ for esp in $ESPS; do
+ if [ "$esp" = "$ESPBOOT" ]; then
+ continue
+ fi
+ mntpt=$(mktemp -d ${TMPDIR}/tmpboot.XXXXXX)
+ mount -t msdosfs "${esp}" "${mntpt}"
+ install_uefi_loader
+ umount "${esp}"
+ rmdir "${mntpt}"
+ done
+ fi
+
f_dprintf "Finished configuring ESP"
fi
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
@@ -866,19 +866,24 @@
$disk || return $FAILURE
# We'll configure the ESP in bootconfig
- if [ -z "$efibootpart" ]; then
- efibootpart="/dev/gpt/efiboot$index"
- f_dprintf "$funcname: configuring ESP at [%s]" \
- "${efibootpart}"
+ efibootpart="/dev/gpt/efiboot$index"
+ f_dprintf "$funcname: configuring ESP at [%s]" \
+ "${efibootpart}"
- f_eval_catch $funcname newfs_msdos "$NEWFS_ESP"\
- "$efibootpart" \
- || return $FAILURE
+ f_eval_catch $funcname newfs_msdos "$NEWFS_ESP"\
+ "$efibootpart" \
+ || return $FAILURE
+
+ if [ "$index" = "0" ]; then
f_eval_catch $funcname printf "$PRINTF_FSTAB" \
$efibootpart /boot/efi msdosfs \
rw 2 2 "$BSDINSTALL_TMPETC/fstab" \
|| return $FAILURE
fi
+
+ # To be reused by bootconfig
+ echo "$efibootpart" >> ${TMPDIR:-"/tmp"}/bsdinstall-esps
+
fi
if [ "$ZFSBOOT_BOOT_TYPE" = "BIOS" -o \
@@ -1751,9 +1756,6 @@
zfs_create_boot "$ZFSBOOT_POOL_NAME" \
"$vdev_type" $ZFSBOOT_DISKS || continue
- # To be reused by bootconfig
- echo "$ZFSBOOT_DISKS" > ${TMPDIR:-"/tmp"}/bsdinstall-zfsboot
-
break # to success
;;
?" $msg_pool_type_disks")
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 14, 1:09 PM (4 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25288352
Default Alt Text
D42150.id129371.diff (4 KB)
Attached To
Mode
D42150: bsdinstall: when installing UEFI, place the bootloader on all disks
Attached
Detach File
Event Timeline
Log In to Comment