git: 6fc8d02b59dd - stable/13 - nanobsd: Always define the partition index
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 12 Feb 2025 01:44:28 UTC
The branch stable/13 has been updated by jlduran:
URL: https://cgit.FreeBSD.org/src/commit/?id=6fc8d02b59dd7c343a2ab681e57c13c27c6425f7
commit 6fc8d02b59dd7c343a2ab681e57c13c27c6425f7
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:38:47 +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