git: 060c97abb019 - stable/13 - powerpc64: make autoboot possible on powernv machines

From: Alfredo Dal'Ava Junior <alfredo_at_FreeBSD.org>
Date: Wed, 01 Dec 2021 19:41:50 UTC
The branch stable/13 has been updated by alfredo:

URL: https://cgit.FreeBSD.org/src/commit/?id=060c97abb0192568ca6807d39ed822593c3f1459

commit 060c97abb0192568ca6807d39ed822593c3f1459
Author:     Alfredo Dal'Ava Junior <alfredo@FreeBSD.org>
AuthorDate: 2021-11-26 00:02:53 +0000
Commit:     Alfredo Dal'Ava Junior <alfredo@FreeBSD.org>
CommitDate: 2021-12-01 22:41:49 +0000

    powerpc64: make autoboot possible on powernv machines
    
    It's required to specify a default boot option in order to make
    petitboot's autoboot feature work.
    
    Tested on Raptor Blackbird
    
    Reviewed by:    imp, luporl
    MFC after:      2 days
    Sponsored by:   Instituto de Pesquisas Eldorado (eldorado.org.br)
    Differential Revision:  https://reviews.freebsd.org/D32838
    
    (cherry picked from commit b6644f529ca4c13975727c5625415fcc30c60af6)
---
 usr.sbin/bsdinstall/scripts/bootconfig | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/usr.sbin/bsdinstall/scripts/bootconfig b/usr.sbin/bsdinstall/scripts/bootconfig
index c0a0ff4f77ee..c5218b10a271 100755
--- a/usr.sbin/bsdinstall/scripts/bootconfig
+++ b/usr.sbin/bsdinstall/scripts/bootconfig
@@ -27,6 +27,9 @@
 #
 # $FreeBSD$
 
+
+FREEBSD_BOOTLABEL="FreeBSD"
+
 BSDCFG_SHARE="/usr/share/bsdconfig"
 . $BSDCFG_SHARE/common.subr || exit 1
 
@@ -41,8 +44,10 @@ if [ `uname -m` == powerpc ]; then
 	platform=`sysctl -n hw.platform`
 	if [ "$platform" == ps3 -o "$platform" == powernv ]; then
 		rootpart=$(awk '{ if($2 == "/") printf("%s:%s\n", $3, $1); }' $PATH_FSTAB)
+		kboot_conf=$BSDINSTALL_CHROOT/boot/etc/kboot.conf
 		mkdir -p $BSDINSTALL_CHROOT/boot/etc/
-		echo FreeBSD=\'/kernel/kernel kernelname=/boot/kernel/kernel vfs.root.mountfrom=${rootpart}\' > $BSDINSTALL_CHROOT/boot/etc/kboot.conf
+		echo default=$FREEBSD_BOOTLABEL > $kboot_conf
+		echo $FREEBSD_BOOTLABEL=\'/kernel/kernel kernelname=/boot/kernel/kernel vfs.root.mountfrom=${rootpart}\' >> $kboot_conf
 	fi
 fi
 
@@ -81,11 +86,9 @@ if [ -n "$(awk '{if ($2=="/boot/efi") printf("%s\n",$1);}' $PATH_FSTAB)" ]; then
 		cp "$BSDINSTALL_CHROOT/boot/loader.efi" "${mntpt}/${BOOTNAME}"
 	fi
 
-	bootlabel="FreeBSD"
-
 	if [ "$BSDINSTALL_CONFIGCURRENT" ]; then
 		f_dprintf "Creating UEFI boot entry"
-		efibootmgr --create --activate --label "$bootlabel" --loader "${mntpt}/${FREEBSD_BOOTNAME}" > /dev/null
+		efibootmgr --create --activate --label "$FREEBSD_BOOTLABEL" --loader "${mntpt}/${FREEBSD_BOOTNAME}" > /dev/null
 	fi
 
 	f_dprintf "Finished configuring ESP"