blob: 1e5879c6a7522892e38e95334cf1fc3fc4519af9 [file] [log] [blame]
Thomas Gleixnerec8f24b2019-05-19 13:07:45 +01001# SPDX-License-Identifier: GPL-2.0-only
Helge Deller2f3c7b82017-08-20 10:52:22 +02002#
3# linux/arch/parisc/boot/compressed/Makefile
4#
5# create a compressed self-extracting vmlinux image from the original vmlinux
6#
7
8KCOV_INSTRUMENT := n
9GCOV_PROFILE := n
10UBSAN_SANITIZE := n
11
12targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2
13targets += vmlinux.bin.xz vmlinux.bin.lzma vmlinux.bin.lzo vmlinux.bin.lz4
14targets += misc.o piggy.o sizes.h head.o real2.o firmware.o
James Bottomleyf2c5ed02019-08-01 13:47:03 +020015targets += real2.S firmware.c
Helge Deller2f3c7b82017-08-20 10:52:22 +020016
17KBUILD_CFLAGS := -D__KERNEL__ -O2 -DBOOTLOADER
18KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
Helge Deller34c201ae2018-10-15 22:14:01 +020019KBUILD_CFLAGS += $(cflags-y) -fno-delete-null-pointer-checks -fno-builtin-printf
Helge Deller8c031ba2017-09-22 21:57:11 +020020KBUILD_CFLAGS += -fno-PIE -mno-space-regs -mdisable-fpregs -Os
Helge Deller2f3c7b82017-08-20 10:52:22 +020021ifndef CONFIG_64BIT
22KBUILD_CFLAGS += -mfast-indirect-calls
23endif
24
25OBJECTS += $(obj)/head.o $(obj)/real2.o $(obj)/firmware.o $(obj)/misc.o $(obj)/piggy.o
26
Helge Deller2f3c7b82017-08-20 10:52:22 +020027LDFLAGS_vmlinux := -X -e startup --as-needed -T
28$(obj)/vmlinux: $(obj)/vmlinux.lds $(OBJECTS) $(LIBGCC)
29 $(call if_changed,ld)
30
31sed-sizes := -e 's/^\([0-9a-fA-F]*\) . \(__bss_start\|_end\|parisc_kernel_start\)$$/\#define SZ\2 0x\1/p'
32
33quiet_cmd_sizes = GEN $@
34 cmd_sizes = $(NM) $< | sed -n $(sed-sizes) > $@
35
36$(obj)/sizes.h: vmlinux
37 $(call if_changed,sizes)
38
39AFLAGS_head.o += -I$(objtree)/$(obj) -DBOOTLOADER
40$(obj)/head.o: $(obj)/sizes.h
41
42CFLAGS_misc.o += -I$(objtree)/$(obj)
43$(obj)/misc.o: $(obj)/sizes.h
44
45$(obj)/firmware.o: $(obj)/firmware.c
46$(obj)/firmware.c: $(srctree)/arch/$(SRCARCH)/kernel/firmware.c
47 $(call cmd,shipped)
48
49AFLAGS_real2.o += -DBOOTLOADER
50$(obj)/real2.o: $(obj)/real2.S
51$(obj)/real2.S: $(srctree)/arch/$(SRCARCH)/kernel/real2.S
52 $(call cmd,shipped)
53
54$(obj)/misc.o: $(obj)/sizes.h
55
56CPPFLAGS_vmlinux.lds += -I$(objtree)/$(obj) -DBOOTLOADER
57$(obj)/vmlinux.lds: $(obj)/sizes.h
58
Helge Dellere50beea2019-08-01 13:42:18 +020059OBJCOPYFLAGS_vmlinux.bin := -R .comment -R .note -S
60$(obj)/vmlinux.bin: vmlinux FORCE
Helge Deller2f3c7b82017-08-20 10:52:22 +020061 $(call if_changed,objcopy)
62
63vmlinux.bin.all-y := $(obj)/vmlinux.bin
64
65suffix-$(CONFIG_KERNEL_GZIP) := gz
66suffix-$(CONFIG_KERNEL_BZIP2) := bz2
67suffix-$(CONFIG_KERNEL_LZ4) := lz4
68suffix-$(CONFIG_KERNEL_LZMA) := lzma
69suffix-$(CONFIG_KERNEL_LZO) := lzo
70suffix-$(CONFIG_KERNEL_XZ) := xz
71
72$(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y)
73 $(call if_changed,gzip)
74$(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y)
75 $(call if_changed,bzip2)
76$(obj)/vmlinux.bin.lz4: $(vmlinux.bin.all-y)
77 $(call if_changed,lz4)
78$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y)
79 $(call if_changed,lzma)
80$(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y)
81 $(call if_changed,lzo)
82$(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y)
83 $(call if_changed,xzkern)
84
85LDFLAGS_piggy.o := -r --format binary --oformat $(LD_BFD) -T
86$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix-y)
87 $(call if_changed,ld)