* [PATCH] efi/zboot: Limit compression options to GZIP and ZSTD
@ 2024-12-06 14:25 Ard Biesheuvel
2024-12-06 15:49 ` Gerd Hoffmann
0 siblings, 1 reply; 2+ messages in thread
From: Ard Biesheuvel @ 2024-12-06 14:25 UTC (permalink / raw)
To: linux-efi; +Cc: Ard Biesheuvel, Gerd Hoffmann, Peter Jones, Pingfan Liu
From: Ard Biesheuvel <ardb@kernel.org>
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.
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Peter Jones <pjones@redhat.com>
Cc: Pingfan Liu <piliu@redhat.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
drivers/firmware/efi/Kconfig | 4 ----
drivers/firmware/efi/libstub/Makefile.zboot | 18 ++++++------------
2 files changed, 6 insertions(+), 16 deletions(-)
diff --git a/drivers/firmware/efi/Kconfig b/drivers/firmware/efi/Kconfig
index e312d731f4a3..5fe61b9ab5f9 100644
--- a/drivers/firmware/efi/Kconfig
+++ b/drivers/firmware/efi/Kconfig
@@ -76,10 +76,6 @@ config EFI_ZBOOT
bool "Enable the generic EFI decompressor"
depends on EFI_GENERIC_STUB && !ARM
select HAVE_KERNEL_GZIP
- select HAVE_KERNEL_LZ4
- select HAVE_KERNEL_LZMA
- select HAVE_KERNEL_LZO
- select HAVE_KERNEL_XZ
select HAVE_KERNEL_ZSTD
help
Create the bootable image as an EFI application that carries the
diff --git a/drivers/firmware/efi/libstub/Makefile.zboot b/drivers/firmware/efi/libstub/Makefile.zboot
index 65ffd0b760b2..48842b5c106b 100644
--- a/drivers/firmware/efi/libstub/Makefile.zboot
+++ b/drivers/firmware/efi/libstub/Makefile.zboot
@@ -12,22 +12,16 @@ quiet_cmd_copy_and_pad = PAD $@
$(obj)/vmlinux.bin: $(obj)/$(EFI_ZBOOT_PAYLOAD) FORCE
$(call if_changed,copy_and_pad)
-comp-type-$(CONFIG_KERNEL_GZIP) := gzip
-comp-type-$(CONFIG_KERNEL_LZ4) := lz4
-comp-type-$(CONFIG_KERNEL_LZMA) := lzma
-comp-type-$(CONFIG_KERNEL_LZO) := lzo
-comp-type-$(CONFIG_KERNEL_XZ) := xzkern
-comp-type-$(CONFIG_KERNEL_ZSTD) := zstd22
-
# in GZIP, the appended le32 carrying the uncompressed size is part of the
# format, but in other cases, we just append it at the end for convenience,
# causing the original tools to complain when checking image integrity.
-# So disregard it when calculating the payload size in the zimage header.
-zboot-method-y := $(comp-type-y)_with_size
-zboot-size-len-y := 4
+comp-type-y := gzip
+zboot-method-y := gzip
+zboot-size-len-y := 0
-zboot-method-$(CONFIG_KERNEL_GZIP) := gzip
-zboot-size-len-$(CONFIG_KERNEL_GZIP) := 0
+comp-type-$(CONFIG_KERNEL_ZSTD) := zstd
+zboot-method-$(CONFIG_KERNEL_ZSTD) := zstd22_with_size
+zboot-size-len-$(CONFIG_KERNEL_ZSTD) := 4
$(obj)/vmlinuz: $(obj)/vmlinux.bin FORCE
$(call if_changed,$(zboot-method-y))
--
2.47.0.338.g60cca15819-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] efi/zboot: Limit compression options to GZIP and ZSTD
2024-12-06 14:25 [PATCH] efi/zboot: Limit compression options to GZIP and ZSTD Ard Biesheuvel
@ 2024-12-06 15:49 ` Gerd Hoffmann
0 siblings, 0 replies; 2+ messages in thread
From: Gerd Hoffmann @ 2024-12-06 15:49 UTC (permalink / raw)
To: Ard Biesheuvel; +Cc: linux-efi, Ard Biesheuvel, Peter Jones, Pingfan Liu
On Fri, Dec 06, 2024 at 03:25:00PM +0100, Ard Biesheuvel wrote:
> From: Ard Biesheuvel <ardb@kernel.org>
>
> 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.
>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Peter Jones <pjones@redhat.com>
> Cc: Pingfan Liu <piliu@redhat.com>
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
take care,
Gerd
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-12-06 15:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-06 14:25 [PATCH] efi/zboot: Limit compression options to GZIP and ZSTD Ard Biesheuvel
2024-12-06 15:49 ` Gerd Hoffmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox