diff mbox series

[v2] arm64: Rename to KERNEL_IMAGE_COMPRESSED_INSTALL kconfig for compressed kernel image

Message ID 20240726195044.18004-1-sedat.dilek@gmail.com (mailing list archive)
State New, archived
Headers show
Series [v2] arm64: Rename to KERNEL_IMAGE_COMPRESSED_INSTALL kconfig for compressed kernel image | expand

Commit Message

Sedat Dilek July 26, 2024, 7:49 p.m. UTC
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")
Signed-off-by: Sedat Dilek <sedat.dilek@gmail.com>
---
 arch/arm64/Kconfig  | 4 ++--
 arch/arm64/Makefile | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

Comments

Linus Torvalds July 26, 2024, 8:41 p.m. UTC | #1
On Fri, 26 Jul 2024 at 12:51, Sedat Dilek <sedat.dilek@gmail.com> wrote:
>
> 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
Sedat Dilek July 26, 2024, 8:54 p.m. UTC | #2
On Fri, Jul 26, 2024 at 10:42 PM Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
> On Fri, 26 Jul 2024 at 12:51, Sedat Dilek <sedat.dilek@gmail.com> wrote:
> >
> > 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.
>

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-
Linus Torvalds July 26, 2024, 9:47 p.m. UTC | #3
On Fri, 26 Jul 2024 at 13:54, Sedat Dilek <sedat.dilek@gmail.com> wrote:
>
> 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
Emil Renner Berthing July 27, 2024, 11:50 a.m. UTC | #4
Linus Torvalds wrote:
> On Fri, 26 Jul 2024 at 13:54, Sedat Dilek <sedat.dilek@gmail.com> wrote:
> >
> > 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.

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:

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index ae527d1d409f..a99864491703 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -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
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index f6bc3da1ef11..b798875311aa 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -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'
Sedat Dilek July 30, 2024, 1:23 a.m. UTC | #5
On Sat, Jul 27, 2024 at 1:50 PM Emil Renner Berthing
<emil.renner.berthing@canonical.com> wrote:
>
> Linus Torvalds wrote:
> > On Fri, 26 Jul 2024 at 13:54, Sedat Dilek <sedat.dilek@gmail.com> wrote:
> > >
> > > 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.
>
> 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?

> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index ae527d1d409f..a99864491703 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -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.

>         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
> diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
> index f6bc3da1ef11..b798875311aa 100644
> --- a/arch/arm64/Makefile
> +++ b/arch/arm64/Makefile
> @@ -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 ?

> +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'

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

Thanks for that vital contribution and your ideas!

Best regards,
-Sedat-
diff mbox series

Patch

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index ae527d1d409f..d9f771c788d7 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -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.
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index f6bc3da1ef11..1d9b4978eb98 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -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'