diff options
author | Marek Szyprowski <m.szyprowski@samsung.com> | 2024-08-07 08:50:34 +0200 |
---|---|---|
committer | Marek Szyprowski <m.szyprowski@samsung.com> | 2024-08-07 09:00:35 +0200 |
commit | 620423babf9659a6118669ed3e86b0b55464a6b4 (patch) | |
tree | 585f77a2eeee6ad16c0296663f1505d81b4bee44 | |
parent | 098472c46d682186866ef552362d1049a53baddf (diff) | |
download | u-boot-620423babf9659a6118669ed3e86b0b55464a6b4.tar.gz u-boot-620423babf9659a6118669ed3e86b0b55464a6b4.tar.bz2 u-boot-620423babf9659a6118669ed3e86b0b55464a6b4.zip |
scripts: sd_fusing: Wait for udev also after writing to the zero sector
Writing to the zero sector might trigger kernel/udev to re-read partition
table, so wait for udev to settle in such case.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I517570713bbaffaf58a849023eb784ca7675a842
-rwxr-xr-x | scripts/tizen/sd_fusing.py | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/scripts/tizen/sd_fusing.py b/scripts/tizen/sd_fusing.py index a40cbb7ed8..bd9d56e382 100755 --- a/scripts/tizen/sd_fusing.py +++ b/scripts/tizen/sd_fusing.py @@ -850,6 +850,19 @@ def check_sfdisk(): return True, support_delete +def wait_for_udev(): + # Run `udevadm settle` to ensure that partition change made by `sfdisk` or writing bootcode is completely reflected in userspace. + logging.info("Waiting for the udev event queue to empty...") + argv = ['udevadm', 'settle'] + logging.debug(" ".join(argv)) + proc = subprocess.run(argv, + stdout=None, + stderr=None) + if proc.returncode != 0: + logging.warning("udevadm settle exited without clearing the udev event queue.") + else: + logging.info("The udev event queue is empty.") + def mkpart(args, target): global Device new, support_delete = check_sfdisk() @@ -902,17 +915,7 @@ def mkpart(args, target): logging.error(f"New partition table:\n" + str(target.label)) sys.exit(1) - # Run `udevadm settle` to ensure that partition change made by `sfdisk` is completely reflected in userspace. - logging.info("Waiting for the udev event queue to empty...") - argv = ['udevadm', 'settle'] - logging.debug(" ".join(argv)) - proc = subprocess.run(argv, - stdout=None, - stderr=None) - if proc.returncode != 0: - logging.warning("udevadm settle exited without clearing the udev event queue.") - else: - logging.info("The udev event queue is empty.") + wait_for_udev() for i, part in enumerate(target.part_table): d = "/dev/" + get_partition_device(target.device, i+1) @@ -1101,6 +1104,11 @@ def do_fuse_raw(f, name, target, sector): buf = f.read(1 << 9) proc_dd.communicate() logging.info("Done") + + # writing to sector zero might trigger kernel/udev to re-read partition table + if sector == 0: + wait_for_udev() + #TODO: verification def do_fuse_file(f, name, target): |