summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/plugins
diff options
context:
space:
mode:
authorJoshua Watt <JPEWhacker@gmail.com>2020-06-02 08:42:05 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-06-04 13:27:32 +0100
commitba9be4bfa58efc73f1485eb5dc0dff0d23716821 (patch)
treeaf7a989c4e2caf3c08c2b7f77be5679c533966ca /scripts/lib/wic/plugins
parent6b4299df5d86ba079e7525ad09def756359b9502 (diff)
downloadpoky-ba9be4bfa58efc73f1485eb5dc0dff0d23716821.tar.gz
wic: Add --offset argument for partitions
Add support for an --offset argument when defining a partition. Many SoCs require that boot partitions be located at specific offsets. Prior to this argument, most WKS files were using the --align attribute to specify the location of these fixed partitions but this is not ideal because in the event that the partition couldn't be placed in the specified location, wic would move it to the next sector with that alignment, often preventing the device from booting. Unlike the --align argument, wic will fail if a partition cannot be placed at the exact offset specified with --offset. Changes in V2: * Fixed a small typo that prevented test_fixed_size_error from passing (From OE-Core rev: 467f84e12b96bc977d57575023517dd6f8ef7f29) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/wic/plugins')
-rw-r--r--scripts/lib/wic/plugins/imager/direct.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
index 2d06c242b6..1f65a7afe5 100644
--- a/scripts/lib/wic/plugins/imager/direct.py
+++ b/scripts/lib/wic/plugins/imager/direct.py
@@ -428,6 +428,21 @@ class PartitionedImage():
428 # increase the offset so we actually start the partition on right alignment 428 # increase the offset so we actually start the partition on right alignment
429 self.offset += align_sectors 429 self.offset += align_sectors
430 430
431 if part.offset is not None:
432 offset = (part.offset * 1024) // self.sector_size
433
434 if offset * self.sector_size != part.offset * 1024:
435 raise WicError("Could not place %s%s at offset %dK with sector size %d" % (part.disk, self.numpart, part.offset, self.sector_size))
436
437 delta = offset - self.offset
438 if delta < 0:
439 raise WicError("Could not place %s%s at offset %dK: next free sector is %d (delta: %d)" % (part.disk, self.numpart, part.offset, offset, delta))
440
441 logger.debug("Skipping %d sectors to place %s%s at offset %dK",
442 delta, part.disk, self.numpart, part.offset)
443
444 self.offset = offset
445
431 part.start = self.offset 446 part.start = self.offset
432 self.offset += part.size_sec 447 self.offset += part.size_sec
433 448