From: Łukasz Stelmach Date: Thu, 13 Jun 2024 11:12:41 +0000 (+0200) Subject: scripts: sd_fusing: support device symlinks in ensure_parttable() X-Git-Tag: accepted/tizen/unified/x/20240708.014816~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=94c72f097369eca6be604b2815fe13a1d5ca725b;p=platform%2Fkernel%2Fu-boot.git scripts: sd_fusing: support device symlinks in ensure_parttable() sd_fusing needs to support referring to devices by symlinks created by udev like /dev/disk/by-id/usb-Generic_STORAGE_DEVICE_000000000272-0. Their partitions are named /dev/disk/by-id/usb-Generic_STORAGE_DEVICE_000000000272-0-partX. Therefore there is no universal way to access both /dev/sdXY and the symlinked partitions and using get_partition_device() is the way to go. Change-Id: I4c586f8e9b6e3940faa6055c90835bbff1777ec5 Fixes: 43ab41c7e7 ("sd_fusing.py: Ensure selected flashing target actually matches what is on device") Signed-off-by: Łukasz Stelmach --- diff --git a/scripts/tizen/sd_fusing.py b/scripts/tizen/sd_fusing.py index 8f57d15a8b..1996250aa6 100755 --- a/scripts/tizen/sd_fusing.py +++ b/scripts/tizen/sd_fusing.py @@ -15,7 +15,7 @@ import sys import tarfile import tempfile -__version__ = "1.1.2" +__version__ = "1.1.3" Format = False Device = "" @@ -179,7 +179,8 @@ class SdFusingTarget: def ensure_parttable(self): logging.notice(f"Verifying that partition table on {Device} matches target specification") for partnum, part in enumerate(self.part_table, 1): - bo = subprocess.check_output(["blkid", "-o", "export", Device + str(partnum)]).decode('utf-8') + d = "/dev/" + get_partition_device(Device, partnum) + bo = subprocess.check_output(["blkid", "-o", "export", d]).decode('utf-8') if "PARTLABEL=" in bo and f"PARTLABEL={part['name']}" not in bo: logging.error(f'On-device partition label mismatch with selected target: partlabel={part["name"]}, on-device:\n{bo}') sys.exit(1)