mirror of
https://git.yoctoproject.org/poky
synced 2026-09-13 09:49:32 +02:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
c7ce37d3dd
commit
df77ee4723
@@ -280,7 +280,7 @@ class Disk:
|
|||||||
def __getattr__(self, name):
|
def __getattr__(self, name):
|
||||||
"""Get path to the executable in a lazy way."""
|
"""Get path to the executable in a lazy way."""
|
||||||
if name in ("mdir", "mcopy", "mdel", "mdeltree", "sfdisk", "e2fsck",
|
if name in ("mdir", "mcopy", "mdel", "mdeltree", "sfdisk", "e2fsck",
|
||||||
"resize2fs", "mkswap", "mkdosfs", "debugfs"):
|
"resize2fs", "mkswap", "mkdosfs", "debugfs","blkid"):
|
||||||
aname = "_%s" % name
|
aname = "_%s" % name
|
||||||
if aname not in self.__dict__:
|
if aname not in self.__dict__:
|
||||||
setattr(self, aname, find_executable(name, self.paths))
|
setattr(self, aname, find_executable(name, self.paths))
|
||||||
@@ -543,7 +543,8 @@ class Disk:
|
|||||||
logger.info("creating swap partition {}".format(pnum))
|
logger.info("creating swap partition {}".format(pnum))
|
||||||
label = part.get("name")
|
label = part.get("name")
|
||||||
label_str = "-L {}".format(label) if label else ''
|
label_str = "-L {}".format(label) if label else ''
|
||||||
uuid = part.get("uuid")
|
out = exec_cmd("{} --probe {}".format(self.blkid, self._get_part_image(pnum)))
|
||||||
|
uuid = out[out.index("UUID=\"")+6:out.index("UUID=\"")+42]
|
||||||
uuid_str = "-U {}".format(uuid) if uuid else ''
|
uuid_str = "-U {}".format(uuid) if uuid else ''
|
||||||
with open(partfname, 'w') as sparse:
|
with open(partfname, 'w') as sparse:
|
||||||
os.ftruncate(sparse.fileno(), part['size'] * self._lsector_size)
|
os.ftruncate(sparse.fileno(), part['size'] * self._lsector_size)
|
||||||
|
|||||||
Reference in New Issue
Block a user