s390/boot: pad bzImage to 4K
[sfrench/cifs-2.6.git] / arch / s390 / boot / Makefile
1 # SPDX-License-Identifier: GPL-2.0
2 #
3 # Makefile for the linux s390-specific parts of the memory manager.
4 #
5
6 KCOV_INSTRUMENT := n
7 GCOV_PROFILE := n
8 UBSAN_SANITIZE := n
9 KASAN_SANITIZE := n
10
11 KBUILD_AFLAGS := $(KBUILD_AFLAGS_DECOMPRESSOR)
12 KBUILD_CFLAGS := $(KBUILD_CFLAGS_DECOMPRESSOR)
13
14 #
15 # Use -march=z900 for als.c to be able to print an error
16 # message if the kernel is started on a machine which is too old
17 #
18 ifneq ($(CC_FLAGS_MARCH),-march=z900)
19 AFLAGS_REMOVE_head.o            += $(CC_FLAGS_MARCH)
20 AFLAGS_head.o                   += -march=z900
21 AFLAGS_REMOVE_mem.o             += $(CC_FLAGS_MARCH)
22 AFLAGS_mem.o                    += -march=z900
23 CFLAGS_REMOVE_als.o             += $(CC_FLAGS_MARCH)
24 CFLAGS_als.o                    += -march=z900
25 CFLAGS_REMOVE_sclp_early_core.o += $(CC_FLAGS_MARCH)
26 CFLAGS_sclp_early_core.o        += -march=z900
27 endif
28
29 CFLAGS_sclp_early_core.o += -I$(srctree)/drivers/s390/char
30
31 obj-y   := head.o als.o startup.o mem_detect.o ipl_parm.o ipl_report.o
32 obj-y   += string.o ebcdic.o sclp_early_core.o mem.o ipl_vmparm.o cmdline.o
33 obj-y   += ctype.o
34 obj-$(CONFIG_PROTECTED_VIRTUALIZATION_GUEST)    += uv.o
35 targets := bzImage startup.a section_cmp.boot.data section_cmp.boot.preserved.data $(obj-y)
36 subdir- := compressed
37
38 OBJECTS := $(addprefix $(obj)/,$(obj-y))
39
40 quiet_cmd_section_cmp = SECTCMP $*
41 define cmd_section_cmp
42         s1=`$(OBJDUMP) -t -j "$*" "$<" | sort | \
43                 sed -n "/0000000000000000/! s/.*\s$*\s\+//p" | sha256sum`; \
44         s2=`$(OBJDUMP) -t -j "$*" "$(word 2,$^)" | sort | \
45                 sed -n "/0000000000000000/! s/.*\s$*\s\+//p" | sha256sum`; \
46         if [ "$$s1" != "$$s2" ]; then \
47                 echo "error: section $* differs between $< and $(word 2,$^)" >&2; \
48                 exit 1; \
49         fi; \
50         touch $@
51 endef
52
53 OBJCOPYFLAGS_bzImage := --pad-to $$(readelf -s $(obj)/compressed/vmlinux | awk '/\<_end\>/ {print or(strtonum("0x"$$2),4095)+1}')
54 $(obj)/bzImage: $(obj)/compressed/vmlinux $(obj)/section_cmp.boot.data $(obj)/section_cmp.boot.preserved.data FORCE
55         $(call if_changed,objcopy)
56
57 $(obj)/section_cmp%: vmlinux $(obj)/compressed/vmlinux FORCE
58         $(call if_changed,section_cmp)
59
60 $(obj)/compressed/vmlinux: $(obj)/startup.a FORCE
61         $(Q)$(MAKE) $(build)=$(obj)/compressed $@
62
63 $(obj)/startup.a: $(OBJECTS) FORCE
64         $(call if_changed,ar)
65
66 install: $(CONFIGURE) $(obj)/bzImage
67         sh -x  $(srctree)/$(obj)/install.sh $(KERNELRELEASE) $(obj)/bzImage \
68               System.map "$(INSTALL_PATH)"
69
70 chkbss := $(obj-y)
71 chkbss-target := startup.a
72 include $(srctree)/arch/s390/scripts/Makefile.chkbss