Skip to content

Commit 0b2c29f

Browse files
committed
efi/zboot: Limit compression options to GZIP and ZSTD
For historical reasons, the legacy decompressor code on various architectures supports 7 different compression types for the compressed kernel image. EFI zboot is not a compression library museum, and so the options can be limited to what is likely to be useful in practice: - GZIP is tried and tested, and is still one of the fastest at decompression time, although the compression ratio is not very high; moreover, Fedora is already shipping EFI zboot kernels for arm64 that use GZIP, and QEMU implements direct support for it when booting a kernel without firmware loaded; - ZSTD has a very high compression ratio (although not the highest), and is almost as fast as GZIP at decompression time. Reducing the number of options makes it less of a hassle for other consumers of the EFI zboot format (such as QEMU today, and kexec in the future) to support it transparently without having to carry 7 different decompression libraries. Acked-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
1 parent 40384c8 commit 0b2c29f

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

drivers/firmware/efi/Kconfig

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,6 @@ config EFI_ZBOOT
7676
bool "Enable the generic EFI decompressor"
7777
depends on EFI_GENERIC_STUB && !ARM
7878
select HAVE_KERNEL_GZIP
79-
select HAVE_KERNEL_LZ4
80-
select HAVE_KERNEL_LZMA
81-
select HAVE_KERNEL_LZO
82-
select HAVE_KERNEL_XZ
8379
select HAVE_KERNEL_ZSTD
8480
help
8581
Create the bootable image as an EFI application that carries the

drivers/firmware/efi/libstub/Makefile.zboot

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,16 @@ quiet_cmd_copy_and_pad = PAD $@
1212
$(obj)/vmlinux.bin: $(obj)/$(EFI_ZBOOT_PAYLOAD) FORCE
1313
$(call if_changed,copy_and_pad)
1414

15-
comp-type-$(CONFIG_KERNEL_GZIP) := gzip
16-
comp-type-$(CONFIG_KERNEL_LZ4) := lz4
17-
comp-type-$(CONFIG_KERNEL_LZMA) := lzma
18-
comp-type-$(CONFIG_KERNEL_LZO) := lzo
19-
comp-type-$(CONFIG_KERNEL_XZ) := xzkern
20-
comp-type-$(CONFIG_KERNEL_ZSTD) := zstd22
21-
2215
# in GZIP, the appended le32 carrying the uncompressed size is part of the
2316
# format, but in other cases, we just append it at the end for convenience,
2417
# causing the original tools to complain when checking image integrity.
25-
# So disregard it when calculating the payload size in the zimage header.
26-
zboot-method-y := $(comp-type-y)_with_size
27-
zboot-size-len-y := 4
18+
comp-type-y := gzip
19+
zboot-method-y := gzip
20+
zboot-size-len-y := 0
2821

29-
zboot-method-$(CONFIG_KERNEL_GZIP) := gzip
30-
zboot-size-len-$(CONFIG_KERNEL_GZIP) := 0
22+
comp-type-$(CONFIG_KERNEL_ZSTD) := zstd
23+
zboot-method-$(CONFIG_KERNEL_ZSTD) := zstd22_with_size
24+
zboot-size-len-$(CONFIG_KERNEL_ZSTD) := 4
3125

3226
$(obj)/vmlinuz: $(obj)/vmlinux.bin FORCE
3327
$(call if_changed,$(zboot-method-y))

0 commit comments

Comments
 (0)