diff options
author | Kristian Amlie <kristian.amlie@mender.io> | 2017-03-10 14:16:27 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-03-22 11:35:20 +0000 |
commit | 76d182c757d6df47f315164163676e276f7379b1 (patch) | |
tree | 057b94b954fdadacda8fa4e5d3bee98146559499 /scripts/lib | |
parent | b2cd8759b16167d1a983d72a5494f5a213de9b54 (diff) | |
download | poky-76d182c757d6df47f315164163676e276f7379b1.tar.gz |
wic/partionedfs: Avoid reserving space for non-existing ext. partition
We don't need the gap that the extended partition occupies if we
already know that we have less than five partitions. Saves up to one
full alignment of space.
(From OE-Core rev: 485315dc170e29962a8848db38db73abafd0586e)
Signed-off-by: Kristian Amlie <kristian.amlie@mender.io>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib')
-rw-r--r-- | scripts/lib/wic/plugins/imager/direct.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py index 235eb24f59..7d38ab34fb 100644 --- a/scripts/lib/wic/plugins/imager/direct.py +++ b/scripts/lib/wic/plugins/imager/direct.py | |||
@@ -344,6 +344,10 @@ class PartitionedImage(): | |||
344 | 344 | ||
345 | logger.debug("Assigning %s partitions to disks", self.ptable_format) | 345 | logger.debug("Assigning %s partitions to disks", self.ptable_format) |
346 | 346 | ||
347 | # The number of primary and logical partitions. Extended partition and | ||
348 | # partitions not listed in the table are not included. | ||
349 | num_real_partitions = len([p for p in self.partitions if not p.no_table]) | ||
350 | |||
347 | # Go through partitions in the order they are added in .ks file | 351 | # Go through partitions in the order they are added in .ks file |
348 | for num in range(len(self.partitions)): | 352 | for num in range(len(self.partitions)): |
349 | part = self.partitions[num] | 353 | part = self.partitions[num] |
@@ -369,7 +373,7 @@ class PartitionedImage(): | |||
369 | # Skip one sector required for the partitioning scheme overhead | 373 | # Skip one sector required for the partitioning scheme overhead |
370 | self.offset += overhead | 374 | self.offset += overhead |
371 | 375 | ||
372 | if self.realpart > 3: | 376 | if self.realpart > 3 and num_real_partitions > 4: |
373 | # Reserve a sector for EBR for every logical partition | 377 | # Reserve a sector for EBR for every logical partition |
374 | # before alignment is performed. | 378 | # before alignment is performed. |
375 | if self.ptable_format == "msdos": | 379 | if self.ptable_format == "msdos": |
@@ -408,7 +412,7 @@ class PartitionedImage(): | |||
408 | 412 | ||
409 | if self.ptable_format == "msdos": | 413 | if self.ptable_format == "msdos": |
410 | # only count the partitions that are in partition table | 414 | # only count the partitions that are in partition table |
411 | if len([p for p in self.partitions if not p.no_table]) > 4: | 415 | if num_real_partitions > 4: |
412 | if self.realpart > 3: | 416 | if self.realpart > 3: |
413 | part.type = 'logical' | 417 | part.type = 'logical' |
414 | part.num = self.realpart + 1 | 418 | part.num = self.realpart + 1 |