aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMaciej Borzecki <maciej.borzecki@open-rnd.pl>2014-08-19 15:14:18 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-08-23 09:25:04 +0100
commit92a1b83d928173a58280ca019ca81fdeb5ba72b5 (patch)
tree5aa146fe57de086953a35b1c5d34abd5a8982b34 /scripts
parentc3251d4191fb0b7c3477a3579e542729598f6aad (diff)
downloadopenembedded-core-contrib-92a1b83d928173a58280ca019ca81fdeb5ba72b5.tar.gz
wic: do not realign aligned partitions
The change prevents additional realignment of already aligned partition. Previously, even already aligned partitions would be pushed forward by the amount of --align. Signed-off-by: Maciej Borzecki <maciej.borzecki@open-rnd.pl> Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/wic/utils/partitionedfs.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/scripts/lib/wic/utils/partitionedfs.py b/scripts/lib/wic/utils/partitionedfs.py
index 36ef4063d1..791f488cd6 100644
--- a/scripts/lib/wic/utils/partitionedfs.py
+++ b/scripts/lib/wic/utils/partitionedfs.py
@@ -164,16 +164,19 @@ class Image:
# Calc how much the alignment is off.
align_sectors = d['offset'] % (p['align'] * 1024 / self.sector_size)
- # We need to move forward to the next alignment point
- align_sectors = (p['align'] * 1024 / self.sector_size) - align_sectors
- msger.debug("Realignment for %s%s with %s sectors, original"
- " offset %s, target alignment is %sK." %
- (p['disk_name'], d['numpart'], align_sectors,
- d['offset'], p['align']))
+ if align_sectors:
+ # If partition is not aligned as required, we need
+ # to move forward to the next alignment point
+ align_sectors = (p['align'] * 1024 / self.sector_size) - align_sectors
- # increase the offset so we actually start the partition on right alignment
- d['offset'] += align_sectors
+ msger.debug("Realignment for %s%s with %s sectors, original"
+ " offset %s, target alignment is %sK." %
+ (p['disk_name'], d['numpart'], align_sectors,
+ d['offset'], p['align']))
+
+ # increase the offset so we actually start the partition on right alignment
+ d['offset'] += align_sectors
p['start'] = d['offset']
d['offset'] += p['size']