diff mbox series

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

Message ID 20230306030305.15595-4-kernelfans@gmail.com (mailing list archive)
State New, archived
Headers show
Series arm64: make kexec_file able to load zboot image | expand

Commit Message

Pingfan Liu March 6, 2023, 3:03 a.m. UTC
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@gmail.com>
Cc: Will Deacon <will@kernel.org>
Cc: Nick Terrell <terrelln@fb.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Eric Biggers <ebiggers@google.com>
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: Yury Norov <yury.norov@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: kexec@lists.infradead.org
To: linux-arm-kernel@lists.infradead.org
---
 arch/arm64/Kconfig | 59 ++++++++++++++++++++++++++++++++++++++++++++++
 lib/Kconfig        |  3 +++
 2 files changed, 62 insertions(+)
diff mbox series

Patch

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