[PATCH 6/6] init/Kconfig: Select decompressing method if compressing kernel

From: Pingfan Liu
Date: Sun Mar 05 2023 - 22:04:09 EST


If choosing an EFI_ZBOOT image, the corresponding decompressing method
should be selected so that kexec can load that zboot image.

This can be achieved when "Kernel compression mode" is determined.

Signed-off-by: Pingfan Liu <kernelfans@xxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
Cc: Masahiro Yamada <masahiroy@xxxxxxxxxx>
Cc: Johannes Weiner <hannes@xxxxxxxxxxx>
Cc: Nathan Chancellor <nathan@xxxxxxxxxx>
Cc: Miguel Ojeda <ojeda@xxxxxxxxxx>
Cc: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
Cc: Ard Biesheuvel <ardb@xxxxxxxxxx>
Cc: kexec@xxxxxxxxxxxxxxxxxxx
To: linux-kernel@xxxxxxxxxxxxxxx
---
init/Kconfig | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/init/Kconfig b/init/Kconfig
index 44e90b28a30f..046724208645 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -269,6 +269,7 @@ choice
config KERNEL_GZIP
bool "Gzip"
depends on HAVE_KERNEL_GZIP
+ select KEXEC_DECOMPRESS_GZIP if KEXEC_FILE && EFI_ZBOOT
help
The old and tried gzip compression. It provides a good balance
between compression ratio and decompression speed.
@@ -276,6 +277,7 @@ config KERNEL_GZIP
config KERNEL_BZIP2
bool "Bzip2"
depends on HAVE_KERNEL_BZIP2
+ select KEXEC_DECOMPRESS_BZIP2 if KEXEC_FILE && EFI_ZBOOT
help
Its compression ratio and speed is intermediate.
Decompression speed is slowest among the choices. The kernel
@@ -286,6 +288,7 @@ config KERNEL_BZIP2
config KERNEL_LZMA
bool "LZMA"
depends on HAVE_KERNEL_LZMA
+ select KEXEC_DECOMPRESS_LZMA if KEXEC_FILE && EFI_ZBOOT
help
This compression algorithm's ratio is best. Decompression speed
is between gzip and bzip2. Compression is slowest.
@@ -294,6 +297,7 @@ config KERNEL_LZMA
config KERNEL_XZ
bool "XZ"
depends on HAVE_KERNEL_XZ
+ select KEXEC_DECOMPRESS_XZ if KEXEC_FILE && EFI_ZBOOT
help
XZ uses the LZMA2 algorithm and instruction set specific
BCJ filters which can improve compression ratio of executable
@@ -309,6 +313,7 @@ config KERNEL_XZ
config KERNEL_LZO
bool "LZO"
depends on HAVE_KERNEL_LZO
+ select KEXEC_DECOMPRESS_LZO if KEXEC_FILE && EFI_ZBOOT
help
Its compression ratio is the poorest among the choices. The kernel
size is about 10% bigger than gzip; however its speed
@@ -317,6 +322,7 @@ config KERNEL_LZO
config KERNEL_LZ4
bool "LZ4"
depends on HAVE_KERNEL_LZ4
+ select KEXEC_DECOMPRESS_LZ4 if KEXEC_FILE && EFI_ZBOOT
help
LZ4 is an LZ77-type compressor with a fixed, byte-oriented encoding.
A preliminary version of LZ4 de/compression tool is available at
@@ -329,6 +335,7 @@ config KERNEL_LZ4
config KERNEL_ZSTD
bool "ZSTD"
depends on HAVE_KERNEL_ZSTD
+ select KEXEC_DECOMPRESS_ZSTD if KEXEC_FILE && EFI_ZBOOT
help
ZSTD is a compression algorithm targeting intermediate compression
with fast decompression speed. It will compress better than GZIP and
--
2.31.1