mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
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 in587c054bea("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:587c054bea("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)
This commit is contained in:
parent
916ee8225f
commit
e58d9b71f3
1 changed files with 6 additions and 7 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue