Makefile 2.3 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	:= 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 += sizes.h $(obj-y)
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)
24 25
	$(call if_changed,ld)

26
TRIM_HEAD_SIZE := 0x100000
27

28 29 30
sed-sizes := -e 's/^\([0-9a-fA-F]*\) . \(__bss_start\|_end\)$$/\#define SZ\2 (0x\1 - $(TRIM_HEAD_SIZE))/p'

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

33 34 35
quiet_cmd_trim_head = TRIM    $@
      cmd_trim_head = tail -c +$$(($(TRIM_HEAD_SIZE) + 1)) $< > $@

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

39
AFLAGS_head.o += -I$(objtree)/$(obj)
40
$(obj)/head.o: $(obj)/sizes.h
41

42
CFLAGS_misc.o += -I$(objtree)/$(obj)
43 44
$(obj)/misc.o: $(obj)/sizes.h

45 46
OBJCOPYFLAGS_vmlinux.bin.full :=  -R .comment -S
$(obj)/vmlinux.bin.full: vmlinux
47 48
	$(call if_changed,objcopy)

49 50 51
$(obj)/vmlinux.bin: $(obj)/vmlinux.bin.full
	$(call if_changed,trim_head)

52 53 54 55
vmlinux.bin.all-y := $(obj)/vmlinux.bin

suffix-$(CONFIG_KERNEL_GZIP)  := gz
suffix-$(CONFIG_KERNEL_BZIP2) := bz2
56
suffix-$(CONFIG_KERNEL_LZ4)  := lz4
57
suffix-$(CONFIG_KERNEL_LZMA)  := lzma
58
suffix-$(CONFIG_KERNEL_LZO)  := lzo
59
suffix-$(CONFIG_KERNEL_XZ)  := xz
60 61 62 63 64

$(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y)
	$(call if_changed,gzip)
$(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y)
	$(call if_changed,bzip2)
65 66
$(obj)/vmlinux.bin.lz4: $(vmlinux.bin.all-y)
	$(call if_changed,lz4)
67 68
$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y)
	$(call if_changed,lzma)
69 70
$(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y)
	$(call if_changed,lzo)
71 72
$(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y)
	$(call if_changed,xzkern)
73 74 75 76

LDFLAGS_piggy.o := -r --format binary --oformat $(LD_BFD) -T
$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix-y)
	$(call if_changed,ld)
77 78 79 80

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