Makefile 2.4 KB
Newer Older
1
# SPDX-License-Identifier: GPL-2.0
2 3 4 5 6 7
#
# linux/arch/s390/boot/compressed/Makefile
#
# create a compressed vmlinux image from the original vmlinux
#

H
Heiko Carstens 已提交
8
KCOV_INSTRUMENT := n
9 10
GCOV_PROFILE := n
UBSAN_SANITIZE := n
H
Heiko Carstens 已提交
11

12
obj-y	:= $(if $(CONFIG_KERNEL_UNCOMPRESSED),,head.o misc.o) piggy.o
13 14
targets	:= vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2
targets += vmlinux.bin.xz vmlinux.bin.lzma vmlinux.bin.lzo vmlinux.bin.lz4
15
targets += vmlinux.scr.lds $(obj-y) $(if $(CONFIG_KERNEL_UNCOMPRESSED),,sizes.h)
16

17 18
KBUILD_AFLAGS := $(KBUILD_AFLAGS_DECOMPRESSOR)
KBUILD_CFLAGS := $(KBUILD_CFLAGS_DECOMPRESSOR)
19

20
OBJECTS := $(addprefix $(obj)/,$(obj-y))
21 22

LDFLAGS_vmlinux := --oformat $(LD_BFD) -e startup -T
23
$(obj)/vmlinux: $(obj)/vmlinux.lds $(objtree)/arch/s390/boot/startup.a $(OBJECTS) FORCE
24 25
	$(call if_changed,ld)

26 27
# extract required uncompressed vmlinux symbols and adjust them to reflect offsets inside vmlinux.bin
sed-sizes := -e 's/^\([0-9a-fA-F]*\) . \(__bss_start\|_end\)$$/\#define SZ\2 (0x\1 - 0x100000)/p'
28 29

quiet_cmd_sizes = GEN     $@
30 31 32 33 34
      cmd_sizes = $(NM) $< | sed -n $(sed-sizes) > $@

$(obj)/sizes.h: vmlinux
	$(call if_changed,sizes)

35
AFLAGS_head.o += -I$(objtree)/$(obj)
36
$(obj)/head.o: $(obj)/sizes.h
37

38
CFLAGS_misc.o += -I$(objtree)/$(obj)
39 40
$(obj)/misc.o: $(obj)/sizes.h

41 42
OBJCOPYFLAGS_vmlinux.bin :=  -R .comment -S
$(obj)/vmlinux.bin: vmlinux
43 44 45 46
	$(call if_changed,objcopy)

vmlinux.bin.all-y := $(obj)/vmlinux.bin

47 48 49 50 51 52
suffix-$(CONFIG_KERNEL_GZIP)  := .gz
suffix-$(CONFIG_KERNEL_BZIP2) := .bz2
suffix-$(CONFIG_KERNEL_LZ4)  := .lz4
suffix-$(CONFIG_KERNEL_LZMA)  := .lzma
suffix-$(CONFIG_KERNEL_LZO)  := .lzo
suffix-$(CONFIG_KERNEL_XZ)  := .xz
53

54
$(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE
55
	$(call if_changed,gzip)
56
$(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE
57
	$(call if_changed,bzip2)
58
$(obj)/vmlinux.bin.lz4: $(vmlinux.bin.all-y) FORCE
59
	$(call if_changed,lz4)
60
$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE
61
	$(call if_changed,lzma)
62
$(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE
63
	$(call if_changed,lzo)
64
$(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) FORCE
65
	$(call if_changed,xzkern)
66 67

LDFLAGS_piggy.o := -r --format binary --oformat $(LD_BFD) -T
68
$(obj)/piggy.o: $(obj)/vmlinux.scr.lds $(obj)/vmlinux.bin$(suffix-y)
69
	$(call if_changed,ld)
70 71 72 73

chkbss := $(filter-out $(obj)/misc.o $(obj)/piggy.o,$(OBJECTS))
chkbss-target := $(obj)/vmlinux.bin
include $(srctree)/arch/s390/scripts/Makefile.chkbss