Makefile 2.2 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
OBJECTS := $(obj)/head.o $(obj)/misc.o $(obj)/piggy.o
20 21

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

25
TRIM_HEAD_SIZE := 0x100000
26

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

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

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

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

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

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

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

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

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

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

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

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)