Re: [PATCH v2 21/21] kbuild: use pigz for gzip compression if available
From: Kees Cook
Date: Tue Sep 15 2026 - 21:06:52 EST
On Mon, Sep 14, 2026 at 10:22:20AM +0100, Lorenzo Stoakes (ARM) wrote:
> diff --git a/Makefile b/Makefile
> index 790ef23c5e8a..38c0cdc9f591 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -561,7 +561,7 @@ PERL = perl
> PYTHON3 = python3
> CHECK = sparse
> BASH = bash
> -KGZIP = gzip
> +KGZIP := $(if $(shell command -v pigz 2>/dev/null),pigz,gzip)
> KBZIP2 = bzip2
> KLZOP = lzop
> LZMA = lzma
I had another idea that I think solves both my concerns (limits
to parallelism, new surprise users) and your concerns (complexity,
single-threaded when needed)... how about:
Makefile:
KPGZIP := $(if $(shell command -v pigz 2>/dev/null),$(PYTHON3) $(abs_srctree)/scripts/jobserver-exec $(abs_srctree)/scripts/parallel-gzip,gzip)
and the same scripts/parallel-gzip:
#!/bin/sh
exec pigz -p ${PARALLELISM:-1} "$@"
And then replace the /boot/ KGZIP uses with KPGZIP. Then we don't need
to change modules, config_data, new users, nor cmd_gzip, etc, which all
continue to use the regular KGZIP and the "use python" part for the
KPGZIP case becomes is a 1-time cost?
-Kees
--
Kees Cook