blob: 13723c39e58e72ab0bf5900bedf5f78b8272c46a [file] [log] [blame]
Martin Schwidefsky1844c9b2010-02-26 22:37:53 +01001#
2# linux/arch/s390/boot/compressed/Makefile
3#
4# create a compressed vmlinux image from the original vmlinux
5#
6
Heiko Carstens907fa062016-06-20 14:08:32 +02007KCOV_INSTRUMENT := n
8
Heiko Carstens8e2872c2013-07-18 15:18:24 +02009targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2
10targets += vmlinux.bin.xz vmlinux.bin.lzma vmlinux.bin.lzo vmlinux.bin.lz4
Heiko Carstens4bfc86c2015-02-13 13:04:39 +010011targets += misc.o piggy.o sizes.h head.o
Martin Schwidefsky1844c9b2010-02-26 22:37:53 +010012
Heiko Carstens5a798592015-02-12 13:08:27 +010013KBUILD_CFLAGS := -m64 -D__KERNEL__ $(LINUX_INCLUDE) -O2
Heiko Carstens1a0f2482012-09-14 13:22:48 +020014KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
Christian Borntraegeradc0b7f2015-09-28 22:47:42 +020015KBUILD_CFLAGS += $(cflags-y) -fno-delete-null-pointer-checks -msoft-float
Martin Schwidefsky1844c9b2010-02-26 22:37:53 +010016KBUILD_CFLAGS += $(call cc-option,-mpacked-stack)
17KBUILD_CFLAGS += $(call cc-option,-ffreestanding)
18
19GCOV_PROFILE := n
20
Heiko Carstensbe2412c2016-06-27 15:52:38 +020021OBJECTS := $(addprefix $(objtree)/arch/s390/kernel/, head.o sclp.o ebcdic.o als.o)
Heiko Carstens4bfc86c2015-02-13 13:04:39 +010022OBJECTS += $(obj)/head.o $(obj)/misc.o $(obj)/piggy.o
Martin Schwidefsky1844c9b2010-02-26 22:37:53 +010023
24LDFLAGS_vmlinux := --oformat $(LD_BFD) -e startup -T
25$(obj)/vmlinux: $(obj)/vmlinux.lds $(OBJECTS)
26 $(call if_changed,ld)
Martin Schwidefsky1844c9b2010-02-26 22:37:53 +010027
28sed-sizes := -e 's/^\([0-9a-fA-F]*\) . \(__bss_start\|_end\)$$/\#define SZ\2 0x\1/p'
29
30quiet_cmd_sizes = GEN $@
31 cmd_sizes = $(NM) $< | sed -n $(sed-sizes) > $@
32
33$(obj)/sizes.h: vmlinux
34 $(call if_changed,sizes)
35
Heiko Carstens4bfc86c2015-02-13 13:04:39 +010036AFLAGS_head.o += -I$(obj)
37$(obj)/head.o: $(obj)/sizes.h
Martin Schwidefsky1844c9b2010-02-26 22:37:53 +010038
39CFLAGS_misc.o += -I$(obj)
40$(obj)/misc.o: $(obj)/sizes.h
41
42OBJCOPYFLAGS_vmlinux.bin := -R .comment -S
43$(obj)/vmlinux.bin: vmlinux
44 $(call if_changed,objcopy)
45
46vmlinux.bin.all-y := $(obj)/vmlinux.bin
47
48suffix-$(CONFIG_KERNEL_GZIP) := gz
49suffix-$(CONFIG_KERNEL_BZIP2) := bz2
Heiko Carstens8e2872c2013-07-18 15:18:24 +020050suffix-$(CONFIG_KERNEL_LZ4) := lz4
Martin Schwidefsky1844c9b2010-02-26 22:37:53 +010051suffix-$(CONFIG_KERNEL_LZMA) := lzma
Heiko Carstenscdf56642010-05-26 23:27:12 +020052suffix-$(CONFIG_KERNEL_LZO) := lzo
Heiko Carstensd7b081a2011-03-15 17:08:32 +010053suffix-$(CONFIG_KERNEL_XZ) := xz
Martin Schwidefsky1844c9b2010-02-26 22:37:53 +010054
55$(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y)
56 $(call if_changed,gzip)
57$(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y)
58 $(call if_changed,bzip2)
Heiko Carstens8e2872c2013-07-18 15:18:24 +020059$(obj)/vmlinux.bin.lz4: $(vmlinux.bin.all-y)
60 $(call if_changed,lz4)
Martin Schwidefsky1844c9b2010-02-26 22:37:53 +010061$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y)
62 $(call if_changed,lzma)
Heiko Carstenscdf56642010-05-26 23:27:12 +020063$(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y)
64 $(call if_changed,lzo)
Heiko Carstensd7b081a2011-03-15 17:08:32 +010065$(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y)
66 $(call if_changed,xzkern)
Martin Schwidefsky1844c9b2010-02-26 22:37:53 +010067
68LDFLAGS_piggy.o := -r --format binary --oformat $(LD_BFD) -T
69$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix-y)
70 $(call if_changed,ld)