mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-11-07 04:36:52 -10:00
mkimg: Ignore redundant %align values
Partitions are trivially aligned to sector boundaries, so asking e.g. for a partition to be aligned to a 64-byte boundary is pointless but harmless. Treat it as such, with a warning (in case the request was a mistake, e.g. requesting 1-byte instead of 1M-byte alignment) rather than as an error. Reviewed by: markj Suggested by: markj MFC after: 1 week Sponsored by: Amazon Differential Revision: https://reviews.freebsd.org/D60819
This commit is contained in:
1 parent
5774911bfb
commit
da04cf02c9
1 file changed
+9
-1
@@ -516,7 +516,15 @@ mkimg(void)
|
||||
if (expand_number(align, &bytealign) == -1)
|
||||
err(EX_DATAERR, "partition %d",
|
||||
part->index + 1);
|
||||
if ((bytealign == 0) || (bytealign % secsz != 0))
|
||||
if (bytealign == 0)
|
||||
errx(EX_DATAERR, "partition %d: "
|
||||
"invalid alignment", part->index + 1);
|
||||
if (secsz % bytealign == 0) {
|
||||
warnx("partition %d: ignoring "
|
||||
"redundant alignment", part->index + 1);
|
||||
bytealign = secsz;
|
||||
}
|
||||
if (bytealign % secsz != 0)
|
||||
errx(EX_DATAERR, "partition %d: "
|
||||
"invalid alignment", part->index + 1);
|
||||
blkalign = bytealign / secsz;
|
||||
|
||||
Reference in new issue
Block a user