xref: /linux/arch/sh/boot/compressed/Makefile (revision 50cfa79dcb91a7c40038b7a13b7e2242b541242f)
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 \
9*50cfa79dSPaul 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
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
281eca133cSPaul MundtLIBGCC	:= $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
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
381eca133cSPaul Mundt$(obj)/vmlinux: $(OBJECTS) $(obj)/piggy.o $(LIBGCC) FORCE
391eca133cSPaul Mundt	$(call if_changed,ld)
401eca133cSPaul Mundt	@:
411eca133cSPaul Mundt
421eca133cSPaul Mundt$(obj)/vmlinux.bin: vmlinux FORCE
431eca133cSPaul Mundt	$(call if_changed,objcopy)
441eca133cSPaul Mundt
4507e88e1bSPaul Mundtvmlinux.bin.all-y := $(obj)/vmlinux.bin
4607e88e1bSPaul Mundt
4707e88e1bSPaul Mundt$(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE
481eca133cSPaul Mundt	$(call if_changed,gzip)
4907e88e1bSPaul Mundt$(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE
5007e88e1bSPaul Mundt	$(call if_changed,bzip2)
5107e88e1bSPaul Mundt$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE
5207e88e1bSPaul Mundt	$(call if_changed,lzma)
53*50cfa79dSPaul Mundt$(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) FORCE
54*50cfa79dSPaul Mundt	$(call if_changed,xzkern)
55c7b16efbSPaul Mundt$(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE
56c7b16efbSPaul Mundt	$(call if_changed,lzo)
5707e88e1bSPaul Mundt
581eca133cSPaul MundtOBJCOPYFLAGS += -R .empty_zero_page
591eca133cSPaul Mundt
6007e88e1bSPaul MundtLDFLAGS_piggy.o := -r --format binary --oformat $(ld-bfd) -T
6107e88e1bSPaul Mundt
6207e88e1bSPaul Mundt$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix-y) FORCE
6307e88e1bSPaul Mundt	$(call if_changed,ld)
64