Linux 6.9-rc1
[linux-2.6-microblaze.git] / arch / parisc / boot / compressed / Makefile
1 # SPDX-License-Identifier: GPL-2.0-only
2 #
3 # linux/arch/parisc/boot/compressed/Makefile
4 #
5 # create a compressed self-extracting vmlinux image from the original vmlinux
6 #
7
8 KCOV_INSTRUMENT := n
9 GCOV_PROFILE := n
10 UBSAN_SANITIZE := n
11
12 OBJECTS := head.o real2.o firmware.o misc.o piggy.o
13 targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2
14 targets += vmlinux.bin.xz vmlinux.bin.lzma vmlinux.bin.lzo vmlinux.bin.lz4
15 targets += $(OBJECTS) sizes.h
16
17 KBUILD_CFLAGS := -D__KERNEL__ -O2 -DBOOTLOADER
18 KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
19 KBUILD_CFLAGS += -fno-strict-aliasing
20 KBUILD_CFLAGS += $(cflags-y) -fno-delete-null-pointer-checks -fno-builtin-printf
21 KBUILD_CFLAGS += -fno-PIE -mno-space-regs -mdisable-fpregs -Os
22 ifndef CONFIG_64BIT
23 KBUILD_CFLAGS += -mfast-indirect-calls
24 endif
25
26 LDFLAGS_vmlinux := -X -e startup --as-needed -T
27 $(obj)/vmlinux: $(obj)/vmlinux.lds $(addprefix $(obj)/, $(OBJECTS)) $(LIBGCC) FORCE
28         $(call if_changed,ld)
29
30 sed-sizes := -e 's/^\([0-9a-fA-F]*\) . \(__bss_start\|_end\|parisc_kernel_start\)$$/\#define SZ\2 0x\1/p'
31
32 quiet_cmd_sizes = GEN $@
33       cmd_sizes = $(NM) $< | sed -n $(sed-sizes) > $@
34
35 $(obj)/sizes.h: vmlinux FORCE
36         $(call if_changed,sizes)
37
38 AFLAGS_head.o += -I$(objtree)/$(obj) -DBOOTLOADER
39 $(obj)/head.o: $(obj)/sizes.h
40
41 CFLAGS_misc.o += -I$(objtree)/$(obj)
42 $(obj)/misc.o: $(obj)/sizes.h
43
44 AFLAGS_real2.o += -DBOOTLOADER
45
46 CPPFLAGS_vmlinux.lds += -I$(objtree)/$(obj) -DBOOTLOADER
47 $(obj)/vmlinux.lds: $(obj)/sizes.h
48
49 OBJCOPYFLAGS_vmlinux.bin := -R .comment -R .note -S
50 $(obj)/vmlinux.bin: vmlinux FORCE
51         $(call if_changed,objcopy)
52
53 suffix-$(CONFIG_KERNEL_GZIP)  := gz
54 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 $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
61         $(call if_changed,gzip)
62 $(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE
63         $(call if_changed,bzip2_with_size)
64 $(obj)/vmlinux.bin.lz4: $(obj)/vmlinux.bin FORCE
65         $(call if_changed,lz4_with_size)
66 $(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE
67         $(call if_changed,lzma_with_size)
68 $(obj)/vmlinux.bin.lzo: $(obj)/vmlinux.bin FORCE
69         $(call if_changed,lzo_with_size)
70 $(obj)/vmlinux.bin.xz: $(obj)/vmlinux.bin FORCE
71         $(call if_changed,xzkern_with_size)
72
73 LDFLAGS_piggy.o := -r --format binary --oformat $(LD_BFD) -T
74 $(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix-y) FORCE
75         $(call if_changed,ld)