aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Luis Duran <jlduran@FreeBSD.org>2025-02-04 14:07:00 +0000
committerJose Luis Duran <jlduran@FreeBSD.org>2025-02-04 14:07:00 +0000
commitdc4b36b96333f2ab05f3c454f0df2e0a0d4d451d (patch)
tree38ded6210f0fb5ecf9e419463bb141aa28a5b432
parentda1deb784d9ad3a4015a3f91fa1a5ce394fd3fdb (diff)
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
-rw-r--r--tools/tools/nanobsd/legacy.sh13
1 files 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