xref: /openbmc/linux/arch/sh/boot/compressed/Makefile (revision 25985edc)
1#
2# linux/arch/sh/boot/compressed/Makefile
3#
4# create a compressed vmlinux image from the original vmlinux
5#
6
7targets		:= vmlinux vmlinux.bin vmlinux.bin.gz \
8		   vmlinux.bin.bz2 vmlinux.bin.lzma \
9		   vmlinux.bin.xz vmlinux.bin.lzo \
10		   head_$(BITS).o misc.o piggy.o
11
12OBJECTS = $(obj)/head_$(BITS).o $(obj)/misc.o $(obj)/cache.o
13
14GCOV_PROFILE := n
15
16#
17# IMAGE_OFFSET is the load offset of the compression loader
18#
19ifeq ($(CONFIG_32BIT),y)
20IMAGE_OFFSET	:= $(shell /bin/bash -c 'printf "0x%08x" \
21		     $$[$(CONFIG_MEMORY_START)  + \
22			$(CONFIG_BOOT_LINK_OFFSET)]')
23else
24IMAGE_OFFSET	:= $(shell /bin/bash -c 'printf "0x%08x" \
25		     $$[$(CONFIG_PAGE_OFFSET)  + \
26			$(KERNEL_MEMORY) + \
27			$(CONFIG_BOOT_LINK_OFFSET)]')
28endif
29
30LIBGCC	:= $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
31
32ifeq ($(CONFIG_MCOUNT),y)
33ORIG_CFLAGS := $(KBUILD_CFLAGS)
34KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS))
35endif
36
37LDFLAGS_vmlinux := --oformat $(ld-bfd) -Ttext $(IMAGE_OFFSET) -e startup \
38		   -T $(obj)/../../kernel/vmlinux.lds
39
40$(obj)/vmlinux: $(OBJECTS) $(obj)/piggy.o $(LIBGCC) FORCE
41	$(call if_changed,ld)
42	@:
43
44$(obj)/vmlinux.bin: vmlinux FORCE
45	$(call if_changed,objcopy)
46
47vmlinux.bin.all-y := $(obj)/vmlinux.bin
48
49$(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE
50	$(call if_changed,gzip)
51$(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE
52	$(call if_changed,bzip2)
53$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE
54	$(call if_changed,lzma)
55$(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) FORCE
56	$(call if_changed,xzkern)
57$(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE
58	$(call if_changed,lzo)
59
60OBJCOPYFLAGS += -R .empty_zero_page
61
62LDFLAGS_piggy.o := -r --format binary --oformat $(ld-bfd) -T
63
64$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix-y) FORCE
65	$(call if_changed,ld)
66