diff options
Diffstat (limited to 'scripts/lib/wic/plugins/imager')
-rw-r--r-- | scripts/lib/wic/plugins/imager/direct.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py index da1c061063..71c0b1c82b 100644 --- a/scripts/lib/wic/plugins/imager/direct.py +++ b/scripts/lib/wic/plugins/imager/direct.py | |||
@@ -141,7 +141,15 @@ class DirectPlugin(ImagerPlugin): | |||
141 | continue | 141 | continue |
142 | 142 | ||
143 | if part.use_uuid: | 143 | if part.use_uuid: |
144 | device_name = "PARTUUID=%s" % part.uuid | 144 | if part.fsuuid: |
145 | # FAT UUID is different from others | ||
146 | if len(part.fsuuid) == 10: | ||
147 | device_name = "UUID=%s-%s" % \ | ||
148 | (part.fsuuid[2:6], part.fsuuid[6:]) | ||
149 | else: | ||
150 | device_name = "UUID=%s" % part.fsuuid | ||
151 | else: | ||
152 | device_name = "PARTUUID=%s" % part.uuid | ||
145 | else: | 153 | else: |
146 | # mmc device partitions are named mmcblk0p1, mmcblk0p2.. | 154 | # mmc device partitions are named mmcblk0p1, mmcblk0p2.. |
147 | prefix = 'p' if part.disk.startswith('mmcblk') else '' | 155 | prefix = 'p' if part.disk.startswith('mmcblk') else '' |
@@ -334,13 +342,18 @@ class PartitionedImage(): | |||
334 | continue | 342 | continue |
335 | part.realnum = realnum | 343 | part.realnum = realnum |
336 | 344 | ||
337 | # generate parition UUIDs | 345 | # generate parition and filesystem UUIDs |
338 | for part in self.partitions: | 346 | for part in self.partitions: |
339 | if not part.uuid and part.use_uuid: | 347 | if not part.uuid and part.use_uuid: |
340 | if self.ptable_format == 'gpt': | 348 | if self.ptable_format == 'gpt': |
341 | part.uuid = str(uuid.uuid4()) | 349 | part.uuid = str(uuid.uuid4()) |
342 | else: # msdos partition table | 350 | else: # msdos partition table |
343 | part.uuid = '%08x-%02d' % (self.identifier, part.realnum) | 351 | part.uuid = '%08x-%02d' % (self.identifier, part.realnum) |
352 | if not part.fsuuid: | ||
353 | if part.fstype == 'vfat' or part.fstype == 'msdos': | ||
354 | part.fsuuid = '0x' + str(uuid.uuid4())[:8].upper() | ||
355 | else: | ||
356 | part.fsuuid = str(uuid.uuid4()) | ||
344 | 357 | ||
345 | def prepare(self, imager): | 358 | def prepare(self, imager): |
346 | """Prepare an image. Call prepare method of all image partitions.""" | 359 | """Prepare an image. Call prepare method of all image partitions.""" |