xref: /linux/arch/sh/boot/compressed/Makefile (revision 2af7967a8c1cfe647d6a222be2d2e393025dcd6e)
11eca133cSPaul Mundt#
21eca133cSPaul Mundt# linux/arch/sh/boot/compressed/Makefile
31eca133cSPaul Mundt#
41eca133cSPaul Mundt# create a compressed vmlinux image from the original vmlinux
51eca133cSPaul Mundt#
61eca133cSPaul Mundt
71eca133cSPaul Mundttargets		:= vmlinux vmlinux.bin vmlinux.bin.gz \
807e88e1bSPaul Mundt		   vmlinux.bin.bz2 vmlinux.bin.lzma \
950cfa79dSPaul Mundt		   vmlinux.bin.xz vmlinux.bin.lzo \
1059f00296SPaul Mundt		   head_$(BITS).o misc.o piggy.o
111eca133cSPaul Mundt
1259f00296SPaul MundtOBJECTS = $(obj)/head_$(BITS).o $(obj)/misc.o $(obj)/cache.o
131eca133cSPaul Mundt
14d4f7e513SChris SmithGCOV_PROFILE := n
15d4f7e513SChris Smith
161eca133cSPaul Mundt#
171eca133cSPaul Mundt# IMAGE_OFFSET is the load offset of the compression loader
181eca133cSPaul Mundt#
199c3d9363SMatt Flemingifeq ($(CONFIG_32BIT),y)
209c3d9363SMatt FlemingIMAGE_OFFSET	:= $(shell /bin/bash -c 'printf "0x%08x" \
219c3d9363SMatt Fleming		     $$[$(CONFIG_MEMORY_START)  + \
229c3d9363SMatt Fleming			$(CONFIG_BOOT_LINK_OFFSET)]')
239c3d9363SMatt Flemingelse
241eca133cSPaul MundtIMAGE_OFFSET	:= $(shell /bin/bash -c 'printf "0x%08x" \
251eca133cSPaul Mundt		     $$[$(CONFIG_PAGE_OFFSET)  + \
261eca133cSPaul Mundt			$(KERNEL_MEMORY) + \
271eca133cSPaul Mundt			$(CONFIG_BOOT_LINK_OFFSET)]')
289c3d9363SMatt Flemingendif
291eca133cSPaul Mundt
30473d1cf4SPaul Mundtifeq ($(CONFIG_MCOUNT),y)
311eca133cSPaul MundtORIG_CFLAGS := $(KBUILD_CFLAGS)
321eca133cSPaul MundtKBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS))
331eca133cSPaul Mundtendif
341eca133cSPaul Mundt
351eca133cSPaul MundtLDFLAGS_vmlinux := --oformat $(ld-bfd) -Ttext $(IMAGE_OFFSET) -e startup \
361eca133cSPaul Mundt		   -T $(obj)/../../kernel/vmlinux.lds
371eca133cSPaul Mundt
38363e9f05SPaul Mundt#
39363e9f05SPaul Mundt# Pull in the necessary libgcc bits from the in-kernel implementation.
40363e9f05SPaul Mundt#
41363e9f05SPaul Mundtlib1funcs-$(CONFIG_SUPERH32)	:= ashiftrt.S ashldi3.c ashrsi3.S ashlsi3.S \
42363e9f05SPaul Mundt				   lshrsi3.S
43363e9f05SPaul Mundtlib1funcs-obj			:= \
44363e9f05SPaul Mundt	$(addsuffix .o, $(basename $(addprefix $(obj)/, $(lib1funcs-y))))
45363e9f05SPaul Mundt
46363e9f05SPaul Mundtlib1funcs-dir		:= $(srctree)/arch/$(SRCARCH)/lib
47363e9f05SPaul Mundtifeq ($(BITS),64)
48363e9f05SPaul Mundt	lib1funcs-dir 	:= $(addsuffix $(BITS), $(lib1funcs-dir))
49363e9f05SPaul Mundtendif
50363e9f05SPaul Mundt
51*2af7967aSYoshinori SatoKBUILD_CFLAGS += -I$(lib1funcs-dir) -DDISABLE_BRANCH_PROFILING
52363e9f05SPaul Mundt
53363e9f05SPaul Mundt$(addprefix $(obj)/,$(lib1funcs-y)): $(obj)/%: $(lib1funcs-dir)/% FORCE
54363e9f05SPaul Mundt	$(call cmd,shipped)
55363e9f05SPaul Mundt
56363e9f05SPaul Mundt$(obj)/vmlinux: $(OBJECTS) $(obj)/piggy.o $(lib1funcs-obj) FORCE
571eca133cSPaul Mundt	$(call if_changed,ld)
581eca133cSPaul Mundt	@:
591eca133cSPaul Mundt
601eca133cSPaul Mundt$(obj)/vmlinux.bin: vmlinux FORCE
611eca133cSPaul Mundt	$(call if_changed,objcopy)
621eca133cSPaul Mundt
6307e88e1bSPaul Mundtvmlinux.bin.all-y := $(obj)/vmlinux.bin
6407e88e1bSPaul Mundt
6507e88e1bSPaul Mundt$(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE
661eca133cSPaul Mundt	$(call if_changed,gzip)
6707e88e1bSPaul Mundt$(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE
6807e88e1bSPaul Mundt	$(call if_changed,bzip2)
6907e88e1bSPaul Mundt$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE
7007e88e1bSPaul Mundt	$(call if_changed,lzma)
7150cfa79dSPaul Mundt$(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) FORCE
7250cfa79dSPaul Mundt	$(call if_changed,xzkern)
73c7b16efbSPaul Mundt$(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE
74c7b16efbSPaul Mundt	$(call if_changed,lzo)
7507e88e1bSPaul Mundt
761eca133cSPaul MundtOBJCOPYFLAGS += -R .empty_zero_page
771eca133cSPaul Mundt
7807e88e1bSPaul MundtLDFLAGS_piggy.o := -r --format binary --oformat $(ld-bfd) -T
7907e88e1bSPaul Mundt
8007e88e1bSPaul Mundt$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix-y) FORCE
8107e88e1bSPaul Mundt	$(call if_changed,ld)
82