summaryrefslogtreecommitdiffstats
path: root/import-layers/yocto-poky/scripts/lib/wic/plugins/imager/direct.py
diff options
context:
space:
mode:
Diffstat (limited to 'import-layers/yocto-poky/scripts/lib/wic/plugins/imager/direct.py')
-rw-r--r--import-layers/yocto-poky/scripts/lib/wic/plugins/imager/direct.py24
1 files changed, 21 insertions, 3 deletions
diff --git a/import-layers/yocto-poky/scripts/lib/wic/plugins/imager/direct.py b/import-layers/yocto-poky/scripts/lib/wic/plugins/imager/direct.py
index da1c06106..1fa6b917e 100644
--- a/import-layers/yocto-poky/scripts/lib/wic/plugins/imager/direct.py
+++ b/import-layers/yocto-poky/scripts/lib/wic/plugins/imager/direct.py
@@ -63,6 +63,7 @@ class DirectPlugin(ImagerPlugin):
# parse possible 'rootfs=name' items
self.rootfs_dir = dict(rdir.split('=') for rdir in rootfs_dir.split(' '))
+ self.replaced_rootfs_paths = {}
self.bootimg_dir = bootimg_dir
self.kernel_dir = kernel_dir
self.native_sysroot = native_sysroot
@@ -141,7 +142,15 @@ class DirectPlugin(ImagerPlugin):
continue
if part.use_uuid:
- device_name = "PARTUUID=%s" % part.uuid
+ if part.fsuuid:
+ # FAT UUID is different from others
+ if len(part.fsuuid) == 10:
+ device_name = "UUID=%s-%s" % \
+ (part.fsuuid[2:6], part.fsuuid[6:])
+ else:
+ device_name = "UUID=%s" % part.fsuuid
+ else:
+ device_name = "PARTUUID=%s" % part.uuid
else:
# mmc device partitions are named mmcblk0p1, mmcblk0p2..
prefix = 'p' if part.disk.startswith('mmcblk') else ''
@@ -175,6 +184,7 @@ class DirectPlugin(ImagerPlugin):
new_rootfs = self._write_fstab(self.rootfs_dir.get("ROOTFS_DIR"))
if new_rootfs:
# rootfs was copied to update fstab
+ self.replaced_rootfs_paths[new_rootfs] = self.rootfs_dir['ROOTFS_DIR']
self.rootfs_dir['ROOTFS_DIR'] = new_rootfs
for part in self.parts:
@@ -250,7 +260,10 @@ class DirectPlugin(ImagerPlugin):
suffix = ':'
else:
suffix = '["%s"]:' % (part.mountpoint or part.label)
- msg += ' ROOTFS_DIR%s%s\n' % (suffix.ljust(20), part.rootfs_dir)
+ rootdir = part.rootfs_dir
+ if rootdir in self.replaced_rootfs_paths:
+ rootdir = self.replaced_rootfs_paths[rootdir]
+ msg += ' ROOTFS_DIR%s%s\n' % (suffix.ljust(20), rootdir)
msg += ' BOOTIMG_DIR: %s\n' % self.bootimg_dir
msg += ' KERNEL_DIR: %s\n' % self.kernel_dir
@@ -334,13 +347,18 @@ class PartitionedImage():
continue
part.realnum = realnum
- # generate parition UUIDs
+ # generate parition and filesystem UUIDs
for part in self.partitions:
if not part.uuid and part.use_uuid:
if self.ptable_format == 'gpt':
part.uuid = str(uuid.uuid4())
else: # msdos partition table
part.uuid = '%08x-%02d' % (self.identifier, part.realnum)
+ if not part.fsuuid:
+ if part.fstype == 'vfat' or part.fstype == 'msdos':
+ part.fsuuid = '0x' + str(uuid.uuid4())[:8].upper()
+ else:
+ part.fsuuid = str(uuid.uuid4())
def prepare(self, imager):
"""Prepare an image. Call prepare method of all image partitions."""
OpenPOWER on IntegriCloud