svn commit: r353335 - head/usr.sbin/bsdinstall/scripts
Yuri Pankov
yuripv at FreeBSD.org
Wed Oct 9 05:28:12 UTC 2019
Author: yuripv
Date: Wed Oct 9 05:28:10 2019
New Revision: 353335
URL: https://svnweb.freebsd.org/changeset/base/353335
Log:
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
Modified:
head/usr.sbin/bsdinstall/scripts/bootconfig
head/usr.sbin/bsdinstall/scripts/zfsboot
Modified: head/usr.sbin/bsdinstall/scripts/bootconfig
==============================================================================
--- head/usr.sbin/bsdinstall/scripts/bootconfig Wed Oct 9 02:02:22 2019 (r353334)
+++ head/usr.sbin/bsdinstall/scripts/bootconfig Wed Oct 9 05:28:10 2019 (r353335)
@@ -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)" = "i
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"
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"
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
Modified: head/usr.sbin/bsdinstall/scripts/zfsboot
==============================================================================
--- head/usr.sbin/bsdinstall/scripts/zfsboot Wed Oct 9 02:02:22 2019 (r353334)
+++ head/usr.sbin/bsdinstall/scripts/zfsboot Wed Oct 9 05:28:10 2019 (r353335)
@@ -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")
More information about the svn-src-head
mailing list