xref: /linux/arch/sh/boot/compressed/Makefile (revision 15d5761ad31dfb194ebe76554e6af0437eb20424)
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
81eca133cSPaul Mundttargets		:= vmlinux vmlinux.bin vmlinux.bin.gz \
907e88e1bSPaul Mundt		   vmlinux.bin.bz2 vmlinux.bin.lzma \
1050cfa79dSPaul Mundt		   vmlinux.bin.xz vmlinux.bin.lzo \
1137744feeSArnd Bergmann		   head_32.o misc.o piggy.o
121eca133cSPaul Mundt
1337744feeSArnd BergmannOBJECTS = $(obj)/head_32.o $(obj)/misc.o $(obj)/cache.o
141eca133cSPaul Mundt
15d4f7e513SChris SmithGCOV_PROFILE := n
16d4f7e513SChris Smith
171eca133cSPaul Mundt#
181eca133cSPaul Mundt# IMAGE_OFFSET is the load offset of the compression loader
191eca133cSPaul Mundt#
209c3d9363SMatt Flemingifeq ($(CONFIG_32BIT),y)
219c3d9363SMatt FlemingIMAGE_OFFSET	:= $(shell /bin/bash -c 'printf "0x%08x" \
229c3d9363SMatt Fleming		     $$[$(CONFIG_MEMORY_START)  + \
239c3d9363SMatt Fleming			$(CONFIG_BOOT_LINK_OFFSET)]')
249c3d9363SMatt Flemingelse
251eca133cSPaul MundtIMAGE_OFFSET	:= $(shell /bin/bash -c 'printf "0x%08x" \
261eca133cSPaul Mundt		     $$[$(CONFIG_PAGE_OFFSET)  + \
271eca133cSPaul Mundt			$(KERNEL_MEMORY) + \
281eca133cSPaul Mundt			$(CONFIG_BOOT_LINK_OFFSET)]')
299c3d9363SMatt Flemingendif
301eca133cSPaul Mundt
31*15d5761aSMasahiro Yamadaccflags-remove-$(CONFIG_MCOUNT) += -pg
321eca133cSPaul Mundt
331eca133cSPaul MundtLDFLAGS_vmlinux := --oformat $(ld-bfd) -Ttext $(IMAGE_OFFSET) -e startup \
341eca133cSPaul Mundt		   -T $(obj)/../../kernel/vmlinux.lds
351eca133cSPaul Mundt
36363e9f05SPaul Mundt#
37363e9f05SPaul Mundt# Pull in the necessary libgcc bits from the in-kernel implementation.
38363e9f05SPaul Mundt#
3937744feeSArnd Bergmannlib1funcs-y	:= ashiftrt.S ashldi3.c ashrsi3.S ashlsi3.S lshrsi3.S
40363e9f05SPaul Mundtlib1funcs-obj   := \
41363e9f05SPaul Mundt	$(addsuffix .o, $(basename $(addprefix $(obj)/, $(lib1funcs-y))))
42363e9f05SPaul Mundt
43363e9f05SPaul Mundtlib1funcs-dir		:= $(srctree)/arch/$(SRCARCH)/lib
44363e9f05SPaul Mundt
452af7967aSYoshinori SatoKBUILD_CFLAGS += -I$(lib1funcs-dir) -DDISABLE_BRANCH_PROFILING
46363e9f05SPaul Mundt
47363e9f05SPaul Mundt$(addprefix $(obj)/,$(lib1funcs-y)): $(obj)/%: $(lib1funcs-dir)/% FORCE
48363e9f05SPaul Mundt	$(call cmd,shipped)
49363e9f05SPaul Mundt
50363e9f05SPaul Mundt$(obj)/vmlinux: $(OBJECTS) $(obj)/piggy.o $(lib1funcs-obj) FORCE
511eca133cSPaul Mundt	$(call if_changed,ld)
521eca133cSPaul Mundt
531eca133cSPaul Mundt$(obj)/vmlinux.bin: vmlinux FORCE
541eca133cSPaul Mundt	$(call if_changed,objcopy)
551eca133cSPaul Mundt
5607e88e1bSPaul Mundtvmlinux.bin.all-y := $(obj)/vmlinux.bin
5707e88e1bSPaul Mundt
5807e88e1bSPaul Mundt$(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE
591eca133cSPaul Mundt	$(call if_changed,gzip)
6007e88e1bSPaul Mundt$(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE
6107e88e1bSPaul Mundt	$(call if_changed,bzip2)
6207e88e1bSPaul Mundt$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE
6307e88e1bSPaul Mundt	$(call if_changed,lzma)
6450cfa79dSPaul Mundt$(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) FORCE
6550cfa79dSPaul Mundt	$(call if_changed,xzkern)
66c7b16efbSPaul Mundt$(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE
67c7b16efbSPaul Mundt	$(call if_changed,lzo)
6807e88e1bSPaul Mundt
691eca133cSPaul MundtOBJCOPYFLAGS += -R .empty_zero_page
701eca133cSPaul Mundt
7107e88e1bSPaul MundtLDFLAGS_piggy.o := -r --format binary --oformat $(ld-bfd) -T
7207e88e1bSPaul Mundt
7307e88e1bSPaul Mundt$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix-y) FORCE
7407e88e1bSPaul Mundt	$(call if_changed,ld)
75