Skip to contentSkip to conversation

arm64: Rename to KERNEL_IMAGE_COMPRESSED_INSTALL kconfig for compressed kernel image

PATCH Superseded Sedat Dilek 3 participants 6 messages Jul 26, 2024 – Jul 30, 2024 arm64

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 arm64: Rename to KERNEL_IMAGE_COMPRESSED_INSTALL kconfig for compressed kernel image

The COMPRESSED_INSTALL does not sound very meaningful.

Rename from COMPRESSED_INSTALL kconfig to KERNEL_IMAGE_COMPRESSED_INSTALL.

Fixes commit 4c7be57f2 ("arm64: allow installing compressed image by default")
---
 arch/arm64/Kconfig  | 4 ++--
 arch/arm64/Makefile | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
arch/arm64/Kconfig +2 -2
index ae527d1d409f..d9f771c788d7 100644
@@ -2337,8 +2337,8 @@ config EFI
 	  allow the kernel to be booted as an EFI application. This
 	  is only useful on systems that have UEFI firmware.
 
-config COMPRESSED_INSTALL
-	bool "Install compressed image by default"
+config KERNEL_IMAGE_COMPRESSED_INSTALL
+	bool "Install compressed kernel image by default"
 	help
 	  This makes the regular "make install" install the compressed
 	  image we built, not the legacy uncompressed one.
arch/arm64/Makefile +3 -3
index f6bc3da1ef11..1d9b4978eb98 100644
@@ -182,7 +182,7 @@ $(BOOT_TARGETS): vmlinux
 Image.%: Image
 	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
 
-ifeq ($(CONFIG_COMPRESSED_INSTALL),y)
+ifeq ($(CONFIG_KERNEL_IMAGE_COMPRESSED_INSTALL),y)
  DEFAULT_KBUILD_IMAGE = $(KBUILD_IMAGE)
 else
  DEFAULT_KBUILD_IMAGE = $(boot)/Image
@@ -235,8 +235,8 @@ define archhelp
   echo  '* Image.gz      - Compressed kernel image (arch/$(ARCH)/boot/Image.gz)'
   echo  '  Image         - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
   echo  '  image.fit     - Flat Image Tree (arch/$(ARCH)/boot/image.fit)'
-  echo  '  install       - Install kernel (compressed if COMPRESSED_INSTALL set)'
-  echo  '  zinstall      - Install compressed kernel'
+  echo  '  install       - Install kernel image (compressed if KERNEL_IMAGE_COMPRESSED_INSTALL is set)'
+  echo  '  zinstall      - Install compressed kernel image'
   echo  '                  Install using (your) ~/bin/installkernel or'
   echo  '                  (distribution) /sbin/installkernel or'
   echo  '                  install to $$(INSTALL_PATH) and run lilo'
Signature · 1 line
2.45.2
#1 lore raw
Quoted 2 lines · Sedat Dilek

The COMPRESSED_INSTALL does not sound very meaningful.

Why do you care? The question looks like this:

Install compressed image by default (COMPRESSED_INSTALL) [N/y/?] (NEW)

which actually fits on a line and makes perfect sense.

Your patch seems to only make things worse for no real gain.

Linus

#2 lore raw
Quoted 5 lines · Linus Torvalds
Quoted 2 lines · Sedat Dilek

The COMPRESSED_INSTALL does not sound very meaningful.

Quoted 8 lines

Why do you care? The question looks like this:

Install compressed image by default (COMPRESSED_INSTALL) [N/y/?] (NEW)

which actually fits on a line and makes perfect sense.

Your patch seems to only make things worse for no real gain.

Yes, the new kconfig is longer - not ideal.

And when you check a diff of two of your ARM64 .config? What says COMPRESSED_INSTALL to other than the author w/o context :-)?

You are right, why should I care - I have no ARM54 hardware.

-Sedat.

-Sedat-

#3 lore raw
Quoted 3 lines · Sedat Dilek

And when you check a diff of two of your ARM64 .config? What says COMPRESSED_INSTALL to other than the author w/o context :-)?

Even without any context, I think it says "compressed install".

Which seems sensible. Because THAT'S EXACTLY WHAT IT IS.

Now, admittedly I would have preferred not having a config option for this at all, but we have a sad historical situation of doing something odd on arm (and parisc).

The RISC-V people used to do the same, but they decided to just make 'install' do whatever image was built, so they base it on a combination of different config variables: CONFIG_XIP_KERNEL, CONFIG_RISCV_M_MODE, CONFIG_SOC_CANAAN_K210, and CONFIG_EFI_ZBOOT.

I considered just using our pre-existing CONFIG_EFI_ZBOOT variable, but without knowing what the different boot loaders do...

Linus

#4 lore raw
Quoted 9 lines · Linus Torvalds
Quoted 3 lines · Sedat Dilek

And when you check a diff of two of your ARM64 .config? What says COMPRESSED_INSTALL to other than the author w/o context :-)?

Even without any context, I think it says "compressed install".

Which seems sensible. Because THAT'S EXACTLY WHAT IT IS.

Quoted 8 lines

Now, admittedly I would have preferred not having a config option for this at all, but we have a sad historical situation of doing something odd on arm (and parisc).

The RISC-V people used to do the same, but they decided to just make 'install' do whatever image was built, so they base it on a combination of different config variables: CONFIG_XIP_KERNEL, CONFIG_RISCV_M_MODE, CONFIG_SOC_CANAAN_K210, and CONFIG_EFI_ZBOOT.

With the approach taken by RISC-V you can choose which compression you want (including uncompressed) and not just gzip. For arm64 it would look something like this:

arch/arm64/Kconfig +7 -11
index ae527d1d409f..a99864491703 100644
@@ -234,6 +234,13 @@ config ARM64
 	select HAVE_RUST if CPU_LITTLE_ENDIAN
 	select HAVE_STACKPROTECTOR
 	select HAVE_SYSCALL_TRACEPOINTS
+	select HAVE_KERNEL_BZIP2 if !EFI_ZBOOT
+	select HAVE_KERNEL_GZIP if !EFI_ZBOOT
+	select HAVE_KERNEL_LZ4 if !EFI_ZBOOT
+	select HAVE_KERNEL_LZMA if !EFI_ZBOOT
+	select HAVE_KERNEL_LZO if !EFI_ZBOOT
+	select HAVE_KERNEL_UNCOMPRESSED if !EFI_ZBOOT
+	select HAVE_KERNEL_ZSTD if !EFI_ZBOOT
 	select HAVE_KPROBES
 	select HAVE_KRETPROBES
 	select HAVE_GENERIC_VDSO
@@ -2337,17 +2344,6 @@ config EFI
 	  allow the kernel to be booted as an EFI application. This
 	  is only useful on systems that have UEFI firmware.
 
-config COMPRESSED_INSTALL
-	bool "Install compressed image by default"
-	help
-	  This makes the regular "make install" install the compressed
-	  image we built, not the legacy uncompressed one.
-
-	  You can check that a compressed image works for you by doing
-	  "make zinstall" first, and verifying that everything is fine
-	  in your environment before making "make install" do this for
-	  you.
-
 config DMI
 	bool "Enable support for SMBIOS (DMI) tables"
 	depends on EFI
arch/arm64/Makefile +11 -2
index f6bc3da1ef11..b798875311aa 100644
@@ -159,18 +159,21 @@ libs-y		:= arch/arm64/lib/ $(libs-y)
 libs-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a
 
 # Default target when executing plain make
-boot		:= arch/arm64/boot
+boot					:= arch/arm64/boot
+boot-image-y				:= Image
+boot-image-$(CONFIG_KERNEL_BZIP2)	:= Image.bz2
+boot-image-$(CONFIG_KERNEL_GZIP)	:= Image.gz
+boot-image-$(CONFIG_KERNEL_LZ4)		:= Image.lz4
+boot-image-$(CONFIG_KERNEL_LZMA)	:= Image.lzma
+boot-image-$(CONFIG_KERNEL_LZO)		:= Image.lzo
+boot-image-$(CONFIG_KERNEL_ZSTD)	:= Image.zst
+boot-image-$(CONFIG_EFI_ZBOOT)		:= vmlinuz.efi
 
-BOOT_TARGETS	:= Image vmlinuz.efi image.fit
+KBUILD_IMAGE := $(boot)/$(boot-image-y)
+BOOT_TARGETS := Image Image.bz2 Image.gz Image.lz4 Image.lzma

Image.lzo Image.zst vmlinuz.efi image.fit

PHONY += $(BOOT_TARGETS)

-ifeq ($(CONFIG_EFI_ZBOOT),)
-KBUILD_IMAGE := $(boot)/Image.gz
-else
-KBUILD_IMAGE := $(boot)/vmlinuz.efi
-endif
-
all: $(notdir $(KBUILD_IMAGE))

image.fit: dtbs
@@ -182,13 +185,8 @@ $(BOOT_TARGETS): vmlinux
Image.%: Image
$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@

-ifeq ($(CONFIG_COMPRESSED_INSTALL),y)
- DEFAULT_KBUILD_IMAGE = $(KBUILD_IMAGE)
-else
- DEFAULT_KBUILD_IMAGE = $(boot)/Image
-endif
-
-install: KBUILD_IMAGE := $(DEFAULT_KBUILD_IMAGE)
+# the install target always installs KBUILD_IMAGE (which may be compressed) +# but keep the zinstall target for compatibility with older releases
install zinstall:
$(call cmd,install)

@@ -232,11 +230,15 @@ virtconfig:
$(call merge_into_defconfig_override,defconfig,virt)

define archhelp
- echo '* Image.gz - Compressed kernel image
(arch/$(ARCH)/boot/Image.gz)'

   echo  '  Image         - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
+  echo  '  Image.bz2     - Compressed kernel image

(arch/$(ARCH)/boot/Image.bz2)'
+ echo '* Image.gz - Compressed kernel image
(arch/$(ARCH)/boot/Image.gz)'
+ echo ' Image.lz4 - Compressed kernel image
(arch/$(ARCH)/boot/Image.lz4)'
+ echo ' Image.lzma - Compressed kernel image
(arch/$(ARCH)/boot/Image.lzma)'
+ echo ' Image.lzo - Compressed kernel image
(arch/$(ARCH)/boot/Image.lzo)'
+ echo ' Image.zst - Compressed kernel image
(arch/$(ARCH)/boot/Image.zst)'

   echo  '  image.fit     - Flat Image Tree (arch/$(ARCH)/boot/image.fit)'
-  echo  '  install       - Install kernel (compressed if
COMPRESSED_INSTALL set)'
-  echo  '  zinstall      - Install compressed kernel'
+  echo  '  install       - Install kernel'
   echo  '                  Install using (your) ~/bin/installkernel or'
   echo  '                  (distribution) /sbin/installkernel or'
   echo  '                  install to $$(INSTALL_PATH) and run lilo'
#5 lore raw
Quoted 15 lines · Emil Renner Berthing
Quoted 13 lines · Linus Torvalds
Quoted 3 lines · Sedat Dilek

And when you check a diff of two of your ARM64 .config? What says COMPRESSED_INSTALL to other than the author w/o context :-)?

Even without any context, I think it says "compressed install".

Which seems sensible. Because THAT'S EXACTLY WHAT IT IS.

Now, admittedly I would have preferred not having a config option for this at all, but we have a sad historical situation of doing something odd on arm (and parisc).

Quoted 9 lines
Quoted 4 lines

The RISC-V people used to do the same, but they decided to just make 'install' do whatever image was built, so they base it on a combination of different config variables: CONFIG_XIP_KERNEL, CONFIG_RISCV_M_MODE, CONFIG_SOC_CANAAN_K210, and CONFIG_EFI_ZBOOT.

With the approach taken by RISC-V you can choose which compression you want (including uncompressed) and not just gzip. For arm64 it would look something like this:

Hi Emil,

That sounds straight-forward than discussing a single KCONFIG variable name.

Is that kconfig/kbuild tested?

Quoted 5 lines
arch/arm64/Kconfig +0 -0
index ae527d1d409f..a99864491703 100644

arch/arm64/Kconfig config ARM64 · line 243

Quoted 10 lines
arch/arm64/Kconfig +7 -0
@@ -234,6 +234,13 @@ config ARM64
        select HAVE_RUST if CPU_LITTLE_ENDIAN
        select HAVE_STACKPROTECTOR
        select HAVE_SYSCALL_TRACEPOINTS
+       select HAVE_KERNEL_BZIP2 if !EFI_ZBOOT
+       select HAVE_KERNEL_GZIP if !EFI_ZBOOT
+       select HAVE_KERNEL_LZ4 if !EFI_ZBOOT
+       select HAVE_KERNEL_LZMA if !EFI_ZBOOT
+       select HAVE_KERNEL_LZO if !EFI_ZBOOT
+       select HAVE_KERNEL_UNCOMPRESSED if !EFI_ZBOOT
+       select HAVE_KERNEL_ZSTD if !EFI_ZBOOT

Better embed these selects in a block
if !EFI_ZBOOT
...
endif # !EFI_ZBOOT

Do you really want to use HAVE_KERNEL_UNCOMPRESSED (see below)?

x86_64 does not have XXX_KERNEL_UNCOMPRESSED.

Quoted 26 lines
arch/arm64/Kconfig +0 -11
        select HAVE_KPROBES
        select HAVE_KRETPROBES
        select HAVE_GENERIC_VDSO
@@ -2337,17 +2344,6 @@ config EFI
          allow the kernel to be booted as an EFI application. This
          is only useful on systems that have UEFI firmware.
 
-config COMPRESSED_INSTALL
-       bool "Install compressed image by default"
-       help
-         This makes the regular "make install" install the compressed
-         image we built, not the legacy uncompressed one.
-
-         You can check that a compressed image works for you by doing
-         "make zinstall" first, and verifying that everything is fine
-         in your environment before making "make install" do this for
-         you.
-
 config DMI
        bool "Enable support for SMBIOS (DMI) tables"
        depends on EFI
arch/arm64/Makefile +0 -0
index f6bc3da1ef11..b798875311aa 100644

arch/arm64/Makefile libs-y := arch/arm64/lib/ $(libs-y) · line 163

Quoted 6 lines
arch/arm64/Makefile +2 -1
@@ -159,18 +159,21 @@ libs-y            := arch/arm64/lib/ $(libs-y)
 libs-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a
 
 # Default target when executing plain make
-boot           := arch/arm64/boot
+boot                                   := arch/arm64/boot
+boot-image-y                           := Image

^^ boot-image-$(CONFIG_KERNEL_UNCOMPRESSED) := Image ?

Quoted 62 lines
arch/arm64/Makefile +9 -1
+boot-image-$(CONFIG_KERNEL_BZIP2)      := Image.bz2
+boot-image-$(CONFIG_KERNEL_GZIP)       := Image.gz
+boot-image-$(CONFIG_KERNEL_LZ4)                := Image.lz4
+boot-image-$(CONFIG_KERNEL_LZMA)       := Image.lzma
+boot-image-$(CONFIG_KERNEL_LZO)                := Image.lzo
+boot-image-$(CONFIG_KERNEL_ZSTD)       := Image.zst
+boot-image-$(CONFIG_EFI_ZBOOT)         := vmlinuz.efi
 
-BOOT_TARGETS   := Image vmlinuz.efi image.fit
+KBUILD_IMAGE := $(boot)/$(boot-image-y)
+BOOT_TARGETS := Image Image.bz2 Image.gz Image.lz4 Image.lzma

Image.lzo Image.zst vmlinuz.efi image.fit

PHONY += $(BOOT_TARGETS)

arch/arm64/Makefile +2 -14
-ifeq ($(CONFIG_EFI_ZBOOT),)
-KBUILD_IMAGE   := $(boot)/Image.gz
-else
-KBUILD_IMAGE   := $(boot)/vmlinuz.efi
-endif
-
 all:   $(notdir $(KBUILD_IMAGE))
 
 image.fit: dtbs
@@ -182,13 +185,8 @@ $(BOOT_TARGETS): vmlinux
 Image.%: Image
        $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
 
-ifeq ($(CONFIG_COMPRESSED_INSTALL),y)
- DEFAULT_KBUILD_IMAGE = $(KBUILD_IMAGE)
-else
- DEFAULT_KBUILD_IMAGE = $(boot)/Image
-endif
-
-install: KBUILD_IMAGE := $(DEFAULT_KBUILD_IMAGE)
+# the install target always installs KBUILD_IMAGE (which may be compressed)
+# but keep the zinstall target for compatibility with older releases
 install zinstall:
        $(call cmd,install)
 
@@ -232,11 +230,15 @@ virtconfig:
        $(call merge_into_defconfig_override,defconfig,virt)
 
 define archhelp
-  echo  '* Image.gz      - Compressed kernel image

(arch/$(ARCH)/boot/Image.gz)'

   echo  '  Image         - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
+  echo  '  Image.bz2     - Compressed kernel image

(arch/$(ARCH)/boot/Image.bz2)'
+ echo '* Image.gz - Compressed kernel image
(arch/$(ARCH)/boot/Image.gz)'
+ echo ' Image.lz4 - Compressed kernel image
(arch/$(ARCH)/boot/Image.lz4)'
+ echo ' Image.lzma - Compressed kernel image
(arch/$(ARCH)/boot/Image.lzma)'
+ echo ' Image.lzo - Compressed kernel image
(arch/$(ARCH)/boot/Image.lzo)'
+ echo ' Image.zst - Compressed kernel image
(arch/$(ARCH)/boot/Image.zst)'

   echo  '  image.fit     - Flat Image Tree (arch/$(ARCH)/boot/image.fit)'
-  echo  '  install       - Install kernel (compressed if

COMPRESSED_INSTALL set)'

arch/arm64/Makefile

Quoted 5 lines
arch/arm64/Makefile +1 -1
-  echo  '  zinstall      - Install compressed kernel'
+  echo  '  install       - Install kernel'
   echo  '                  Install using (your) ~/bin/installkernel or'
   echo  '                  (distribution) /sbin/installkernel or'
   echo  '                  install to $$(INSTALL_PATH) and run lilo'

Does ARM64 arch support kernel-decompression for all these compressors?

Thanks for that vital contribution and your ideas!

Best regards,
-Sedat-