1#
2# linux/arch/parisc/boot/compressed/Makefile
3#
4# create a compressed self-extracting vmlinux image from the original vmlinux
5#
6
7KCOV_INSTRUMENT := n
8GCOV_PROFILE := n
9UBSAN_SANITIZE := n
10
11targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2
12targets += vmlinux.bin.xz vmlinux.bin.lzma vmlinux.bin.lzo vmlinux.bin.lz4
13targets += misc.o piggy.o sizes.h head.o real2.o firmware.o
14
15KBUILD_CFLAGS := -D__KERNEL__ -O2 -DBOOTLOADER
16KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
17KBUILD_CFLAGS += $(cflags-y) -fno-delete-null-pointer-checks -fno-builtin-printf
18KBUILD_CFLAGS += -fno-PIE -mno-space-regs -mdisable-fpregs -Os
19ifndef CONFIG_64BIT
20KBUILD_CFLAGS += -mfast-indirect-calls
21endif
22
23OBJECTS += $(obj)/head.o $(obj)/real2.o $(obj)/firmware.o $(obj)/misc.o $(obj)/piggy.o
24
25LDFLAGS_vmlinux := -X -e startup --as-needed -T
26$(obj)/vmlinux: $(obj)/vmlinux.lds $(OBJECTS) $(LIBGCC)
27	$(call if_changed,ld)
28
29sed-sizes := -e 's/^\([0-9a-fA-F]*\) . \(__bss_start\|_end\|parisc_kernel_start\)$$/\#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.o += -I$(objtree)/$(obj) -DBOOTLOADER
38$(obj)/head.o: $(obj)/sizes.h
39
40CFLAGS_misc.o += -I$(objtree)/$(obj)
41$(obj)/misc.o: $(obj)/sizes.h
42
43$(obj)/firmware.o: $(obj)/firmware.c
44$(obj)/firmware.c: $(srctree)/arch/$(SRCARCH)/kernel/firmware.c
45	$(call cmd,shipped)
46
47AFLAGS_real2.o += -DBOOTLOADER
48$(obj)/real2.o: $(obj)/real2.S
49$(obj)/real2.S: $(srctree)/arch/$(SRCARCH)/kernel/real2.S
50	$(call cmd,shipped)
51
52$(obj)/misc.o: $(obj)/sizes.h
53
54CPPFLAGS_vmlinux.lds += -I$(objtree)/$(obj) -DBOOTLOADER
55$(obj)/vmlinux.lds: $(obj)/sizes.h
56
57$(obj)/vmlinux.bin: vmlinux
58	$(call if_changed,objcopy)
59
60vmlinux.bin.all-y := $(obj)/vmlinux.bin
61
62suffix-$(CONFIG_KERNEL_GZIP)  := gz
63suffix-$(CONFIG_KERNEL_BZIP2) := bz2
64suffix-$(CONFIG_KERNEL_LZ4)  := lz4
65suffix-$(CONFIG_KERNEL_LZMA)  := lzma
66suffix-$(CONFIG_KERNEL_LZO)  := lzo
67suffix-$(CONFIG_KERNEL_XZ)  := xz
68
69$(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y)
70	$(call if_changed,gzip)
71$(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y)
72	$(call if_changed,bzip2)
73$(obj)/vmlinux.bin.lz4: $(vmlinux.bin.all-y)
74	$(call if_changed,lz4)
75$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y)
76	$(call if_changed,lzma)
77$(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y)
78	$(call if_changed,lzo)
79$(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y)
80	$(call if_changed,xzkern)
81
82LDFLAGS_piggy.o := -r --format binary --oformat $(LD_BFD) -T
83$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix-y)
84	$(call if_changed,ld)
85