From: SangYoun Kwak Date: Thu, 11 Jul 2024 11:46:50 +0000 (+0900) Subject: scripts: sd_fusing: Fix to write both a/b partition X-Git-Tag: accepted/tizen/unified/20240806.010530~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0974a9f2001aeffca853f41db50ab1fff52e61f8;p=platform%2Fkernel%2Fu-boot.git scripts: sd_fusing: Fix to write both a/b partition If sd_fusing script is executed with '--update ab' option, it should write images to both a/b partitions. When writing images, first, script reads image and writes to the partition a until the image reaches the end. Next, script reads image and writes to the partition b but it uses same file object so there is nothing left to read. Thus, script writes nothing to the partition b. To fix this issue, a method call of the file object ".seek(0)" is added before writing to the partitions. This will set cursor to the initial position and the the image can be written to the partition b. Change-Id: I78c1b3c77b6666a133527ba544911de8c4de44d4 Signed-off-by: SangYoun Kwak --- diff --git a/scripts/tizen/sd_fusing.py b/scripts/tizen/sd_fusing.py index bd1c635862..c776a3c605 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.6" +__version__ = "1.1.7" Format = False Device = "" @@ -1093,6 +1093,7 @@ def do_fuse_file(f, name, target): stdin=subprocess.PIPE, stdout=None, stderr=None) logging.notice(f"Writing {name} to {pdevice}") + f.seek(0) buf = f.read(4 << 20) while len(buf) > 0: proc_dd.stdin.write(buf)