]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
runqemu: use "zstd -o" to preserve sparse images
authorYoann Congal <yoann.congal@smile.fr>
Wed, 6 Aug 2025 15:55:48 +0000 (17:55 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 7 Aug 2025 09:43:42 +0000 (10:43 +0100)
wic images can be sparse. Using "zstd -o" preserves the sparse state of
the image and should decrease decompression time.

Suggested-by: Adrian Freihofer <adrian.freihofer@gmail.com>
Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/runqemu

index 827300080a2904435b969cd399a91e84c10fd60f..4fb85177e3144f960e84dd3a8dfa62541b4776bb 100755 (executable)
@@ -448,8 +448,7 @@ class BaseConfig(object):
             if not shutil.which('zstd'):
                 raise RunQemuError(f"'zstd' is required to decompress {self.rootfs} but was not found in PATH")
             try:
-                with open(uncompressed_path, 'wb') as out_file:
-                    subprocess.check_call(['zstd', '-d', '-c', image_path], stdout=out_file)
+                subprocess.check_call(['zstd', '-d', image_path, '-o', uncompressed_path])
             except subprocess.CalledProcessError as e:
                 self.cleanup_files.append(uncompressed_path)
                 raise RunQemuError(f"Failed to decompress {self.rootfs}: {e}")