[PATCH 3/6] arm64: Kconfig: Pick decompressing method for kexec file load

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


After introducing the zboot image, kexec file load should be able to
decompress the Image.gz. (Do in the later patch)

Unlike efi_zboot_entry() which knows the decompression method at the
built time, kexec may loads compressed kernels with variant compression
methods, hence it is helpful to include as many decompression method as
possible.  Here provide an opportunity to let users select at their
will.

Besides this, introduce an extra config option 'HAVE_KEXEC_DECOMPRESS' to
distinguish the reference to decompression routine between kexec and boot.
(used in later patch to keep the routine out of .init.text section)

Signed-off-by: Pingfan Liu <kernelfans at gmail.com>
Cc: Will Deacon <will at kernel.org>
Cc: Nick Terrell <terrelln at fb.com>
Cc: Herbert Xu <herbert at gondor.apana.org.au>
Cc: Eric Biggers <ebiggers at google.com>
Cc: "Jason A. Donenfeld" <Jason at zx2c4.com>
Cc: Yury Norov <yury.norov at gmail.com>
Cc: Andrew Morton <akpm at linux-foundation.org>
Cc: Ard Biesheuvel <ardb at kernel.org>
Cc: kexec at lists.infradead.org
To: linux-arm-kernel at lists.infradead.org
---
 arch/arm64/Kconfig | 59 ++++++++++++++++++++++++++++++++++++++++++++++
 lib/Kconfig        |  3 +++
 2 files changed, 62 insertions(+)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index c5ccca26a408..58a65bdaeffa 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -1419,6 +1419,65 @@ config KEXEC_FILE
 	  for kernel and initramfs as opposed to list of segments as
 	  accepted by previous system call.
 
+menu "Decompress method for kexec file load"
+
+config KEXEC_DECOMPRESS_GZIP
+	bool "gzip"
+	depends on KEXEC_FILE
+	select DECOMPRESS_GZIP
+	select HAVE_KEXEC_DECOMPRESS
+	help
+	  Enable to load the zboot image compressed by gzip
+
+config KEXEC_DECOMPRESS_BZIP2
+	bool "bzip2"
+	depends on KEXEC_FILE
+	select DECOMPRESS_BZIP2
+	select HAVE_KEXEC_DECOMPRESS
+	help
+	  Enable to load the zboot image compressed by bzip2
+
+config KEXEC_DECOMPRESS_LZMA
+	bool "lzma"
+	depends on KEXEC_FILE
+	select DECOMPRESS_LZMA
+	select HAVE_KEXEC_DECOMPRESS
+	help
+	  Enable to load the zboot image compressed by lzma
+
+config KEXEC_DECOMPRESS_XZ
+	bool "xz"
+	depends on KEXEC_FILE
+	select DECOMPRESS_XZ
+	select HAVE_KEXEC_DECOMPRESS
+	help
+	  Enable to load the zboot image compressed by xz
+
+config KEXEC_DECOMPRESS_LZO
+	bool "lzo"
+	depends on KEXEC_FILE
+	select DECOMPRESS_LZO
+	select HAVE_KEXEC_DECOMPRESS
+	help
+	  Enable to load the zboot image compressed by lzo
+
+config KEXEC_DECOMPRESS_LZ4
+	bool "lz4"
+	depends on KEXEC_FILE
+	select DECOMPRESS_LZ4
+	select HAVE_KEXEC_DECOMPRESS
+	help
+	  Enable to load the zboot image compressed by lz4
+
+config KEXEC_DECOMPRESS_ZSTD
+	bool "zstd"
+	depends on KEXEC_FILE
+	select DECOMPRESS_ZSTD
+	select HAVE_KEXEC_DECOMPRESS
+	help
+	  Enable to load the zboot image compressed by zstd
+endmenu
+
 config KEXEC_SIG
 	bool "Verify kernel signature during kexec_file_load() syscall"
 	depends on KEXEC_FILE
diff --git a/lib/Kconfig b/lib/Kconfig
index ce2abffb9ed8..18ab33511ee1 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -304,6 +304,9 @@ config RANDOM32_SELFTEST
 #
 # compression support is select'ed if needed
 #
+config HAVE_KEXEC_DECOMPRESS
+	bool
+
 config 842_COMPRESS
 	select CRC32
 	tristate
-- 
2.31.1




More information about the kexec mailing list