Skip to content

Commit fcdcf22

Browse files
sjg20nathanchance
authored andcommitted
scripts/make_fit: Support a few more parallel compressors
Add support for pbzip2, xz and plzip which can compress in parallel. This speeds up the ramdisk compression. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Nicolas Schier <nsc@kernel.org> Link: https://patch.msgid.link/20260106162738.2605574-6-sjg@chromium.org Signed-off-by: Nathan Chancellor <nathan@kernel.org>
1 parent 9a329df commit fcdcf22

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

scripts/make_fit.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,12 @@
5050
CompTool = collections.namedtuple('CompTool', 'ext,tools')
5151

5252
COMP_TOOLS = {
53-
'bzip2': CompTool('.bz2', 'bzip2'),
53+
'bzip2': CompTool('.bz2', 'pbzip2,bzip2'),
5454
'gzip': CompTool('.gz', 'pigz,gzip'),
5555
'lz4': CompTool('.lz4', 'lz4'),
56-
'lzma': CompTool('.lzma', 'lzma'),
56+
'lzma': CompTool('.lzma', 'plzip,lzma'),
5757
'lzo': CompTool('.lzo', 'lzop'),
58+
'xz': CompTool('.xz', 'xz'),
5859
'zstd': CompTool('.zstd', 'zstd'),
5960
}
6061

@@ -207,7 +208,12 @@ def compress_data(inf, compress):
207208
done = False
208209
for tool in comp.tools.split(','):
209210
try:
210-
subprocess.call([tool, '-c'], stdin=inf, stdout=outf)
211+
# Add parallel flags for tools that support them
212+
cmd = [tool]
213+
if tool in ('zstd', 'xz'):
214+
cmd.extend(['-T0']) # Use all available cores
215+
cmd.append('-c')
216+
subprocess.call(cmd, stdin=inf, stdout=outf)
211217
done = True
212218
break
213219
except FileNotFoundError:

0 commit comments

Comments
 (0)