@@ -41,10 +41,17 @@ obj-y += version.o pgm_check_info.o ctype.o
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
@@ -59,14 +66,67 @@ define cmd_section_cmp
59
66
touch $@
60
67
endef
61
68
62
- $(obj ) /bzImage : $(obj ) /compressed/ vmlinux $(obj ) /section_cmp.boot.data $(obj ) /section_cmp.boot.preserved.data FORCE
69
+ $(obj ) /bzImage : $(obj ) /vmlinux $(obj ) /section_cmp.boot.data $(obj ) /section_cmp.boot.preserved.data FORCE
63
70
$(call if_changed,objcopy)
64
71
65
- $(obj ) /section_cmp% : vmlinux $(obj ) /compressed/ vmlinux FORCE
72
+ $(obj ) /section_cmp% : vmlinux $(obj ) /vmlinux FORCE
66
73
$(call if_changed,section_cmp)
67
74
68
- $(obj ) /compressed/vmlinux : $(obj ) /startup.a FORCE
69
- $(Q )$(MAKE ) $(build ) =$(obj ) /compressed $@
75
+ LDFLAGS_vmlinux := --oformat $(LD_BFD ) -e startup --build-id=sha1 -T
76
+ $(obj ) /vmlinux : $(obj ) /vmlinux.lds $(OBJECTS_ALL ) FORCE
77
+ $(call if_changed,ld)
78
+
79
+ LDFLAGS_vmlinux.syms := --oformat $(LD_BFD ) -e startup -T
80
+ $(obj ) /vmlinux.syms : $(obj ) /vmlinux.lds $(OBJECTS ) FORCE
81
+ $(call if_changed,ld)
82
+
83
+ quiet_cmd_dumpsyms = DUMPSYMS $<
84
+ define cmd_dumpsyms
85
+ $(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' > "$@ "
86
+ endef
87
+
88
+ $(obj ) /syms.bin : $(obj ) /vmlinux.syms FORCE
89
+ $(call if_changed,dumpsyms)
90
+
91
+ OBJCOPYFLAGS_syms.o := -I binary -O elf64-s390 -B s390:64-bit --rename-section .data=.decompressor.syms
92
+ $(obj ) /syms.o : $(obj ) /syms.bin FORCE
93
+ $(call if_changed,objcopy)
94
+
95
+ OBJCOPYFLAGS_info.bin := -O binary --only-section=.vmlinux.info --set-section-flags .vmlinux.info=load
96
+ $(obj ) /info.bin : vmlinux FORCE
97
+ $(call if_changed,objcopy)
98
+
99
+ OBJCOPYFLAGS_info.o := -I binary -O elf64-s390 -B s390:64-bit --rename-section .data=.vmlinux.info
100
+ $(obj ) /info.o : $(obj ) /info.bin FORCE
101
+ $(call if_changed,objcopy)
102
+
103
+ OBJCOPYFLAGS_vmlinux.bin := -O binary --remove-section=.comment --remove-section=.vmlinux.info -S
104
+ $(obj ) /vmlinux.bin : vmlinux FORCE
105
+ $(call if_changed,objcopy)
106
+
107
+ suffix-$(CONFIG_KERNEL_GZIP) := .gz
108
+ suffix-$(CONFIG_KERNEL_BZIP2) := .bz2
109
+ suffix-$(CONFIG_KERNEL_LZ4) := .lz4
110
+ suffix-$(CONFIG_KERNEL_LZMA) := .lzma
111
+ suffix-$(CONFIG_KERNEL_LZO) := .lzo
112
+ suffix-$(CONFIG_KERNEL_XZ) := .xz
113
+ suffix-$(CONFIG_KERNEL_ZSTD) := .zst
70
114
71
- $(obj ) /startup.a : $(OBJECTS ) FORCE
72
- $(call if_changed,ar)
115
+ $(obj ) /vmlinux.bin.gz : $(obj ) /vmlinux.bin FORCE
116
+ $(call if_changed,gzip)
117
+ $(obj ) /vmlinux.bin.bz2 : $(obj ) /vmlinux.bin FORCE
118
+ $(call if_changed,bzip2_with_size)
119
+ $(obj ) /vmlinux.bin.lz4 : $(obj ) /vmlinux.bin FORCE
120
+ $(call if_changed,lz4_with_size)
121
+ $(obj ) /vmlinux.bin.lzma : $(obj ) /vmlinux.bin FORCE
122
+ $(call if_changed,lzma_with_size)
123
+ $(obj ) /vmlinux.bin.lzo : $(obj ) /vmlinux.bin FORCE
124
+ $(call if_changed,lzo_with_size)
125
+ $(obj ) /vmlinux.bin.xz : $(obj ) /vmlinux.bin FORCE
126
+ $(call if_changed,xzkern_with_size)
127
+ $(obj ) /vmlinux.bin.zst : $(obj ) /vmlinux.bin FORCE
128
+ $(call if_changed,zstd22_with_size)
129
+
130
+ OBJCOPYFLAGS_piggy.o := -I binary -O elf64-s390 -B s390:64-bit --rename-section .data=.vmlinux.bin.compressed
131
+ $(obj ) /piggy.o : $(obj ) /vmlinux.bin$(suffix-y ) FORCE
132
+ $(call if_changed,objcopy)
0 commit comments