lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJM55Z82yardOi-x59TbdrXb834xq6_Nt=1DPqJC77MfM9vvHA@mail.gmail.com>
Date: Sat, 27 Jul 2024 06:50:24 -0500
From: Emil Renner Berthing <emil.renner.berthing@...onical.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>, sedat.dilek@...il.com
Cc: Catalin Marinas <catalin.marinas@....com>, Will Deacon <will@...nel.org>, 
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [v2] arm64: Rename to KERNEL_IMAGE_COMPRESSED_INSTALL kconfig for
 compressed kernel image

Linus Torvalds wrote:
> On Fri, 26 Jul 2024 at 13:54, Sedat Dilek <sedat.dilek@...il.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'

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ