Date: Thu, 26 Feb 2026 18:16:34 +0000 From: Colin Percival <cperciva@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Ahmad Khalifa <vexeduxr@FreeBSD.org> Subject: git: 3cf73e195af3 - releng/14.4 - bsdinstall: fix EFI boot entry creation Message-ID: <69a08e02.44e22.7ecc78d6@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch releng/14.4 has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=3cf73e195af3d4693d1e52de0a91b6d4b3fb8b5c commit 3cf73e195af3d4693d1e52de0a91b6d4b3fb8b5c Author: Ahmad Khalifa <vexeduxr@FreeBSD.org> AuthorDate: 2026-02-24 20:11:32 +0000 Commit: Colin Percival <cperciva@FreeBSD.org> CommitDate: 2026-02-26 16:50:15 +0000 bsdinstall: fix EFI boot entry creation update_uefi_bootentry assumes that the caller sets FREEBSD_BOOTNAME and mntpt, which isn't the case anymore. The result is that there is no "FreeBSD" boot entry created/updated after install. Most machines manage to boot from the removable media path (if the loader is installed there too), but some don't. Take the loader's path as an argument and rename the variable used in the ZFS mirror loop so mntpt can be reused below. Also mark nentries as a local variable so it doesn't leak out of the function. PR: 293385 Fixes: 494de51bc0074472d1b01604f085daea0844f240 MFC after: 2 days Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D55469 (cherry picked from commit 0fd91c489134643ac9e38c0f55ba7464fe892c5e) (cherry picked from commit cfdd90abab51581120da75b45018a79237228b33) --- usr.sbin/bsdinstall/scripts/bootconfig | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/usr.sbin/bsdinstall/scripts/bootconfig b/usr.sbin/bsdinstall/scripts/bootconfig index ba9a4369429c..5bcc49084617 100755 --- a/usr.sbin/bsdinstall/scripts/bootconfig +++ b/usr.sbin/bsdinstall/scripts/bootconfig @@ -80,11 +80,13 @@ uefi_copy_loader() update_uefi_bootentry() { - nentries=$(efibootmgr | grep -c "${EFI_LABEL_NAME}$") + local nentries=$(efibootmgr | grep -c "${EFI_LABEL_NAME}$") + local loader_path=$1 + # No entries so directly create one and return if [ ${nentries} -eq 0 ]; then f_dprintf "Creating UEFI boot entry" - efibootmgr --create --activate --label "$EFI_LABEL_NAME" --loader "${mntpt}/${FREEBSD_BOOTNAME}" > /dev/null + efibootmgr --create --activate --label "$EFI_LABEL_NAME" --loader "${loader_path}" > /dev/null return fi @@ -94,13 +96,13 @@ update_uefi_bootentry() for entry in $(efibootmgr | awk "\$NF == \"$EFI_LABEL_NAME\" { sub(/.*Boot/,\"\", \$1); sub(/\*/,\"\", \$1); print \$1 }"); do efibootmgr -B -b ${entry} done - efibootmgr --create --activate --label "$EFI_LABEL_NAME" --loader "${mntpt}/${FREEBSD_BOOTNAME}" > /dev/null + efibootmgr --create --activate --label "$EFI_LABEL_NAME" --loader "${loader_path}" > /dev/null return fi FREEBSD_BOOTLABEL=$(dialog_uefi_entryname "${EFI_LABEL_NAME}") [ $? -eq $DIALOG_CANCEL ] && exit 1 - efibootmgr --create --activate --label "$FREEBSD_BOOTLABEL" --loader "${mntpt}/${FREEBSD_BOOTNAME}" > /dev/null + efibootmgr --create --activate --label "$FREEBSD_BOOTLABEL" --loader "${loader_path}" > /dev/null } f_dialog_title "Boot Configuration" @@ -148,21 +150,22 @@ if [ -n "$(awk '{if ($2=="/boot/efi") printf("%s\n",$1);}' $PATH_FSTAB)" ]; then # over gmirror, so we only do this for ZFS. esps=${TMPDIR:-"/tmp"}/bsdinstall-esps if [ -f "$esps" ]; then - mntpt=$(mktemp -d -t bsdinstall-esp) + tmpmnt=$(mktemp -d -t bsdinstall-esp) for dev in $(cat $esps); do f_dprintf "Installing ${file} onto redundant ESP ${dev}" - mount -t msdos "$dev" "$mntpt" + mount -t msdos "$dev" "$tmpmnt" uefi_copy_loader "$BSDINSTALL_CHROOT/boot/${file}" \ - "${mntpt}/efi/freebsd" "${mntpt}/efi/boot" \ + "${tmpmnt}/efi/freebsd" "${tmpmnt}/efi/boot" \ boot${ARCHBOOTNAME}.efi - umount "$mntpt" + umount "$tmpmnt" done - rmdir "${mntpt}" + rmdir "${tmpmnt}" fi - # Try to set the UEFI NV BootXXXX variables to record the boot location + # Try to set the UEFI NV BootXXXX variables to record the boot location. + # Note that the ESP is mounted at ${mntpt}/efi. if [ "$BSDINSTALL_CONFIGCURRENT" ] && [ "$ARCHBOOTNAME" != ia32 ]; then - update_uefi_bootentry + update_uefi_bootentry "${mntpt}/efi/freebsd/${file}" fi f_dprintf "Finished configuring ESP"home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69a08e02.44e22.7ecc78d6>
