Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390/boot: get rid of startup archive

The final kernel image is created by linking decompressor object files with
a startup archive. The startup archive file however does not contain only
optional code and data which can be discarded if not referenced. It also
contains mandatory object data like head.o which must never be discarded,
even if not referenced.

Move the decompresser code and linker script to the boot directory and get
rid of the startup archive so everything is kept during link time.

Acked-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>

+74 -101
+3
arch/s390/boot/.gitignore
··· 2 2 image 3 3 bzImage 4 4 section_cmp.* 5 + vmlinux 6 + vmlinux.lds 7 + vmlinux.syms
+68 -8
arch/s390/boot/Makefile
··· 41 41 obj-$(findstring y, $(CONFIG_PROTECTED_VIRTUALIZATION_GUEST) $(CONFIG_PGSTE)) += uv.o 42 42 obj-$(CONFIG_RELOCATABLE) += machine_kexec_reloc.o 43 43 obj-$(CONFIG_RANDOMIZE_BASE) += kaslr.o 44 - targets := bzImage startup.a section_cmp.boot.data section_cmp.boot.preserved.data $(obj-y) 45 - subdir- := compressed 44 + obj-y += $(if $(CONFIG_KERNEL_UNCOMPRESSED),,decompressor.o) info.o 45 + obj-$(CONFIG_KERNEL_ZSTD) += clz_ctz.o 46 + obj-all := $(obj-y) piggy.o syms.o 47 + 48 + targets := bzImage section_cmp.boot.data section_cmp.boot.preserved.data $(obj-y) 49 + targets += vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 50 + targets += vmlinux.bin.xz vmlinux.bin.lzma vmlinux.bin.lzo vmlinux.bin.lz4 51 + targets += vmlinux.bin.zst info.bin syms.bin vmlinux.syms $(obj-all) 46 52 47 53 OBJECTS := $(addprefix $(obj)/,$(obj-y)) 54 + OBJECTS_ALL := $(addprefix $(obj)/,$(obj-all)) 48 55 49 56 quiet_cmd_section_cmp = SECTCMP $* 50 57 define cmd_section_cmp ··· 66 59 touch $@ 67 60 endef 68 61 69 - $(obj)/bzImage: $(obj)/compressed/vmlinux $(obj)/section_cmp.boot.data $(obj)/section_cmp.boot.preserved.data FORCE 62 + $(obj)/bzImage: $(obj)/vmlinux $(obj)/section_cmp.boot.data $(obj)/section_cmp.boot.preserved.data FORCE 70 63 $(call if_changed,objcopy) 71 64 72 - $(obj)/section_cmp%: vmlinux $(obj)/compressed/vmlinux FORCE 65 + $(obj)/section_cmp%: vmlinux $(obj)/vmlinux FORCE 73 66 $(call if_changed,section_cmp) 74 67 75 - $(obj)/compressed/vmlinux: $(obj)/startup.a FORCE 76 - $(Q)$(MAKE) $(build)=$(obj)/compressed $@ 68 + LDFLAGS_vmlinux := --oformat $(LD_BFD) -e startup --build-id=sha1 -T 69 + $(obj)/vmlinux: $(obj)/vmlinux.lds $(OBJECTS_ALL) FORCE 70 + $(call if_changed,ld) 77 71 78 - $(obj)/startup.a: $(OBJECTS) FORCE 79 - $(call if_changed,ar) 72 + LDFLAGS_vmlinux.syms := --oformat $(LD_BFD) -e startup -T 73 + $(obj)/vmlinux.syms: $(obj)/vmlinux.lds $(OBJECTS) FORCE 74 + $(call if_changed,ld) 75 + 76 + quiet_cmd_dumpsyms = DUMPSYMS $< 77 + define cmd_dumpsyms 78 + $(NM) -n -S --format=bsd "$<" | sed -nE 's/^0*([0-9a-fA-F]+) 0*([0-9a-fA-F]+) [tT] ([^ ]*)$$/\1 \2 \3/p' | tr '\n' '\0' > "$@" 79 + endef 80 + 81 + $(obj)/syms.bin: $(obj)/vmlinux.syms FORCE 82 + $(call if_changed,dumpsyms) 83 + 84 + OBJCOPYFLAGS_syms.o := -I binary -O elf64-s390 -B s390:64-bit --rename-section .data=.decompressor.syms 85 + $(obj)/syms.o: $(obj)/syms.bin FORCE 86 + $(call if_changed,objcopy) 87 + 88 + OBJCOPYFLAGS_info.bin := -O binary --only-section=.vmlinux.info --set-section-flags .vmlinux.info=load 89 + $(obj)/info.bin: vmlinux FORCE 90 + $(call if_changed,objcopy) 91 + 92 + OBJCOPYFLAGS_info.o := -I binary -O elf64-s390 -B s390:64-bit --rename-section .data=.vmlinux.info 93 + $(obj)/info.o: $(obj)/info.bin FORCE 94 + $(call if_changed,objcopy) 95 + 96 + OBJCOPYFLAGS_vmlinux.bin := -O binary --remove-section=.comment --remove-section=.vmlinux.info -S 97 + $(obj)/vmlinux.bin: vmlinux FORCE 98 + $(call if_changed,objcopy) 99 + 100 + suffix-$(CONFIG_KERNEL_GZIP) := .gz 101 + suffix-$(CONFIG_KERNEL_BZIP2) := .bz2 102 + suffix-$(CONFIG_KERNEL_LZ4) := .lz4 103 + suffix-$(CONFIG_KERNEL_LZMA) := .lzma 104 + suffix-$(CONFIG_KERNEL_LZO) := .lzo 105 + suffix-$(CONFIG_KERNEL_XZ) := .xz 106 + suffix-$(CONFIG_KERNEL_ZSTD) := .zst 107 + 108 + $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE 109 + $(call if_changed,gzip) 110 + $(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE 111 + $(call if_changed,bzip2_with_size) 112 + $(obj)/vmlinux.bin.lz4: $(obj)/vmlinux.bin FORCE 113 + $(call if_changed,lz4_with_size) 114 + $(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE 115 + $(call if_changed,lzma_with_size) 116 + $(obj)/vmlinux.bin.lzo: $(obj)/vmlinux.bin FORCE 117 + $(call if_changed,lzo_with_size) 118 + $(obj)/vmlinux.bin.xz: $(obj)/vmlinux.bin FORCE 119 + $(call if_changed,xzkern_with_size) 120 + $(obj)/vmlinux.bin.zst: $(obj)/vmlinux.bin FORCE 121 + $(call if_changed,zstd22_with_size) 122 + 123 + OBJCOPYFLAGS_piggy.o := -I binary -O elf64-s390 -B s390:64-bit --rename-section .data=.vmlinux.bin.compressed 124 + $(obj)/piggy.o: $(obj)/vmlinux.bin$(suffix-y) FORCE 125 + $(call if_changed,objcopy)
-4
arch/s390/boot/compressed/.gitignore
··· 1 - # SPDX-License-Identifier: GPL-2.0-only 2 - vmlinux 3 - vmlinux.lds 4 - vmlinux.syms
-86
arch/s390/boot/compressed/Makefile
··· 1 - # SPDX-License-Identifier: GPL-2.0 2 - # 3 - # linux/arch/s390/boot/compressed/Makefile 4 - # 5 - # create a compressed vmlinux image from the original vmlinux 6 - # 7 - 8 - KCOV_INSTRUMENT := n 9 - GCOV_PROFILE := n 10 - UBSAN_SANITIZE := n 11 - KASAN_SANITIZE := n 12 - KCSAN_SANITIZE := n 13 - 14 - obj-y := $(if $(CONFIG_KERNEL_UNCOMPRESSED),,decompressor.o) info.o 15 - obj-$(CONFIG_KERNEL_ZSTD) += clz_ctz.o 16 - obj-all := $(obj-y) piggy.o syms.o 17 - targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 18 - targets += vmlinux.bin.xz vmlinux.bin.lzma vmlinux.bin.lzo vmlinux.bin.lz4 19 - targets += vmlinux.bin.zst 20 - targets += info.bin syms.bin vmlinux.syms $(obj-all) 21 - 22 - KBUILD_AFLAGS := $(KBUILD_AFLAGS_DECOMPRESSOR) 23 - KBUILD_CFLAGS := $(KBUILD_CFLAGS_DECOMPRESSOR) 24 - OBJCOPYFLAGS := 25 - 26 - OBJECTS := $(addprefix $(obj)/,$(obj-y)) 27 - OBJECTS_ALL := $(addprefix $(obj)/,$(obj-all)) 28 - 29 - LDFLAGS_vmlinux := --oformat $(LD_BFD) -e startup --build-id=sha1 -T 30 - $(obj)/vmlinux: $(obj)/vmlinux.lds $(objtree)/arch/s390/boot/startup.a $(OBJECTS_ALL) FORCE 31 - $(call if_changed,ld) 32 - 33 - LDFLAGS_vmlinux.syms := --oformat $(LD_BFD) -e startup -T 34 - $(obj)/vmlinux.syms: $(obj)/vmlinux.lds $(objtree)/arch/s390/boot/startup.a $(OBJECTS) FORCE 35 - $(call if_changed,ld) 36 - 37 - quiet_cmd_dumpsyms = DUMPSYMS $< 38 - define cmd_dumpsyms 39 - $(NM) -n -S --format=bsd "$<" | sed -nE 's/^0*([0-9a-fA-F]+) 0*([0-9a-fA-F]+) [tT] ([^ ]*)$$/\1 \2 \3/p' | tr '\n' '\0' > "$@" 40 - endef 41 - 42 - $(obj)/syms.bin: $(obj)/vmlinux.syms FORCE 43 - $(call if_changed,dumpsyms) 44 - 45 - OBJCOPYFLAGS_syms.o := -I binary -O elf64-s390 -B s390:64-bit --rename-section .data=.decompressor.syms 46 - $(obj)/syms.o: $(obj)/syms.bin FORCE 47 - $(call if_changed,objcopy) 48 - 49 - OBJCOPYFLAGS_info.bin := -O binary --only-section=.vmlinux.info --set-section-flags .vmlinux.info=load 50 - $(obj)/info.bin: vmlinux FORCE 51 - $(call if_changed,objcopy) 52 - 53 - OBJCOPYFLAGS_info.o := -I binary -O elf64-s390 -B s390:64-bit --rename-section .data=.vmlinux.info 54 - $(obj)/info.o: $(obj)/info.bin FORCE 55 - $(call if_changed,objcopy) 56 - 57 - OBJCOPYFLAGS_vmlinux.bin := -O binary --remove-section=.comment --remove-section=.vmlinux.info -S 58 - $(obj)/vmlinux.bin: vmlinux FORCE 59 - $(call if_changed,objcopy) 60 - 61 - suffix-$(CONFIG_KERNEL_GZIP) := .gz 62 - suffix-$(CONFIG_KERNEL_BZIP2) := .bz2 63 - suffix-$(CONFIG_KERNEL_LZ4) := .lz4 64 - suffix-$(CONFIG_KERNEL_LZMA) := .lzma 65 - suffix-$(CONFIG_KERNEL_LZO) := .lzo 66 - suffix-$(CONFIG_KERNEL_XZ) := .xz 67 - suffix-$(CONFIG_KERNEL_ZSTD) := .zst 68 - 69 - $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE 70 - $(call if_changed,gzip) 71 - $(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE 72 - $(call if_changed,bzip2_with_size) 73 - $(obj)/vmlinux.bin.lz4: $(obj)/vmlinux.bin FORCE 74 - $(call if_changed,lz4_with_size) 75 - $(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE 76 - $(call if_changed,lzma_with_size) 77 - $(obj)/vmlinux.bin.lzo: $(obj)/vmlinux.bin FORCE 78 - $(call if_changed,lzo_with_size) 79 - $(obj)/vmlinux.bin.xz: $(obj)/vmlinux.bin FORCE 80 - $(call if_changed,xzkern_with_size) 81 - $(obj)/vmlinux.bin.zst: $(obj)/vmlinux.bin FORCE 82 - $(call if_changed,zstd22_with_size) 83 - 84 - OBJCOPYFLAGS_piggy.o := -I binary -O elf64-s390 -B s390:64-bit --rename-section .data=.vmlinux.bin.compressed 85 - $(obj)/piggy.o: $(obj)/vmlinux.bin$(suffix-y) FORCE 86 - $(call if_changed,objcopy)
arch/s390/boot/compressed/clz_ctz.c arch/s390/boot/clz_ctz.c
arch/s390/boot/compressed/decompressor.c arch/s390/boot/decompressor.c
arch/s390/boot/compressed/decompressor.h arch/s390/boot/decompressor.h
arch/s390/boot/compressed/vmlinux.lds.S arch/s390/boot/vmlinux.lds.S
+1 -1
arch/s390/boot/kaslr.c
··· 8 8 #include <asm/timex.h> 9 9 #include <asm/sclp.h> 10 10 #include <asm/kasan.h> 11 - #include "compressed/decompressor.h" 11 + #include "decompressor.h" 12 12 #include "boot.h" 13 13 14 14 #define PRNG_MODE_TDES 1
+1 -1
arch/s390/boot/mem_detect.c
··· 7 7 #include <asm/sections.h> 8 8 #include <asm/mem_detect.h> 9 9 #include <asm/sparsemem.h> 10 - #include "compressed/decompressor.h" 10 + #include "decompressor.h" 11 11 #include "boot.h" 12 12 13 13 struct mem_detect_info __bootdata(mem_detect);
+1 -1
arch/s390/boot/startup.c
··· 10 10 #include <asm/sclp.h> 11 11 #include <asm/diag.h> 12 12 #include <asm/uv.h> 13 - #include "compressed/decompressor.h" 13 + #include "decompressor.h" 14 14 #include "boot.h" 15 15 #include "uv.h" 16 16