diff options
author | Lee Chee Yang <chee.yang.lee@intel.com> | 2020-04-13 19:00:54 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-04-26 14:00:50 +0100 |
commit | df77ee47237244f400da4de62f201a55ec1a8f8d (patch) | |
tree | f2b70ad755be1a946b3980c56eec5215b19ce49e | |
parent | c7ce37d3dd3d4cb6c73d0c36e456b4cc589e5007 (diff) | |
download | poky-df77ee47237244f400da4de62f201a55ec1a8f8d.tar.gz |
wic: use Filesystem UUID when expand swap partition
part.get("uuid") return the Partition UUID from the partition
table instead of Filesystem UUID. This lead to swap partition
UUID not match/change when wic write expand swap partition.
change it to read the filesystem UUID using blkid. The output
from blkid should looks like this:
wic-partvzhiwq3s: LABEL="swap1" UUID="04e55c19-3f3f-4491-9e32-44eea8daa827" VERSION="1" TYPE="swap" USAGE="other"
[YOCTO #13313]
(From OE-Core rev: 683297eefebe83f848daad9927871242ab28ef91)
Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | scripts/lib/wic/engine.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py index 9ff4394757..018815b966 100644 --- a/scripts/lib/wic/engine.py +++ b/scripts/lib/wic/engine.py | |||
@@ -280,7 +280,7 @@ class Disk: | |||
280 | def __getattr__(self, name): | 280 | def __getattr__(self, name): |
281 | """Get path to the executable in a lazy way.""" | 281 | """Get path to the executable in a lazy way.""" |
282 | if name in ("mdir", "mcopy", "mdel", "mdeltree", "sfdisk", "e2fsck", | 282 | if name in ("mdir", "mcopy", "mdel", "mdeltree", "sfdisk", "e2fsck", |
283 | "resize2fs", "mkswap", "mkdosfs", "debugfs"): | 283 | "resize2fs", "mkswap", "mkdosfs", "debugfs","blkid"): |
284 | aname = "_%s" % name | 284 | aname = "_%s" % name |
285 | if aname not in self.__dict__: | 285 | if aname not in self.__dict__: |
286 | setattr(self, aname, find_executable(name, self.paths)) | 286 | setattr(self, aname, find_executable(name, self.paths)) |
@@ -543,7 +543,8 @@ class Disk: | |||
543 | logger.info("creating swap partition {}".format(pnum)) | 543 | logger.info("creating swap partition {}".format(pnum)) |
544 | label = part.get("name") | 544 | label = part.get("name") |
545 | label_str = "-L {}".format(label) if label else '' | 545 | label_str = "-L {}".format(label) if label else '' |
546 | uuid = part.get("uuid") | 546 | out = exec_cmd("{} --probe {}".format(self.blkid, self._get_part_image(pnum))) |
547 | uuid = out[out.index("UUID=\"")+6:out.index("UUID=\"")+42] | ||
547 | uuid_str = "-U {}".format(uuid) if uuid else '' | 548 | uuid_str = "-U {}".format(uuid) if uuid else '' |
548 | with open(partfname, 'w') as sparse: | 549 | with open(partfname, 'w') as sparse: |
549 | os.ftruncate(sparse.fileno(), part['size'] * self._lsector_size) | 550 | os.ftruncate(sparse.fileno(), part['size'] * self._lsector_size) |