git: 87e87fecb139 - main - nanobsd: Remove dependency on bsdlabel

From: Jose Luis Duran <jlduran_at_FreeBSD.org>
Date: Wed, 20 Nov 2024 22:34:13 UTC
The branch main has been updated by jlduran:

URL: https://cgit.FreeBSD.org/src/commit/?id=87e87fecb139d60a00837f004de0d37dbecd205c

commit 87e87fecb139d60a00837f004de0d37dbecd205c
Author:     Jose Luis Duran <jlduran@FreeBSD.org>
AuthorDate: 2024-11-18 00:16:50 +0000
Commit:     Jose Luis Duran <jlduran@FreeBSD.org>
CommitDate: 2024-11-20 22:31:56 +0000

    nanobsd: Remove dependency on bsdlabel
    
    The bsdlabel utility is deprecated, gpart should be used instead:
    
      - Offset the first 16 sectors, just like bsdlabel did (used for
        metadata)
      - Use a freebsd-ufs partition type (regardless bsdlabel creating a
        '!0')
    
    Reviewed by:    emaste, imp
    Approved by:    emaste (mentor)
    MFC after:      1 month
    Differential Revision:  https://reviews.freebsd.org/D47653
---
 tools/tools/nanobsd/legacy.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/tools/nanobsd/legacy.sh b/tools/tools/nanobsd/legacy.sh
index 58288d063b4a..a45b447337b2 100644
--- a/tools/tools/nanobsd/legacy.sh
+++ b/tools/tools/nanobsd/legacy.sh
@@ -116,14 +116,15 @@ create_code_slice ( ) (
 
 	trap "echo 'Running exit trap code' ; df -i ${MNT} ; umount ${MNT} || true ; mdconfig -d -u $MD" 1 2 15 EXIT
 
-	bsdlabel -w ${MD}
+	gpart create -s bsd "${MD}"
+	gpart add -t freebsd-ufs -b 16 "${MD}"
 	if [ -f ${NANO_WORLDDIR}/boot/boot ]; then
 	    echo "Making bootable partition"
 	    gpart bootcode -b ${NANO_WORLDDIR}/boot/boot ${MD}
 	else
 	    echo "Partition will not be bootable"
 	fi
-	bsdlabel ${MD}
+	gpart list ${MD}
 
 	# Create first image
 	populate_slice /dev/${MD}${NANO_PARTITION_ROOT} ${NANO_WORLDDIR} ${MNT} "${NANO_ROOT}"