mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 17:13:52 +02:00
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>
This commit is contained in:
parent
9a329df6e0
commit
fcdcf22a34
|
|
@ -50,11 +50,12 @@ import libfdt
|
||||||
CompTool = collections.namedtuple('CompTool', 'ext,tools')
|
CompTool = collections.namedtuple('CompTool', 'ext,tools')
|
||||||
|
|
||||||
COMP_TOOLS = {
|
COMP_TOOLS = {
|
||||||
'bzip2': CompTool('.bz2', 'bzip2'),
|
'bzip2': CompTool('.bz2', 'pbzip2,bzip2'),
|
||||||
'gzip': CompTool('.gz', 'pigz,gzip'),
|
'gzip': CompTool('.gz', 'pigz,gzip'),
|
||||||
'lz4': CompTool('.lz4', 'lz4'),
|
'lz4': CompTool('.lz4', 'lz4'),
|
||||||
'lzma': CompTool('.lzma', 'lzma'),
|
'lzma': CompTool('.lzma', 'plzip,lzma'),
|
||||||
'lzo': CompTool('.lzo', 'lzop'),
|
'lzo': CompTool('.lzo', 'lzop'),
|
||||||
|
'xz': CompTool('.xz', 'xz'),
|
||||||
'zstd': CompTool('.zstd', 'zstd'),
|
'zstd': CompTool('.zstd', 'zstd'),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -207,7 +208,12 @@ def compress_data(inf, compress):
|
||||||
done = False
|
done = False
|
||||||
for tool in comp.tools.split(','):
|
for tool in comp.tools.split(','):
|
||||||
try:
|
try:
|
||||||
subprocess.call([tool, '-c'], stdin=inf, stdout=outf)
|
# Add parallel flags for tools that support them
|
||||||
|
cmd = [tool]
|
||||||
|
if tool in ('zstd', 'xz'):
|
||||||
|
cmd.extend(['-T0']) # Use all available cores
|
||||||
|
cmd.append('-c')
|
||||||
|
subprocess.call(cmd, stdin=inf, stdout=outf)
|
||||||
done = True
|
done = True
|
||||||
break
|
break
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user