aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/boot/compressed/Makefile
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2010-08-09 09:09:29 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-08-09 09:09:29 -0400
commit054d5c9238f3c577ad51195c3ee7803613f322cc (patch)
treeff7d9f5c0e0ddf14230ba28f28ef69a2c0a0debf /arch/mips/boot/compressed/Makefile
parent11e4afb49b7fa1fc8e1ffd850c1806dd86a08204 (diff)
parent2192482ee5ce5d5d4a6cec0c351b2d3a744606eb (diff)
Merge branch 'devel-stable' into devel
Diffstat (limited to 'arch/mips/boot/compressed/Makefile')
-rw-r--r--arch/mips/boot/compressed/Makefile81
1 files changed, 42 insertions, 39 deletions
diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
index 790ddd397620..ed9bb709c9a3 100644
--- a/arch/mips/boot/compressed/Makefile
+++ b/arch/mips/boot/compressed/Makefile
@@ -12,14 +12,6 @@
12# Author: Wu Zhangjin <wuzhangjin@gmail.com> 12# Author: Wu Zhangjin <wuzhangjin@gmail.com>
13# 13#
14 14
15# compressed kernel load addr: VMLINUZ_LOAD_ADDRESS > VMLINUX_LOAD_ADDRESS + VMLINUX_SIZE
16VMLINUX_SIZE := $(shell wc -c $(objtree)/$(KBUILD_IMAGE) 2>/dev/null | cut -d' ' -f1)
17VMLINUX_SIZE := $(shell [ -n "$(VMLINUX_SIZE)" ] && echo -n $$(($(VMLINUX_SIZE) + (65536 - $(VMLINUX_SIZE) % 65536))))
18# VMLINUZ_LOAD_ADDRESS = concat "high32 of VMLINUX_LOAD_ADDRESS" and "(low32 of VMLINUX_LOAD_ADDRESS) + VMLINUX_SIZE"
19HIGH32 := $(shell A=$(VMLINUX_LOAD_ADDRESS); [ $${\#A} -gt 10 ] && expr substr "$(VMLINUX_LOAD_ADDRESS)" 3 $$(($${\#A} - 10)))
20LOW32 := $(shell [ -n "$(HIGH32)" ] && A=11 || A=3; expr substr "$(VMLINUX_LOAD_ADDRESS)" $${A} 8)
21VMLINUZ_LOAD_ADDRESS := 0x$(shell [ -n "$(VMLINUX_SIZE)" -a -n "$(LOW32)" ] && printf "$(HIGH32)%08x" $$(($(VMLINUX_SIZE) + 0x$(LOW32))))
22
23# set the default size of the mallocing area for decompressing 15# set the default size of the mallocing area for decompressing
24BOOT_HEAP_SIZE := 0x400000 16BOOT_HEAP_SIZE := 0x400000
25 17
@@ -33,49 +25,61 @@ KBUILD_AFLAGS := $(LINUXINCLUDE) $(KBUILD_AFLAGS) -D__ASSEMBLY__ \
33 -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) \ 25 -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) \
34 -DKERNEL_ENTRY=0x$(shell $(NM) $(objtree)/$(KBUILD_IMAGE) 2>/dev/null | grep " kernel_entry" | cut -f1 -d \ ) 26 -DKERNEL_ENTRY=0x$(shell $(NM) $(objtree)/$(KBUILD_IMAGE) 2>/dev/null | grep " kernel_entry" | cut -f1 -d \ )
35 27
36obj-y := $(obj)/head.o $(obj)/decompress.o $(obj)/dbg.o 28targets := head.o decompress.o dbg.o uart-16550.o uart-alchemy.o
29
30# decompressor objects (linked with vmlinuz)
31vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/dbg.o
37 32
38ifdef CONFIG_DEBUG_ZBOOT 33ifdef CONFIG_DEBUG_ZBOOT
39obj-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o 34vmlinuzobjs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o
40obj-$(CONFIG_MACH_ALCHEMY) += $(obj)/uart-alchemy.o 35vmlinuzobjs-$(CONFIG_MIPS_ALCHEMY) += $(obj)/uart-alchemy.o
41endif 36endif
42 37
38targets += vmlinux.bin
43OBJCOPYFLAGS_vmlinux.bin := $(OBJCOPYFLAGS) -O binary -R .comment -S 39OBJCOPYFLAGS_vmlinux.bin := $(OBJCOPYFLAGS) -O binary -R .comment -S
44$(obj)/vmlinux.bin: $(KBUILD_IMAGE) 40$(obj)/vmlinux.bin: $(KBUILD_IMAGE) FORCE
45 $(call if_changed,objcopy) 41 $(call if_changed,objcopy)
46 42
47suffix_$(CONFIG_KERNEL_GZIP) = gz
48suffix_$(CONFIG_KERNEL_BZIP2) = bz2
49suffix_$(CONFIG_KERNEL_LZMA) = lzma
50suffix_$(CONFIG_KERNEL_LZO) = lzo
51tool_$(CONFIG_KERNEL_GZIP) = gzip 43tool_$(CONFIG_KERNEL_GZIP) = gzip
52tool_$(CONFIG_KERNEL_BZIP2) = bzip2 44tool_$(CONFIG_KERNEL_BZIP2) = bzip2
53tool_$(CONFIG_KERNEL_LZMA) = lzma 45tool_$(CONFIG_KERNEL_LZMA) = lzma
54tool_$(CONFIG_KERNEL_LZO) = lzo 46tool_$(CONFIG_KERNEL_LZO) = lzo
55$(obj)/vmlinux.$(suffix_y): $(obj)/vmlinux.bin 47
48targets += vmlinux.bin.z
49$(obj)/vmlinux.bin.z: $(obj)/vmlinux.bin FORCE
56 $(call if_changed,$(tool_y)) 50 $(call if_changed,$(tool_y))
57 51
58$(obj)/piggy.o: $(obj)/vmlinux.$(suffix_y) $(obj)/dummy.o 52targets += piggy.o
59 $(Q)$(OBJCOPY) $(OBJCOPYFLAGS) \ 53OBJCOPYFLAGS_piggy.o := --add-section=.image=$(obj)/vmlinux.bin.z \
60 --add-section=.image=$< \ 54 --set-section-flags=.image=contents,alloc,load,readonly,data
61 --set-section-flags=.image=contents,alloc,load,readonly,data \ 55$(obj)/piggy.o: $(obj)/dummy.o $(obj)/vmlinux.bin.z FORCE
62 $(obj)/dummy.o $@ 56 $(call if_changed,objcopy)
57
58# Calculate the load address of the compressed kernel image
59hostprogs-y := calc_vmlinuz_load_addr
60
61VMLINUZ_LOAD_ADDRESS = $(shell $(obj)/calc_vmlinuz_load_addr \
62 $(objtree)/$(KBUILD_IMAGE) $(VMLINUX_LOAD_ADDRESS))
63 63
64LDFLAGS_vmlinuz := $(LDFLAGS) -Ttext $(VMLINUZ_LOAD_ADDRESS) -T 64vmlinuzobjs-y += $(obj)/piggy.o
65vmlinuz: $(src)/ld.script $(obj-y) $(obj)/piggy.o 65
66 $(call if_changed,ld) 66quiet_cmd_zld = LD $@
67 $(Q)$(OBJCOPY) $(OBJCOPYFLAGS) $@ 67 cmd_zld = $(LD) $(LDFLAGS) -Ttext $(VMLINUZ_LOAD_ADDRESS) -T $< $(vmlinuzobjs-y) -o $@
68quiet_cmd_strip = STRIP $@
69 cmd_strip = $(STRIP) -s $@
70vmlinuz: $(src)/ld.script $(vmlinuzobjs-y) $(obj)/calc_vmlinuz_load_addr
71 $(call cmd,zld)
72 $(call cmd,strip)
68 73
69# 74#
70# Some DECstations need all possible sections of an ECOFF executable 75# Some DECstations need all possible sections of an ECOFF executable
71# 76#
72ifdef CONFIG_MACH_DECSTATION 77ifdef CONFIG_MACH_DECSTATION
73 E2EFLAGS = -a 78 e2eflag := -a
74else
75 E2EFLAGS =
76endif 79endif
77 80
78# elf2ecoff can only handle 32bit image 81# elf2ecoff can only handle 32bit image
82hostprogs-y += ../elf2ecoff
79 83
80ifdef CONFIG_32BIT 84ifdef CONFIG_32BIT
81 VMLINUZ = vmlinuz 85 VMLINUZ = vmlinuz
@@ -83,23 +87,22 @@ else
83 VMLINUZ = vmlinuz.32 87 VMLINUZ = vmlinuz.32
84endif 88endif
85 89
90quiet_cmd_32 = OBJCOPY $@
91 cmd_32 = $(OBJCOPY) -O $(32bit-bfd) $(OBJCOPYFLAGS) $< $@
86vmlinuz.32: vmlinuz 92vmlinuz.32: vmlinuz
87 $(Q)$(OBJCOPY) -O $(32bit-bfd) $(OBJCOPYFLAGS) $< $@ 93 $(call cmd,32)
88 94
95quiet_cmd_ecoff = ECOFF $@
96 cmd_ecoff = $< $(VMLINUZ) $@ $(e2eflag)
89vmlinuz.ecoff: $(obj)/../elf2ecoff $(VMLINUZ) 97vmlinuz.ecoff: $(obj)/../elf2ecoff $(VMLINUZ)
90 $(Q)$(obj)/../elf2ecoff $(VMLINUZ) vmlinuz.ecoff $(E2EFLAGS) 98 $(call cmd,ecoff)
91
92$(obj)/../elf2ecoff: $(src)/../elf2ecoff.c
93 $(Q)$(HOSTCC) -o $@ $^
94 99
95OBJCOPYFLAGS_vmlinuz.bin := $(OBJCOPYFLAGS) -O binary 100OBJCOPYFLAGS_vmlinuz.bin := $(OBJCOPYFLAGS) -O binary
96vmlinuz.bin: vmlinuz 101vmlinuz.bin: vmlinuz
97 $(call if_changed,objcopy) 102 $(call cmd,objcopy)
98 103
99OBJCOPYFLAGS_vmlinuz.srec := $(OBJCOPYFLAGS) -S -O srec 104OBJCOPYFLAGS_vmlinuz.srec := $(OBJCOPYFLAGS) -S -O srec
100vmlinuz.srec: vmlinuz 105vmlinuz.srec: vmlinuz
101 $(call if_changed,objcopy) 106 $(call cmd,objcopy)
102 107
103clean: 108clean-files := $(objtree)/vmlinuz.*
104clean-files += *.o \
105 vmlinu*