1b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0 21da177e4SLinus Torvalds# 31da177e4SLinus Torvalds# Makefile for the linux s390-specific parts of the memory manager. 41da177e4SLinus Torvalds# 51da177e4SLinus Torvalds 68282cd64SVasily GorbikKCOV_INSTRUMENT := n 78282cd64SVasily GorbikGCOV_PROFILE := n 88282cd64SVasily GorbikUBSAN_SANITIZE := n 90a9b4091SVasily GorbikKASAN_SANITIZE := n 10e37b3dd0SIlya LeoshkevichKCSAN_SANITIZE := n 118282cd64SVasily Gorbik 128282cd64SVasily GorbikKBUILD_AFLAGS := $(KBUILD_AFLAGS_DECOMPRESSOR) 138282cd64SVasily GorbikKBUILD_CFLAGS := $(KBUILD_CFLAGS_DECOMPRESSOR) 148282cd64SVasily Gorbik 158282cd64SVasily Gorbik# 16c263a4e9SArnd Bergmann# Use minimum architecture for als.c to be able to print an error 178282cd64SVasily Gorbik# message if the kernel is started on a machine which is too old 188282cd64SVasily Gorbik# 19c263a4e9SArnd Bergmannifndef CONFIG_CC_IS_CLANG 20c263a4e9SArnd BergmannCC_FLAGS_MARCH_MINIMUM := -march=z900 21c263a4e9SArnd Bergmannelse 22c263a4e9SArnd BergmannCC_FLAGS_MARCH_MINIMUM := -march=z10 23c263a4e9SArnd Bergmannendif 24c263a4e9SArnd Bergmann 25c263a4e9SArnd Bergmannifneq ($(CC_FLAGS_MARCH),$(CC_FLAGS_MARCH_MINIMUM)) 268282cd64SVasily GorbikAFLAGS_REMOVE_head.o += $(CC_FLAGS_MARCH) 27c263a4e9SArnd BergmannAFLAGS_head.o += $(CC_FLAGS_MARCH_MINIMUM) 28cad5b35dSVasily GorbikAFLAGS_REMOVE_mem.o += $(CC_FLAGS_MARCH) 29c263a4e9SArnd BergmannAFLAGS_mem.o += $(CC_FLAGS_MARCH_MINIMUM) 308282cd64SVasily GorbikCFLAGS_REMOVE_als.o += $(CC_FLAGS_MARCH) 31c263a4e9SArnd BergmannCFLAGS_als.o += $(CC_FLAGS_MARCH_MINIMUM) 32a1d7d91fSVasily GorbikCFLAGS_REMOVE_sclp_early_core.o += $(CC_FLAGS_MARCH) 33c263a4e9SArnd BergmannCFLAGS_sclp_early_core.o += $(CC_FLAGS_MARCH_MINIMUM) 348282cd64SVasily Gorbikendif 358282cd64SVasily Gorbik 36a1d7d91fSVasily GorbikCFLAGS_sclp_early_core.o += -I$(srctree)/drivers/s390/char 37a1d7d91fSVasily Gorbik 38*8c37cb7dSVasily Gorbikobj-y := head.o als.o startup.o physmem_info.o ipl_parm.o ipl_report.o vmem.o 399641b8ccSMartin Schwidefskyobj-y += string.o ebcdic.o sclp_early_core.o mem.o ipl_vmparm.o cmdline.o 4080ddf5ceSHeiko Carstensobj-y += version.o pgm_check_info.o ctype.o ipl_data.o machine_kexec_reloc.o 41ecdc5d84SVasily Gorbikobj-$(findstring y, $(CONFIG_PROTECTED_VIRTUALIZATION_GUEST) $(CONFIG_PGSTE)) += uv.o 42b2d24b97SGerald Schaeferobj-$(CONFIG_RANDOMIZE_BASE) += kaslr.o 43edd4a866SHeiko Carstensobj-y += $(if $(CONFIG_KERNEL_UNCOMPRESSED),,decompressor.o) info.o 44edd4a866SHeiko Carstensobj-$(CONFIG_KERNEL_ZSTD) += clz_ctz.o 45edd4a866SHeiko Carstensobj-all := $(obj-y) piggy.o syms.o 46edd4a866SHeiko Carstens 47edd4a866SHeiko Carstenstargets := bzImage section_cmp.boot.data section_cmp.boot.preserved.data $(obj-y) 48edd4a866SHeiko Carstenstargets += vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 49edd4a866SHeiko Carstenstargets += vmlinux.bin.xz vmlinux.bin.lzma vmlinux.bin.lzo vmlinux.bin.lz4 50edd4a866SHeiko Carstenstargets += vmlinux.bin.zst info.bin syms.bin vmlinux.syms $(obj-all) 511da177e4SLinus Torvalds 528282cd64SVasily GorbikOBJECTS := $(addprefix $(obj)/,$(obj-y)) 53edd4a866SHeiko CarstensOBJECTS_ALL := $(addprefix $(obj)/,$(obj-all)) 548282cd64SVasily Gorbik 559b5c37bbSVasily Gorbikclean-files += vmlinux.map 569b5c37bbSVasily Gorbik 57251b72a4SVasily Gorbikquiet_cmd_section_cmp = SECTCMP $* 58251b72a4SVasily Gorbikdefine cmd_section_cmp 59251b72a4SVasily Gorbik s1=`$(OBJDUMP) -t -j "$*" "$<" | sort | \ 60251b72a4SVasily Gorbik sed -n "/0000000000000000/! s/.*\s$*\s\+//p" | sha256sum`; \ 61251b72a4SVasily Gorbik s2=`$(OBJDUMP) -t -j "$*" "$(word 2,$^)" | sort | \ 62251b72a4SVasily Gorbik sed -n "/0000000000000000/! s/.*\s$*\s\+//p" | sha256sum`; \ 63251b72a4SVasily Gorbik if [ "$$s1" != "$$s2" ]; then \ 64251b72a4SVasily Gorbik echo "error: section $* differs between $< and $(word 2,$^)" >&2; \ 65251b72a4SVasily Gorbik exit 1; \ 66251b72a4SVasily Gorbik fi; \ 67251b72a4SVasily Gorbik touch $@ 68251b72a4SVasily Gorbikendef 69251b72a4SVasily Gorbik 70edd4a866SHeiko Carstens$(obj)/bzImage: $(obj)/vmlinux $(obj)/section_cmp.boot.data $(obj)/section_cmp.boot.preserved.data FORCE 711844c9bcSMartin Schwidefsky $(call if_changed,objcopy) 721844c9bcSMartin Schwidefsky 73edd4a866SHeiko Carstens$(obj)/section_cmp%: vmlinux $(obj)/vmlinux FORCE 74251b72a4SVasily Gorbik $(call if_changed,section_cmp) 75251b72a4SVasily Gorbik 769b5c37bbSVasily GorbikLDFLAGS_vmlinux := --oformat $(LD_BFD) -e startup $(if $(CONFIG_VMLINUX_MAP),-Map=$(obj)/vmlinux.map) --build-id=sha1 -T 77edd4a866SHeiko Carstens$(obj)/vmlinux: $(obj)/vmlinux.lds $(OBJECTS_ALL) FORCE 78edd4a866SHeiko Carstens $(call if_changed,ld) 791844c9bcSMartin Schwidefsky 80edd4a866SHeiko CarstensLDFLAGS_vmlinux.syms := --oformat $(LD_BFD) -e startup -T 81edd4a866SHeiko Carstens$(obj)/vmlinux.syms: $(obj)/vmlinux.lds $(OBJECTS) FORCE 82edd4a866SHeiko Carstens $(call if_changed,ld) 83edd4a866SHeiko Carstens 84edd4a866SHeiko Carstensquiet_cmd_dumpsyms = DUMPSYMS $< 85edd4a866SHeiko Carstensdefine cmd_dumpsyms 86edd4a866SHeiko Carstens $(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' > "$@" 87edd4a866SHeiko Carstensendef 88edd4a866SHeiko Carstens 89edd4a866SHeiko Carstens$(obj)/syms.bin: $(obj)/vmlinux.syms FORCE 90edd4a866SHeiko Carstens $(call if_changed,dumpsyms) 91edd4a866SHeiko Carstens 92edd4a866SHeiko CarstensOBJCOPYFLAGS_syms.o := -I binary -O elf64-s390 -B s390:64-bit --rename-section .data=.decompressor.syms 93edd4a866SHeiko Carstens$(obj)/syms.o: $(obj)/syms.bin FORCE 94edd4a866SHeiko Carstens $(call if_changed,objcopy) 95edd4a866SHeiko Carstens 96edd4a866SHeiko CarstensOBJCOPYFLAGS_info.bin := -O binary --only-section=.vmlinux.info --set-section-flags .vmlinux.info=load 97edd4a866SHeiko Carstens$(obj)/info.bin: vmlinux FORCE 98edd4a866SHeiko Carstens $(call if_changed,objcopy) 99edd4a866SHeiko Carstens 100edd4a866SHeiko CarstensOBJCOPYFLAGS_info.o := -I binary -O elf64-s390 -B s390:64-bit --rename-section .data=.vmlinux.info 101edd4a866SHeiko Carstens$(obj)/info.o: $(obj)/info.bin FORCE 102edd4a866SHeiko Carstens $(call if_changed,objcopy) 103edd4a866SHeiko Carstens 104edd4a866SHeiko CarstensOBJCOPYFLAGS_vmlinux.bin := -O binary --remove-section=.comment --remove-section=.vmlinux.info -S 105edd4a866SHeiko Carstens$(obj)/vmlinux.bin: vmlinux FORCE 106edd4a866SHeiko Carstens $(call if_changed,objcopy) 107edd4a866SHeiko Carstens 108edd4a866SHeiko Carstenssuffix-$(CONFIG_KERNEL_GZIP) := .gz 109edd4a866SHeiko Carstenssuffix-$(CONFIG_KERNEL_BZIP2) := .bz2 110edd4a866SHeiko Carstenssuffix-$(CONFIG_KERNEL_LZ4) := .lz4 111edd4a866SHeiko Carstenssuffix-$(CONFIG_KERNEL_LZMA) := .lzma 112edd4a866SHeiko Carstenssuffix-$(CONFIG_KERNEL_LZO) := .lzo 113edd4a866SHeiko Carstenssuffix-$(CONFIG_KERNEL_XZ) := .xz 114edd4a866SHeiko Carstenssuffix-$(CONFIG_KERNEL_ZSTD) := .zst 115edd4a866SHeiko Carstens 116edd4a866SHeiko Carstens$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE 117edd4a866SHeiko Carstens $(call if_changed,gzip) 118edd4a866SHeiko Carstens$(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE 119edd4a866SHeiko Carstens $(call if_changed,bzip2_with_size) 120edd4a866SHeiko Carstens$(obj)/vmlinux.bin.lz4: $(obj)/vmlinux.bin FORCE 121edd4a866SHeiko Carstens $(call if_changed,lz4_with_size) 122edd4a866SHeiko Carstens$(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE 123edd4a866SHeiko Carstens $(call if_changed,lzma_with_size) 124edd4a866SHeiko Carstens$(obj)/vmlinux.bin.lzo: $(obj)/vmlinux.bin FORCE 125edd4a866SHeiko Carstens $(call if_changed,lzo_with_size) 126edd4a866SHeiko Carstens$(obj)/vmlinux.bin.xz: $(obj)/vmlinux.bin FORCE 127edd4a866SHeiko Carstens $(call if_changed,xzkern_with_size) 128edd4a866SHeiko Carstens$(obj)/vmlinux.bin.zst: $(obj)/vmlinux.bin FORCE 129edd4a866SHeiko Carstens $(call if_changed,zstd22_with_size) 130edd4a866SHeiko Carstens 131edd4a866SHeiko CarstensOBJCOPYFLAGS_piggy.o := -I binary -O elf64-s390 -B s390:64-bit --rename-section .data=.vmlinux.bin.compressed 132edd4a866SHeiko Carstens$(obj)/piggy.o: $(obj)/vmlinux.bin$(suffix-y) FORCE 133edd4a866SHeiko Carstens $(call if_changed,objcopy) 134