xref: /linux/arch/parisc/boot/compressed/Makefile (revision f563ba4ac68a4dfdfb37baa24ff1a4f917e9ffe7)
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
21*7cbb015eSArnd BergmannKBUILD_CFLAGS += -std=gnu11
222f3c7b81SHelge Deller
232f3c7b81SHelge DellerLDFLAGS_vmlinux := -X -e startup --as-needed -T
246f21e734SMasahiro Yamada$(obj)/vmlinux: $(obj)/vmlinux.lds $(addprefix $(obj)/, $(OBJECTS)) $(LIBGCC) FORCE
252f3c7b81SHelge Deller	$(call if_changed,ld)
262f3c7b81SHelge Deller
272f3c7b81SHelge Dellersed-sizes := -e 's/^\([0-9a-fA-F]*\) . \(__bss_start\|_end\|parisc_kernel_start\)$$/\#define SZ\2 0x\1/p'
282f3c7b81SHelge Deller
292f3c7b81SHelge Dellerquiet_cmd_sizes = GEN $@
302f3c7b81SHelge Deller      cmd_sizes = $(NM) $< | sed -n $(sed-sizes) > $@
312f3c7b81SHelge Deller
323da6379aSHelge Deller$(obj)/sizes.h: vmlinux FORCE
332f3c7b81SHelge Deller	$(call if_changed,sizes)
342f3c7b81SHelge Deller
352f3c7b81SHelge DellerAFLAGS_head.o += -I$(objtree)/$(obj) -DBOOTLOADER
362f3c7b81SHelge Deller$(obj)/head.o: $(obj)/sizes.h
372f3c7b81SHelge Deller
382f3c7b81SHelge DellerCFLAGS_misc.o += -I$(objtree)/$(obj)
392f3c7b81SHelge Deller$(obj)/misc.o: $(obj)/sizes.h
402f3c7b81SHelge Deller
412f3c7b81SHelge DellerAFLAGS_real2.o += -DBOOTLOADER
422f3c7b81SHelge Deller
432f3c7b81SHelge DellerCPPFLAGS_vmlinux.lds += -I$(objtree)/$(obj) -DBOOTLOADER
442f3c7b81SHelge Deller$(obj)/vmlinux.lds: $(obj)/sizes.h
452f3c7b81SHelge Deller
46e50beea8SHelge DellerOBJCOPYFLAGS_vmlinux.bin := -R .comment -R .note -S
47e50beea8SHelge Deller$(obj)/vmlinux.bin: vmlinux FORCE
482f3c7b81SHelge Deller	$(call if_changed,objcopy)
492f3c7b81SHelge Deller
502f3c7b81SHelge Dellersuffix-$(CONFIG_KERNEL_GZIP)  := gz
512f3c7b81SHelge Dellersuffix-$(CONFIG_KERNEL_BZIP2) := bz2
522f3c7b81SHelge Dellersuffix-$(CONFIG_KERNEL_LZ4)  := lz4
532f3c7b81SHelge Dellersuffix-$(CONFIG_KERNEL_LZMA)  := lzma
542f3c7b81SHelge Dellersuffix-$(CONFIG_KERNEL_LZO)  := lzo
552f3c7b81SHelge Dellersuffix-$(CONFIG_KERNEL_XZ)  := xz
562f3c7b81SHelge Deller
5753e7b5dfSMasahiro Yamada$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
582f3c7b81SHelge Deller	$(call if_changed,gzip)
5953e7b5dfSMasahiro Yamada$(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE
607ce7e984SMasahiro Yamada	$(call if_changed,bzip2_with_size)
6153e7b5dfSMasahiro Yamada$(obj)/vmlinux.bin.lz4: $(obj)/vmlinux.bin FORCE
627ce7e984SMasahiro Yamada	$(call if_changed,lz4_with_size)
6353e7b5dfSMasahiro Yamada$(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE
647ce7e984SMasahiro Yamada	$(call if_changed,lzma_with_size)
6553e7b5dfSMasahiro Yamada$(obj)/vmlinux.bin.lzo: $(obj)/vmlinux.bin FORCE
667ce7e984SMasahiro Yamada	$(call if_changed,lzo_with_size)
6753e7b5dfSMasahiro Yamada$(obj)/vmlinux.bin.xz: $(obj)/vmlinux.bin FORCE
687ce7e984SMasahiro Yamada	$(call if_changed,xzkern_with_size)
692f3c7b81SHelge Deller
702f3c7b81SHelge DellerLDFLAGS_piggy.o := -r --format binary --oformat $(LD_BFD) -T
713da6379aSHelge Deller$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix-y) FORCE
722f3c7b81SHelge Deller	$(call if_changed,ld)
73