xref: /openbmc/linux/arch/s390/boot/Makefile (revision f9834f18)
1# SPDX-License-Identifier: GPL-2.0
2#
3# Makefile for the linux s390-specific parts of the memory manager.
4#
5
6KCOV_INSTRUMENT := n
7GCOV_PROFILE := n
8UBSAN_SANITIZE := n
9KASAN_SANITIZE := n
10
11KBUILD_AFLAGS := $(KBUILD_AFLAGS_DECOMPRESSOR)
12KBUILD_CFLAGS := $(KBUILD_CFLAGS_DECOMPRESSOR)
13
14#
15# Use minimum architecture 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#
18ifndef CONFIG_CC_IS_CLANG
19CC_FLAGS_MARCH_MINIMUM := -march=z900
20else
21CC_FLAGS_MARCH_MINIMUM := -march=z10
22endif
23
24ifneq ($(CC_FLAGS_MARCH),$(CC_FLAGS_MARCH_MINIMUM))
25AFLAGS_REMOVE_head.o		+= $(CC_FLAGS_MARCH)
26AFLAGS_head.o			+= $(CC_FLAGS_MARCH_MINIMUM)
27AFLAGS_REMOVE_mem.o		+= $(CC_FLAGS_MARCH)
28AFLAGS_mem.o			+= $(CC_FLAGS_MARCH_MINIMUM)
29CFLAGS_REMOVE_als.o		+= $(CC_FLAGS_MARCH)
30CFLAGS_als.o			+= $(CC_FLAGS_MARCH_MINIMUM)
31CFLAGS_REMOVE_sclp_early_core.o	+= $(CC_FLAGS_MARCH)
32CFLAGS_sclp_early_core.o	+= $(CC_FLAGS_MARCH_MINIMUM)
33endif
34
35CFLAGS_sclp_early_core.o += -I$(srctree)/drivers/s390/char
36
37obj-y	:= head.o als.o startup.o mem_detect.o ipl_parm.o ipl_report.o
38obj-y	+= string.o ebcdic.o sclp_early_core.o mem.o ipl_vmparm.o cmdline.o
39obj-y	+= version.o pgm_check_info.o ctype.o text_dma.o
40obj-$(CONFIG_PROTECTED_VIRTUALIZATION_GUEST)	+= uv.o
41obj-$(CONFIG_RELOCATABLE)	+= machine_kexec_reloc.o
42obj-$(CONFIG_RANDOMIZE_BASE)	+= kaslr.o
43targets	:= bzImage startup.a section_cmp.boot.data section_cmp.boot.preserved.data $(obj-y)
44subdir-	:= compressed
45
46OBJECTS := $(addprefix $(obj)/,$(obj-y))
47
48quiet_cmd_section_cmp = SECTCMP $*
49define cmd_section_cmp
50	s1=`$(OBJDUMP) -t -j "$*" "$<" | sort | \
51		sed -n "/0000000000000000/! s/.*\s$*\s\+//p" | sha256sum`; \
52	s2=`$(OBJDUMP) -t -j "$*" "$(word 2,$^)" | sort | \
53		sed -n "/0000000000000000/! s/.*\s$*\s\+//p" | sha256sum`; \
54	if [ "$$s1" != "$$s2" ]; then \
55		echo "error: section $* differs between $< and $(word 2,$^)" >&2; \
56		exit 1; \
57	fi; \
58	touch $@
59endef
60
61$(obj)/bzImage: $(obj)/compressed/vmlinux $(obj)/section_cmp.boot.data $(obj)/section_cmp.boot.preserved.data FORCE
62	$(call if_changed,objcopy)
63
64$(obj)/section_cmp%: vmlinux $(obj)/compressed/vmlinux FORCE
65	$(call if_changed,section_cmp)
66
67$(obj)/compressed/vmlinux: $(obj)/startup.a FORCE
68	$(Q)$(MAKE) $(build)=$(obj)/compressed $@
69
70$(obj)/startup.a: $(OBJECTS) FORCE
71	$(call if_changed,ar)
72
73install:
74	sh -x  $(srctree)/$(obj)/install.sh $(KERNELRELEASE) $(obj)/bzImage \
75	      System.map "$(INSTALL_PATH)"
76
77chkbss := $(obj-y)
78chkbss-target := startup.a
79include $(srctree)/arch/s390/scripts/Makefile.chkbss
80