xref: /openbmc/linux/arch/s390/boot/Makefile (revision 647d41d3)
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
10KCSAN_SANITIZE := n
11
12KBUILD_AFLAGS := $(KBUILD_AFLAGS_DECOMPRESSOR)
13KBUILD_CFLAGS := $(KBUILD_CFLAGS_DECOMPRESSOR)
14
15#
16# Use minimum architecture for als.c to be able to print an error
17# message if the kernel is started on a machine which is too old
18#
19ifndef CONFIG_CC_IS_CLANG
20CC_FLAGS_MARCH_MINIMUM := -march=z900
21else
22CC_FLAGS_MARCH_MINIMUM := -march=z10
23endif
24
25ifneq ($(CC_FLAGS_MARCH),$(CC_FLAGS_MARCH_MINIMUM))
26AFLAGS_REMOVE_head.o		+= $(CC_FLAGS_MARCH)
27AFLAGS_head.o			+= $(CC_FLAGS_MARCH_MINIMUM)
28AFLAGS_REMOVE_mem.o		+= $(CC_FLAGS_MARCH)
29AFLAGS_mem.o			+= $(CC_FLAGS_MARCH_MINIMUM)
30CFLAGS_REMOVE_als.o		+= $(CC_FLAGS_MARCH)
31CFLAGS_als.o			+= $(CC_FLAGS_MARCH_MINIMUM)
32CFLAGS_REMOVE_sclp_early_core.o	+= $(CC_FLAGS_MARCH)
33CFLAGS_sclp_early_core.o	+= $(CC_FLAGS_MARCH_MINIMUM)
34endif
35
36CFLAGS_sclp_early_core.o += -I$(srctree)/drivers/s390/char
37
38obj-y	:= head.o als.o startup.o mem_detect.o ipl_parm.o ipl_report.o
39obj-y	+= string.o ebcdic.o sclp_early_core.o mem.o ipl_vmparm.o cmdline.o
40obj-y	+= version.o pgm_check_info.o ctype.o
41obj-$(findstring y, $(CONFIG_PROTECTED_VIRTUALIZATION_GUEST) $(CONFIG_PGSTE))	+= uv.o
42obj-$(CONFIG_RELOCATABLE)	+= machine_kexec_reloc.o
43obj-$(CONFIG_RANDOMIZE_BASE)	+= kaslr.o
44targets	:= bzImage startup.a section_cmp.boot.data section_cmp.boot.preserved.data $(obj-y)
45subdir-	:= compressed
46
47OBJECTS := $(addprefix $(obj)/,$(obj-y))
48
49quiet_cmd_section_cmp = SECTCMP $*
50define cmd_section_cmp
51	s1=`$(OBJDUMP) -t -j "$*" "$<" | sort | \
52		sed -n "/0000000000000000/! s/.*\s$*\s\+//p" | sha256sum`; \
53	s2=`$(OBJDUMP) -t -j "$*" "$(word 2,$^)" | sort | \
54		sed -n "/0000000000000000/! s/.*\s$*\s\+//p" | sha256sum`; \
55	if [ "$$s1" != "$$s2" ]; then \
56		echo "error: section $* differs between $< and $(word 2,$^)" >&2; \
57		exit 1; \
58	fi; \
59	touch $@
60endef
61
62$(obj)/bzImage: $(obj)/compressed/vmlinux $(obj)/section_cmp.boot.data $(obj)/section_cmp.boot.preserved.data FORCE
63	$(call if_changed,objcopy)
64
65$(obj)/section_cmp%: vmlinux $(obj)/compressed/vmlinux FORCE
66	$(call if_changed,section_cmp)
67
68$(obj)/compressed/vmlinux: $(obj)/startup.a FORCE
69	$(Q)$(MAKE) $(build)=$(obj)/compressed $@
70
71$(obj)/startup.a: $(OBJECTS) FORCE
72	$(call if_changed,ar)
73