1ec8f24b7SThomas Gleixner# SPDX-License-Identifier: GPL-2.0-only
22f3c7b81SHelge Deller#
32f3c7b81SHelge Deller# linux/arch/parisc/boot/compressed/Makefile
42f3c7b81SHelge Deller#
52f3c7b81SHelge Deller# create a compressed self-extracting vmlinux image from the original vmlinux
62f3c7b81SHelge Deller#
72f3c7b81SHelge Deller
86f21e734SMasahiro YamadaOBJECTS := head.o real2.o firmware.o misc.o piggy.o
92f3c7b81SHelge Dellertargets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2
102f3c7b81SHelge Dellertargets += vmlinux.bin.xz vmlinux.bin.lzma vmlinux.bin.lzo vmlinux.bin.lz4
116f21e734SMasahiro Yamadatargets += $(OBJECTS) sizes.h
122f3c7b81SHelge Deller
132f3c7b81SHelge DellerKBUILD_CFLAGS := -D__KERNEL__ -O2 -DBOOTLOADER
142f3c7b81SHelge DellerKBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
153fd84a4fSArnd BergmannKBUILD_CFLAGS += -fno-strict-aliasing
1634c201aeSHelge DellerKBUILD_CFLAGS += $(cflags-y) -fno-delete-null-pointer-checks -fno-builtin-printf
178c031ba6SHelge DellerKBUILD_CFLAGS += -fno-PIE -mno-space-regs -mdisable-fpregs -Os
182f3c7b81SHelge Dellerifndef CONFIG_64BIT
192f3c7b81SHelge DellerKBUILD_CFLAGS += -mfast-indirect-calls
202f3c7b81SHelge Dellerendif
212f3c7b81SHelge Deller
222f3c7b81SHelge DellerLDFLAGS_vmlinux := -X -e startup --as-needed -T
236f21e734SMasahiro Yamada$(obj)/vmlinux: $(obj)/vmlinux.lds $(addprefix $(obj)/, $(OBJECTS)) $(LIBGCC) FORCE
242f3c7b81SHelge Deller	$(call if_changed,ld)
252f3c7b81SHelge Deller
262f3c7b81SHelge Dellersed-sizes := -e 's/^\([0-9a-fA-F]*\) . \(__bss_start\|_end\|parisc_kernel_start\)$$/\#define SZ\2 0x\1/p'
272f3c7b81SHelge Deller
282f3c7b81SHelge Dellerquiet_cmd_sizes = GEN $@
292f3c7b81SHelge Deller      cmd_sizes = $(NM) $< | sed -n $(sed-sizes) > $@
302f3c7b81SHelge Deller
313da6379aSHelge Deller$(obj)/sizes.h: vmlinux FORCE
322f3c7b81SHelge Deller	$(call if_changed,sizes)
332f3c7b81SHelge Deller
342f3c7b81SHelge DellerAFLAGS_head.o += -I$(objtree)/$(obj) -DBOOTLOADER
352f3c7b81SHelge Deller$(obj)/head.o: $(obj)/sizes.h
362f3c7b81SHelge Deller
372f3c7b81SHelge DellerCFLAGS_misc.o += -I$(objtree)/$(obj)
382f3c7b81SHelge Deller$(obj)/misc.o: $(obj)/sizes.h
392f3c7b81SHelge Deller
402f3c7b81SHelge DellerAFLAGS_real2.o += -DBOOTLOADER
412f3c7b81SHelge Deller
422f3c7b81SHelge DellerCPPFLAGS_vmlinux.lds += -I$(objtree)/$(obj) -DBOOTLOADER
432f3c7b81SHelge Deller$(obj)/vmlinux.lds: $(obj)/sizes.h
442f3c7b81SHelge Deller
45e50beea8SHelge DellerOBJCOPYFLAGS_vmlinux.bin := -R .comment -R .note -S
46e50beea8SHelge Deller$(obj)/vmlinux.bin: vmlinux FORCE
472f3c7b81SHelge Deller	$(call if_changed,objcopy)
482f3c7b81SHelge Deller
492f3c7b81SHelge Dellersuffix-$(CONFIG_KERNEL_GZIP)  := gz
502f3c7b81SHelge Dellersuffix-$(CONFIG_KERNEL_BZIP2) := bz2
512f3c7b81SHelge Dellersuffix-$(CONFIG_KERNEL_LZ4)  := lz4
522f3c7b81SHelge Dellersuffix-$(CONFIG_KERNEL_LZMA)  := lzma
532f3c7b81SHelge Dellersuffix-$(CONFIG_KERNEL_LZO)  := lzo
542f3c7b81SHelge Dellersuffix-$(CONFIG_KERNEL_XZ)  := xz
552f3c7b81SHelge Deller
56*53e7b5dfSMasahiro Yamada$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
572f3c7b81SHelge Deller	$(call if_changed,gzip)
58*53e7b5dfSMasahiro Yamada$(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE
597ce7e984SMasahiro Yamada	$(call if_changed,bzip2_with_size)
60*53e7b5dfSMasahiro Yamada$(obj)/vmlinux.bin.lz4: $(obj)/vmlinux.bin FORCE
617ce7e984SMasahiro Yamada	$(call if_changed,lz4_with_size)
62*53e7b5dfSMasahiro Yamada$(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE
637ce7e984SMasahiro Yamada	$(call if_changed,lzma_with_size)
64*53e7b5dfSMasahiro Yamada$(obj)/vmlinux.bin.lzo: $(obj)/vmlinux.bin FORCE
657ce7e984SMasahiro Yamada	$(call if_changed,lzo_with_size)
66*53e7b5dfSMasahiro Yamada$(obj)/vmlinux.bin.xz: $(obj)/vmlinux.bin FORCE
677ce7e984SMasahiro Yamada	$(call if_changed,xzkern_with_size)
682f3c7b81SHelge Deller
692f3c7b81SHelge DellerLDFLAGS_piggy.o := -r --format binary --oformat $(LD_BFD) -T
703da6379aSHelge Deller$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix-y) FORCE
712f3c7b81SHelge Deller	$(call if_changed,ld)
72