bsdinstall: fix ESP detection for auto ZFS layout

Pass the list of user selected disks from zfsboot to bootconfig so that
the latter doesn't rely on ESP autodetection that apparently fails for
some cases, e.g. memstick installation with nvme (boot) and sata drives.

While here, fix printing of debug messages in bootconfig.

Reviewed by:	bcran, imp, tsoome
Differential Revision:	https://reviews.freebsd.org/D21930
This commit is contained in:
Yuri Pankov 2019-10-09 05:28:10 +00:00
parent 68b6aaa70d
commit a89559c269
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=353335
2 changed files with 14 additions and 7 deletions

View File

@ -27,6 +27,9 @@
#
# $FreeBSD$
BSDCFG_SHARE="/usr/share/bsdconfig"
. $BSDCFG_SHARE/common.subr || exit 1
die() {
echo $*
exit 1
@ -47,7 +50,8 @@ if [ "$(uname -m)" = "amd64" ] || [ "$(uname -m)" = "i386" ]; then
fi
if [ "$(uname -m)" = "arm64" ] || [ "$X86_BOOTMETHOD" = "UEFI" ]; then
UFSBOOT_ESPS=$(cat /tmp/bsdinstall-esps)
UFSBOOT_ESPS=$(cat /tmp/bsdinstall-esps 2>/dev/null)
ZFSBOOT_DISKS=$(cat /tmp/bsdinstall-zfsboot 2>/dev/null)
num_esps=0
if [ -n "$ZFSBOOT_DISKS" ]; then
@ -119,20 +123,20 @@ if [ "$(uname -m)" = "arm64" ] || [ "$X86_BOOTMETHOD" = "UEFI" ]; then
fi
for esp in $ESPS; do
echo "Formatting /dev/${esp} as FAT32"
f_dprintf "Formatting /dev/${esp} as FAT32"
newfs_msdos -F 32 -c 1 -L EFISYS "/dev/$esp" > /dev/null 2>&1
if [ $? -ne 0 ]; then
die "Failed to format ESP $esp as FAT32"
fi
mntpt=$(mktemp -d /tmp/stand-test.XXXXXX)
echo "Mounting ESP /dev/${esp}"
f_dprintf "Mounting ESP /dev/${esp}"
mount -t msdosfs "/dev/${esp}" "${mntpt}"
if [ $? -ne 0 ]; then
die "Failed to mount ESP ${dev} on ${mntpt}"
fi
echo "Installing loader.efi onto ESP"
f_dprintf "Installing loader.efi onto ESP"
mkdir -p "$mntpt/EFI/freebsd"
cp "$BSDINSTALL_CHROOT/boot/loader.efi" "${mntpt}/EFI/freebsd/loader.efi"
@ -142,14 +146,14 @@ if [ "$(uname -m)" = "arm64" ] || [ "$X86_BOOTMETHOD" = "UEFI" ]; then
bootlabel="FreeBSD"
fi
echo "Creating UEFI boot entry"
f_dprintf "Creating UEFI boot entry"
efibootmgr --create --activate --label "$bootlabel" --loader "${mntpt}/EFI/freebsd/loader.efi" > /dev/null
echo "Unmounting ESP"
f_dprintf "Unmounting ESP"
umount "${mntpt}"
rmdir "${mntpt}"
echo "Finished configuring /dev/${esp} as ESP"
f_dprintf "Finished configuring /dev/${esp} as ESP"
done
fi

View File

@ -1656,6 +1656,9 @@ while :; do
zfs_create_boot "$ZFSBOOT_POOL_NAME" \
"$vdev_type" $ZFSBOOT_DISKS || continue
# To be reused by bootconfig
echo "$ZFSBOOT_DISKS" > /tmp/bsdinstall-zfsboot
break # to success
;;
?" $msg_pool_type_disks")