Skip to content

Commit ab4ce98

Browse files
Larhzuakpm00
authored andcommitted
riscv: boot: add Image.xz support
The Image.* targets existed for other compressors already. Bootloader support is needed for decompression. This is for CONFIG_EFI_ZBOOT=n. With CONFIG_EFI_ZBOOT=y, XZ was already available. Comparision with Linux 6.10 RV64GC tinyconfig (in KiB): 1027 Image 594 Image.gz 541 Image.zst 510 Image.lzma 474 Image.xz Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Lasse Collin <[email protected]> Reviewed-by: Emil Renner Berthing <[email protected]> Cc: Paul Walmsley <[email protected]> Cc: Palmer Dabbelt <[email protected]> Cc: Albert Ou <[email protected]> Cc: Jules Maselbas <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Herbert Xu <[email protected]> Cc: Joel Stanley <[email protected]> Cc: Jonathan Corbet <[email protected]> Cc: Jubin Zhong <[email protected]> Cc: Krzysztof Kozlowski <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Randy Dunlap <[email protected]> Cc: Rui Li <[email protected]> Cc: Sam James <[email protected]> Cc: Simon Glass <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Will Deacon <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 181e71f commit ab4ce98

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

arch/riscv/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ config RISCV
156156
select HAVE_KERNEL_LZO if !XIP_KERNEL && !EFI_ZBOOT
157157
select HAVE_KERNEL_UNCOMPRESSED if !XIP_KERNEL && !EFI_ZBOOT
158158
select HAVE_KERNEL_ZSTD if !XIP_KERNEL && !EFI_ZBOOT
159+
select HAVE_KERNEL_XZ if !XIP_KERNEL && !EFI_ZBOOT
159160
select HAVE_KPROBES if !XIP_KERNEL
160161
select HAVE_KRETPROBES if !XIP_KERNEL
161162
# https://github.com/ClangBuiltLinux/linux/issues/1881

arch/riscv/Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ boot-image-$(CONFIG_KERNEL_LZ4) := Image.lz4
159159
boot-image-$(CONFIG_KERNEL_LZMA) := Image.lzma
160160
boot-image-$(CONFIG_KERNEL_LZO) := Image.lzo
161161
boot-image-$(CONFIG_KERNEL_ZSTD) := Image.zst
162+
boot-image-$(CONFIG_KERNEL_XZ) := Image.xz
162163
ifdef CONFIG_RISCV_M_MODE
163164
boot-image-$(CONFIG_ARCH_CANAAN) := loader.bin
164165
endif
@@ -183,12 +184,12 @@ endif
183184
vdso-install-y += arch/riscv/kernel/vdso/vdso.so.dbg
184185
vdso-install-$(CONFIG_COMPAT) += arch/riscv/kernel/compat_vdso/compat_vdso.so.dbg
185186

186-
BOOT_TARGETS := Image Image.gz Image.bz2 Image.lz4 Image.lzma Image.lzo Image.zst loader loader.bin xipImage vmlinuz.efi
187+
BOOT_TARGETS := Image Image.gz Image.bz2 Image.lz4 Image.lzma Image.lzo Image.zst Image.xz loader loader.bin xipImage vmlinuz.efi
187188

188189
all: $(notdir $(KBUILD_IMAGE))
189190

190191
loader.bin: loader
191-
Image.gz Image.bz2 Image.lz4 Image.lzma Image.lzo Image.zst loader xipImage vmlinuz.efi: Image
192+
Image.gz Image.bz2 Image.lz4 Image.lzma Image.lzo Image.zst Image.xz loader xipImage vmlinuz.efi: Image
192193

193194
$(BOOT_TARGETS): vmlinux
194195
$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
@@ -225,6 +226,7 @@ define archhelp
225226
echo ' Image.lzma - Compressed kernel image (arch/riscv/boot/Image.lzma)'
226227
echo ' Image.lzo - Compressed kernel image (arch/riscv/boot/Image.lzo)'
227228
echo ' Image.zst - Compressed kernel image (arch/riscv/boot/Image.zst)'
229+
echo ' Image.xz - Compressed kernel image (arch/riscv/boot/Image.xz)'
228230
echo ' vmlinuz.efi - Compressed EFI kernel image (arch/riscv/boot/vmlinuz.efi)'
229231
echo ' Default when CONFIG_EFI_ZBOOT=y'
230232
echo ' xipImage - Execute-in-place kernel image (arch/riscv/boot/xipImage)'

arch/riscv/boot/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ $(obj)/Image.lzo: $(obj)/Image FORCE
6464
$(obj)/Image.zst: $(obj)/Image FORCE
6565
$(call if_changed,zstd)
6666

67+
$(obj)/Image.xz: $(obj)/Image FORCE
68+
$(call if_changed,xzkern)
69+
6770
$(obj)/loader.bin: $(obj)/loader FORCE
6871
$(call if_changed,objcopy)
6972

0 commit comments

Comments
 (0)