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 13
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
14
targets += misc.o piggy.o sizes.h head.o
15

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

19 20
OBJECTS := $(addprefix $(objtree)/arch/s390/kernel/, head.o ebcdic.o als.o)
OBJECTS += $(objtree)/drivers/s390/char/sclp_early_core.o
21
OBJECTS += $(obj)/head.o $(obj)/misc.o $(obj)/piggy.o
22 23 24 25 26

LDFLAGS_vmlinux := --oformat $(LD_BFD) -e startup -T
$(obj)/vmlinux: $(obj)/vmlinux.lds $(OBJECTS)
	$(call if_changed,ld)

27
TRIM_HEAD_SIZE := 0x100000
28

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

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

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

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

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

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

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

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

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

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

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

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)