blob: 866ecbe670e499632ef59d514dd04a280f46b890 [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
7BITS := $(if $(CONFIG_64BIT),64,31)
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
11targets += misc.o piggy.o sizes.h head$(BITS).o
Martin Schwidefsky1844c9b2010-02-26 22:37:53 +010012
13KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2
Heiko Carstens1a0f2482012-09-14 13:22:48 +020014KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
Martin Schwidefsky1844c9b2010-02-26 22:37:53 +010015KBUILD_CFLAGS += $(cflags-y)
16KBUILD_CFLAGS += $(call cc-option,-mpacked-stack)
17KBUILD_CFLAGS += $(call cc-option,-ffreestanding)
18
19GCOV_PROFILE := n
20
21OBJECTS := $(addprefix $(objtree)/arch/s390/kernel/, head.o sclp.o ebcdic.o)
22OBJECTS += $(obj)/head$(BITS).o $(obj)/misc.o $(obj)/piggy.o
23
24LDFLAGS_vmlinux := --oformat $(LD_BFD) -e startup -T
25$(obj)/vmlinux: $(obj)/vmlinux.lds $(OBJECTS)
26 $(call if_changed,ld)
27 @:
28
29sed-sizes := -e 's/^\([0-9a-fA-F]*\) . \(__bss_start\|_end\)$$/\#define SZ\2 0x\1/p'
30
31quiet_cmd_sizes = GEN $@
32 cmd_sizes = $(NM) $< | sed -n $(sed-sizes) > $@
33
34$(obj)/sizes.h: vmlinux
35 $(call if_changed,sizes)
36
37AFLAGS_head$(BITS).o += -I$(obj)
38$(obj)/head$(BITS).o: $(obj)/sizes.h
39
40CFLAGS_misc.o += -I$(obj)
41$(obj)/misc.o: $(obj)/sizes.h
42
43OBJCOPYFLAGS_vmlinux.bin := -R .comment -S
44$(obj)/vmlinux.bin: vmlinux
45 $(call if_changed,objcopy)
46
47vmlinux.bin.all-y := $(obj)/vmlinux.bin
48
49suffix-$(CONFIG_KERNEL_GZIP) := gz
50suffix-$(CONFIG_KERNEL_BZIP2) := bz2
Heiko Carstens8e2872c2013-07-18 15:18:24 +020051suffix-$(CONFIG_KERNEL_LZ4) := lz4
Martin Schwidefsky1844c9b2010-02-26 22:37:53 +010052suffix-$(CONFIG_KERNEL_LZMA) := lzma
Heiko Carstenscdf56642010-05-26 23:27:12 +020053suffix-$(CONFIG_KERNEL_LZO) := lzo
Heiko Carstensd7b081a2011-03-15 17:08:32 +010054suffix-$(CONFIG_KERNEL_XZ) := xz
Martin Schwidefsky1844c9b2010-02-26 22:37:53 +010055
56$(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y)
57 $(call if_changed,gzip)
58$(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y)
59 $(call if_changed,bzip2)
Heiko Carstens8e2872c2013-07-18 15:18:24 +020060$(obj)/vmlinux.bin.lz4: $(vmlinux.bin.all-y)
61 $(call if_changed,lz4)
Martin Schwidefsky1844c9b2010-02-26 22:37:53 +010062$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y)
63 $(call if_changed,lzma)
Heiko Carstenscdf56642010-05-26 23:27:12 +020064$(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y)
65 $(call if_changed,lzo)
Heiko Carstensd7b081a2011-03-15 17:08:32 +010066$(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y)
67 $(call if_changed,xzkern)
Martin Schwidefsky1844c9b2010-02-26 22:37:53 +010068
69LDFLAGS_piggy.o := -r --format binary --oformat $(LD_BFD) -T
70$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix-y)
71 $(call if_changed,ld)