xref: /linux/arch/sh/boot/compressed/Makefile (revision ff9a79307f89563da6d841da8b7cc4a0afceb0e2)
1b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0
21eca133cSPaul Mundt#
31eca133cSPaul Mundt# linux/arch/sh/boot/compressed/Makefile
41eca133cSPaul Mundt#
51eca133cSPaul Mundt# create a compressed vmlinux image from the original vmlinux
61eca133cSPaul Mundt#
71eca133cSPaul Mundt
8*25c7d77dSGeert UytterhoevenOBJECTS := head_32.o misc.o piggy.o \
97fe859eeSMasahiro Yamada           ashiftrt.o ashldi3.o ashrsi3.o ashlsi3.o lshrsi3.o
101eca133cSPaul Mundt
117fe859eeSMasahiro Yamadatargets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 \
127fe859eeSMasahiro Yamada           vmlinux.bin.lzma vmlinux.bin.xz vmlinux.bin.lzo $(OBJECTS)
131eca133cSPaul Mundt
141eca133cSPaul Mundt#
151eca133cSPaul Mundt# IMAGE_OFFSET is the load offset of the compression loader
161eca133cSPaul Mundt#
179c3d9363SMatt Flemingifeq ($(CONFIG_32BIT),y)
189c3d9363SMatt FlemingIMAGE_OFFSET	:= $(shell /bin/bash -c 'printf "0x%08x" \
199c3d9363SMatt Fleming		     $$[$(CONFIG_MEMORY_START)  + \
209c3d9363SMatt Fleming			$(CONFIG_BOOT_LINK_OFFSET)]')
219c3d9363SMatt Flemingelse
221eca133cSPaul MundtIMAGE_OFFSET	:= $(shell /bin/bash -c 'printf "0x%08x" \
231eca133cSPaul Mundt		     $$[$(CONFIG_PAGE_OFFSET)  + \
241eca133cSPaul Mundt			$(KERNEL_MEMORY) + \
251eca133cSPaul Mundt			$(CONFIG_BOOT_LINK_OFFSET)]')
269c3d9363SMatt Flemingendif
271eca133cSPaul Mundt
2815d5761aSMasahiro Yamadaccflags-remove-$(CONFIG_MCOUNT) += -pg
291eca133cSPaul Mundt
301eca133cSPaul MundtLDFLAGS_vmlinux := --oformat $(ld-bfd) -Ttext $(IMAGE_OFFSET) -e startup \
311eca133cSPaul Mundt		   -T $(obj)/../../kernel/vmlinux.lds
321eca133cSPaul Mundt
337fe859eeSMasahiro YamadaKBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
34363e9f05SPaul Mundt
357fe859eeSMasahiro Yamada$(obj)/vmlinux: $(addprefix $(obj)/, $(OBJECTS)) FORCE
361eca133cSPaul Mundt	$(call if_changed,ld)
371eca133cSPaul Mundt
381eca133cSPaul Mundt$(obj)/vmlinux.bin: vmlinux FORCE
391eca133cSPaul Mundt	$(call if_changed,objcopy)
401eca133cSPaul Mundt
4153e7b5dfSMasahiro Yamada$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
421eca133cSPaul Mundt	$(call if_changed,gzip)
4353e7b5dfSMasahiro Yamada$(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE
447ce7e984SMasahiro Yamada	$(call if_changed,bzip2_with_size)
4553e7b5dfSMasahiro Yamada$(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE
467ce7e984SMasahiro Yamada	$(call if_changed,lzma_with_size)
4753e7b5dfSMasahiro Yamada$(obj)/vmlinux.bin.xz: $(obj)/vmlinux.bin FORCE
487ce7e984SMasahiro Yamada	$(call if_changed,xzkern_with_size)
4953e7b5dfSMasahiro Yamada$(obj)/vmlinux.bin.lzo: $(obj)/vmlinux.bin FORCE
507ce7e984SMasahiro Yamada	$(call if_changed,lzo_with_size)
5107e88e1bSPaul Mundt
521eca133cSPaul MundtOBJCOPYFLAGS += -R .empty_zero_page
531eca133cSPaul Mundt
5407e88e1bSPaul MundtLDFLAGS_piggy.o := -r --format binary --oformat $(ld-bfd) -T
5507e88e1bSPaul Mundt
5682977af9SMasahiro Yamada$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix_y) FORCE
5707e88e1bSPaul Mundt	$(call if_changed,ld)
58