Skip to contentSkip to conversation

wic: fix calculation of partition number

PATCH New Ed Bartosh 1 participant 1 message Jul 17, 2017

lore
Share & tools
lore

Ed Bartosh

author
#0 lore raw

PATCH 1/1 wic: fix calculation of partition number

Total number of partitions should be taken into account when calculating real partition number for msdos partition table. The number can be different for the 4th partition: it can be 4 if there are 4 partitions in the table and 5 if there are more than 4 partitions in the table. In the latter case number 4 is occupied by extended partition.

[YOCTO #11790]

---
 scripts/lib/wic/imager/direct.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/lib/wic/imager/direct.py +1 -1
index edf5e5d..4c547e0 100644
@@ -108,7 +108,7 @@ class DirectImageCreator(BaseImageCreator):
             if pnum == num:
                 if  part.no_table:
                     return 0
-                if self.ptable_format == 'msdos' and realnum > 3:
+                if self.ptable_format == 'msdos' and realnum > 3 and len(parts) > 4:
                     # account for logical partition numbering, ex. sda5..
                     return realnum + 1
                 return realnum
Signature · 1 line
2.1.4