From 9ebc8301965b6b0aedc1d0cb8a9bc3e4893f2592 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Wed, 13 Dec 2017 22:20:25 -0500 Subject: wic: Introduce --fsuuid and have --use-uuid make use of UUID too First, allow for wic to be given a filesystem UUID to be used when creating a filesystem. When not provided, wic will generate the UUID to be used. Next, when --use-uuid is passed, we update the fstab to mount things via UUID (and if not found, then use PARTUUID) as UUID is more portable. (From OE-Core rev: 9256b8799495634ee8aee5d16ff71bd6e6e25ed4) Signed-off-by: Tom Rini Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- scripts/lib/wic/plugins/imager/direct.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'scripts/lib/wic/plugins/imager/direct.py') 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): 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 '' @@ -334,13 +342,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.""" -- cgit v1.2.3-54-g00ecf