Re: [RFC PATCH] kbuild: only prompt for compressors that are actually usable

From: Randy Dunlap
Date: Tue Oct 12 2021 - 15:45:04 EST


On 10/12/21 10:01 AM, Vegard Nossum wrote:
If a given compression algorithm for the kernel image is not usable on
the host system, there is no point prompting for it.

We can use the kconfig preprocessing feature to check if the command is
available or not. I've chosen to test this using "which", which exits
with success if the given command exists in PATH (or it is an absolute
path), which mimics exactly how it would be found in the kernel's
Makefiles.

Hi Vegard,

I have made a few patches that used "which", but I was always told
that the POSIX spelling of that command is "command -v", so that is
preferable.

This uses the make variables that are set in Makefile and/or the
command line, so you can do e.g.

make KGZIP=pigz menuconfig

and it will test for the correct program.

I am intentionally adding these dependencies to e.g. KERNEL_LZ4, as
opposed to HAVE_KERNEL_LZ4, since the latter are "select"-ed
unconditionally by the architectures that use them, so they are not
suitable for depending on anything else.

I've put RFC in the subject as maybe there are downsides to this that
I'm not aware of.

Signed-off-by: Vegard Nossum <vegard.nossum@xxxxxxxxxx>
---
init/Kconfig | 7 +++++++
1 file changed, 7 insertions(+)


--
~Randy