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

Pingfan Liu kernelfans at gmail.com
Sun Mar 5 19:03:05 PST 2023


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 at gmail.com>
Cc: Andrew Morton <akpm at linux-foundation.org>
Cc: Nick Desaulniers <ndesaulniers at google.com>
Cc: Masahiro Yamada <masahiroy at kernel.org>
Cc: Johannes Weiner <hannes at cmpxchg.org>
Cc: Nathan Chancellor <nathan at kernel.org>
Cc: Miguel Ojeda <ojeda at kernel.org>
Cc: Masami Hiramatsu <mhiramat at kernel.org>
Cc: Ard Biesheuvel <ardb at kernel.org>
Cc: kexec at lists.infradead.org
To: linux-kernel at vger.kernel.org
---
 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




More information about the kexec mailing list