diff options
author | Karol Lewandowski <k.lewandowsk@samsung.com> | 2024-04-04 14:15:27 +0200 |
---|---|---|
committer | Jaehoon Chung <jh80.chung@samsung.com> | 2024-04-05 09:15:09 +0900 |
commit | f14d5fc9eaa6bdf18d924e9ff10ba541cefb0241 (patch) | |
tree | e19dc3754aa2b46c675011f10a1c75a9566c9dee | |
parent | b9ff22773cde89556b8afd35be4bdc8a006c2a0f (diff) | |
download | u-boot-f14d5fc9eaa6bdf18d924e9ff10ba541cefb0241.tar.gz u-boot-f14d5fc9eaa6bdf18d924e9ff10ba541cefb0241.tar.bz2 u-boot-f14d5fc9eaa6bdf18d924e9ff10ba541cefb0241.zip |
tizen: sd_fusing.py: Catch kernel not being able to re-read partition table
sfdisk(8) by default request kernel to reread partition table but does not
seem to return error code when it fails to do so. This commit fixes followig
error:
The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Permission denied
The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or partx(8).
Syncing disks.
Traceback (most recent call last):
File "/usr/local/bin/sd_fusing.py", line 958, in <module>
check_partition_format(args, target)
File "/usr/local/bin/sd_fusing.py", line 711, in check_partition_format
mkpart(args, target)
File "/usr/local/bin/sd_fusing.py", line 596, in mkpart
d = "/dev/" + get_partition_device(target.device, i+1)
~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TypeError: can only concatenate str (not "NoneType") to str
Change-Id: I32e6636f0d374e5f4327d425373d8e38f48b7916
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
-rwxr-xr-x | scripts/tizen/sd_fusing.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/scripts/tizen/sd_fusing.py b/scripts/tizen/sd_fusing.py index a34c203b30..925d9f5e6e 100755 --- a/scripts/tizen/sd_fusing.py +++ b/scripts/tizen/sd_fusing.py @@ -667,7 +667,7 @@ def mkpart(args, target): sys.exit(1) logging.debug("New partition table:\n" + str(target.label)) - argv = ['sfdisk', '--wipe-partitions', 'always', Device] + argv = ['sfdisk', '--no-reread', '--wipe-partitions', 'always', Device] logging.debug(" ".join(argv)) proc = subprocess.run(argv, stdout=None, @@ -678,6 +678,16 @@ def mkpart(args, target): logging.error(f"New partition table:\n" + str(target.label)) sys.exit(1) + logging.debug("Requesting kernel to re-read partition table:\n" + str(target.label)) + argv = ['blockdev', '--rereadpt', Device] + logging.debug(" ".join(argv)) + proc = subprocess.run(argv, + stdout=None, + stderr=None) + if proc.returncode != 0: + logging.error(f"Failed to request kernel to reread partition table on {Device}. (Insufficient permissions?)") + sys.exit(1) + if target.bootcode: logging.debug("Writing bootcode\n") with open(Device, "wb") as f: |