Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Feb 2025 01:43:44 GMT
From:      Jose Luis Duran <jlduran@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: e58d9b71f37d - stable/14 - nanobsd: Always define the partition index
Message-ID:  <202502120143.51C1hiJS051610@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by jlduran:

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

commit e58d9b71f37dde1cd19bb0af3a4bf94938f4406d
Author:     Jose Luis Duran <jlduran@FreeBSD.org>
AuthorDate: 2025-02-04 14:07:00 +0000
Commit:     Jose Luis Duran <jlduran@FreeBSD.org>
CommitDate: 2025-02-12 01:32:12 +0000

    nanobsd: Always define the partition index
    
    Print the desired partition index together with the starting LBA and the
    size. Otherwise, when only one code partition is desired, the
    configuration partition (/cfg) may not end up in the third slice, thus
    breaking the scripts that expect it there.
    
    This was the previous approach, changed in 587c054bea0f ("nanobsd: Use
    gpart and create code image before full disk image").
    
    Fix it by printing the index as the last column to reduce the chances of
    breaking current overrides, and using it as the gpart index.
    
    PR:             262098
    Reviewed by:    imp
    Approved by:    emaste (mentor)
    Fixes:  587c054bea0f ("nanobsd: Use gpart and create code image before full disk image")
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D47835
    
    (cherry picked from commit dc4b36b96333f2ab05f3c454f0df2e0a0d4d451d)
---
 tools/tools/nanobsd/legacy.sh | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/tools/tools/nanobsd/legacy.sh b/tools/tools/nanobsd/legacy.sh
index a45b447337b2..2f689212263e 100644
--- a/tools/tools/nanobsd/legacy.sh
+++ b/tools/tools/nanobsd/legacy.sh
@@ -64,31 +64,30 @@ calculate_partitioning ( ) (
 		}
 
 		# First image partition start at second track
-		print $3, isl * cs - $3
+		print $3, isl * cs - $3, 1
 		c = isl * cs;
 
 		# Second image partition (if any) also starts offset one
 		# track to keep them identical.
 		if ($2 > 1) {
-			print $3 + c, isl * cs - $3
+			print $3 + c, isl * cs - $3, 2
 			c += isl * cs;
 		}
 
 		# Config partition starts at cylinder boundary.
-		print c, csl * cs
+		print c, csl * cs, 3
 		c += csl * cs
 
 		# Data partition (if any) starts at cylinder boundary.
 		if ($7 > 0) {
-			print c, dsl * cs
+			print c, dsl * cs, 4
 		} else if ($7 < 0 && $1 > c) {
-			print c, $1 - c
+			print c, $1 - c, 4
 		} else if ($1 < c) {
 			print "Disk space overcommitted by", \
 			    c - $1, "sectors" > "/dev/stderr"
 			exit 2
 		}
-
 	}
 	' > ${NANO_LOG}/_.partitioning
 )
@@ -174,7 +173,7 @@ create_diskimage ( ) (
 	}
 	{
 		# Make partition
-		print "gpart add -t freebsd -b ", $1, " -s ", $2, " $1"
+		print "gpart add -t freebsd -b ", $1, " -s ", $2, " -i ", $3, " $1"
 	}
 	END {
 		# Force slice 1 to be marked active. This is necessary



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202502120143.51C1hiJS051610>