diff options
Diffstat (limited to 'import-layers/yocto-poky/scripts/lib/wic/plugins')
4 files changed, 26 insertions, 6 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.""" diff --git a/import-layers/yocto-poky/scripts/lib/wic/plugins/source/bootimg-efi.py b/import-layers/yocto-poky/scripts/lib/wic/plugins/source/bootimg-efi.py index 4c4f36a32..beb74d7a7 100644 --- a/import-layers/yocto-poky/scripts/lib/wic/plugins/source/bootimg-efi.py +++ b/import-layers/yocto-poky/scripts/lib/wic/plugins/source/bootimg-efi.py @@ -240,7 +240,8 @@ class BootimgEFIPlugin(SourcePlugin): # dosfs image, created by mkdosfs bootimg = "%s/boot.img" % cr_workdir - dosfs_cmd = "mkdosfs -n efi -C %s %d" % (bootimg, blocks) + dosfs_cmd = "mkdosfs -n efi -i %s -C %s %d" % \ + (part.fsuuid, bootimg, blocks) exec_native_cmd(dosfs_cmd, native_sysroot) mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (bootimg, hdddir) diff --git a/import-layers/yocto-poky/scripts/lib/wic/plugins/source/bootimg-partition.py b/import-layers/yocto-poky/scripts/lib/wic/plugins/source/bootimg-partition.py index 67e5498d5..b239fc0b4 100644 --- a/import-layers/yocto-poky/scripts/lib/wic/plugins/source/bootimg-partition.py +++ b/import-layers/yocto-poky/scripts/lib/wic/plugins/source/bootimg-partition.py @@ -129,4 +129,4 @@ class BootimgPartitionPlugin(SourcePlugin): logger.debug('Prepare boot partition using rootfs in %s', hdddir) part.prepare_rootfs(cr_workdir, oe_builddir, hdddir, - native_sysroot) + native_sysroot, False) diff --git a/import-layers/yocto-poky/scripts/lib/wic/plugins/source/bootimg-pcbios.py b/import-layers/yocto-poky/scripts/lib/wic/plugins/source/bootimg-pcbios.py index 56da468fb..d599112dd 100644 --- a/import-layers/yocto-poky/scripts/lib/wic/plugins/source/bootimg-pcbios.py +++ b/import-layers/yocto-poky/scripts/lib/wic/plugins/source/bootimg-pcbios.py @@ -186,7 +186,8 @@ class BootimgPcbiosPlugin(SourcePlugin): # dosfs image, created by mkdosfs bootimg = "%s/boot%s.img" % (cr_workdir, part.lineno) - dosfs_cmd = "mkdosfs -n boot -S 512 -C %s %d" % (bootimg, blocks) + dosfs_cmd = "mkdosfs -n boot -i %s -S 512 -C %s %d" % \ + (part.fsuuid, bootimg, blocks) exec_native_cmd(dosfs_cmd, native_sysroot) mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (bootimg, hdddir) |