diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2017-02-10 16:37:22 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-02-15 20:06:45 -0800 |
commit | 924e84ea8dea6b0f8bb724aa9fc84d4d851c2308 (patch) | |
tree | a92180d216d91a51099d5ffc6f22968708868f23 /scripts | |
parent | 32e2d929136550962f3bc108f51c7161f40d96b2 (diff) | |
download | poky-924e84ea8dea6b0f8bb724aa9fc84d4d851c2308.tar.gz |
wic: direct: move generation of part.realnum to PartitionedImage
Moved the code that generates real partition numbers from DirectPlugin
to PartitionedImage.
The idea is to have all code that works with partitions
in PartitionedImage class.
(From OE-Core rev: dbd58b0b32288821d9dd5d1a3118cf7c6e8f098a)
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/wic/plugins/imager/direct.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py index 9c4109e6b8..c517904ed1 100644 --- a/scripts/lib/wic/plugins/imager/direct.py +++ b/scripts/lib/wic/plugins/imager/direct.py | |||
@@ -74,19 +74,6 @@ class DirectPlugin(ImagerPlugin): | |||
74 | self.ptable_format = self.ks.bootloader.ptable | 74 | self.ptable_format = self.ks.bootloader.ptable |
75 | self.parts = self.ks.partitions | 75 | self.parts = self.ks.partitions |
76 | 76 | ||
77 | # calculate the real partition number, accounting for partitions not | ||
78 | # in the partition table and logical partitions | ||
79 | realnum = 0 | ||
80 | for part in self.parts: | ||
81 | if part.no_table: | ||
82 | part.realnum = 0 | ||
83 | else: | ||
84 | realnum += 1 | ||
85 | if self.ptable_format == 'msdos' and realnum > 3: | ||
86 | part.realnum = realnum + 1 | ||
87 | continue | ||
88 | part.realnum = realnum | ||
89 | |||
90 | # as a convenience, set source to the boot partition source | 77 | # as a convenience, set source to the boot partition source |
91 | # instead of forcing it to be set via bootloader --source | 78 | # instead of forcing it to be set via bootloader --source |
92 | for part in self.parts: | 79 | for part in self.parts: |
@@ -317,6 +304,19 @@ class PartitionedImage(): | |||
317 | self.sector_size = SECTOR_SIZE | 304 | self.sector_size = SECTOR_SIZE |
318 | self.native_sysroot = native_sysroot | 305 | self.native_sysroot = native_sysroot |
319 | 306 | ||
307 | # calculate the real partition number, accounting for partitions not | ||
308 | # in the partition table and logical partitions | ||
309 | realnum = 0 | ||
310 | for part in self.partitions: | ||
311 | if part.no_table: | ||
312 | part.realnum = 0 | ||
313 | else: | ||
314 | realnum += 1 | ||
315 | if self.ptable_format == 'msdos' and realnum > 3: | ||
316 | part.realnum = realnum + 1 | ||
317 | continue | ||
318 | part.realnum = realnum | ||
319 | |||
320 | # generate parition UUIDs | 320 | # generate parition UUIDs |
321 | for part in self.partitions: | 321 | for part in self.partitions: |
322 | if not part.uuid and part.use_uuid: | 322 | if not part.uuid and part.use_uuid: |