aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/boot
diff options
context:
space:
mode:
authorSam Ravnborg <sam@ravnborg.org>2010-05-30 10:28:03 -0400
committerRalf Baechle <ralf@linux-mips.org>2010-08-05 08:25:58 -0400
commit35eaa1e9c9b4579100320814aeebff167ee59b0a (patch)
treeffa02e53532248ff0f24fa4aaa5ac0922d03a70d /arch/mips/boot
parent961e196c7a3b3c3d1d9eb32629b0e745ce0a68d1 (diff)
MIPS: Refactor arch/mips/boot/compressed/Makefile
- use hostprogs-y for the elf2ecoff - list all *.o file in targets - renamed obj-y to vmlinuzobjs-y (it was confusing to re-use a kbuild variable) - fix all uses of if_changed/cmd - use kbuild rules to beautify output - update clean-file to clean vmlinuz.* in top-level directory - simplied logic in arch/mips/Makefile for compressed targets The net result is a more kbuild conformant Makefile but readability did not increase. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> To: linux-mips <linux-mips@linux-mips.org> To: Wu Zhangjin <wuzhangjin@gmail.com> Patchwork: https://patchwork.linux-mips.org/patch/1304/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/boot')
-rw-r--r--arch/mips/boot/compressed/Makefile54
1 files changed, 29 insertions, 25 deletions
diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
index 790ddd397620..74a52d799346 100644
--- a/arch/mips/boot/compressed/Makefile
+++ b/arch/mips/boot/compressed/Makefile
@@ -33,15 +33,19 @@ KBUILD_AFLAGS := $(LINUXINCLUDE) $(KBUILD_AFLAGS) -D__ASSEMBLY__ \
33 -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) \ 33 -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) \
34 -DKERNEL_ENTRY=0x$(shell $(NM) $(objtree)/$(KBUILD_IMAGE) 2>/dev/null | grep " kernel_entry" | cut -f1 -d \ ) 34 -DKERNEL_ENTRY=0x$(shell $(NM) $(objtree)/$(KBUILD_IMAGE) 2>/dev/null | grep " kernel_entry" | cut -f1 -d \ )
35 35
36obj-y := $(obj)/head.o $(obj)/decompress.o $(obj)/dbg.o 36targets := head.o decompress.o dbg.o uart-16550.o uart-alchemy.o
37
38# decompressor objects (linked with vmlinuz)
39vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/dbg.o
37 40
38ifdef CONFIG_DEBUG_ZBOOT 41ifdef CONFIG_DEBUG_ZBOOT
39obj-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o 42vmlinuzobjs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o
40obj-$(CONFIG_MACH_ALCHEMY) += $(obj)/uart-alchemy.o 43vmlinuzobjs-$(CONFIG_MACH_ALCHEMY) += $(obj)/uart-alchemy.o
41endif 44endif
42 45
46targets += vmlinux.bin
43OBJCOPYFLAGS_vmlinux.bin := $(OBJCOPYFLAGS) -O binary -R .comment -S 47OBJCOPYFLAGS_vmlinux.bin := $(OBJCOPYFLAGS) -O binary -R .comment -S
44$(obj)/vmlinux.bin: $(KBUILD_IMAGE) 48$(obj)/vmlinux.bin: $(KBUILD_IMAGE) FORCE
45 $(call if_changed,objcopy) 49 $(call if_changed,objcopy)
46 50
47suffix_$(CONFIG_KERNEL_GZIP) = gz 51suffix_$(CONFIG_KERNEL_GZIP) = gz
@@ -52,30 +56,31 @@ tool_$(CONFIG_KERNEL_GZIP) = gzip
52tool_$(CONFIG_KERNEL_BZIP2) = bzip2 56tool_$(CONFIG_KERNEL_BZIP2) = bzip2
53tool_$(CONFIG_KERNEL_LZMA) = lzma 57tool_$(CONFIG_KERNEL_LZMA) = lzma
54tool_$(CONFIG_KERNEL_LZO) = lzo 58tool_$(CONFIG_KERNEL_LZO) = lzo
55$(obj)/vmlinux.$(suffix_y): $(obj)/vmlinux.bin 59
60targets += vmlinux.gz vmlinux.bz2 vmlinux.lzma vmlinux.lzo
61$(obj)/vmlinux.$(suffix_y): $(obj)/vmlinux.bin FORCE
56 $(call if_changed,$(tool_y)) 62 $(call if_changed,$(tool_y))
57 63
58$(obj)/piggy.o: $(obj)/vmlinux.$(suffix_y) $(obj)/dummy.o 64targets += piggy.o
59 $(Q)$(OBJCOPY) $(OBJCOPYFLAGS) \ 65OBJCOPYFLAGS_piggy.o := --add-section=.image=$(obj)/vmlinux.$(suffix_y) \
60 --add-section=.image=$< \ 66 --set-section-flags=.image=contents,alloc,load,readonly,data
61 --set-section-flags=.image=contents,alloc,load,readonly,data \ 67$(obj)/piggy.o: $(obj)/dummy.o $(obj)/vmlinux.$(suffix_y) FORCE
62 $(obj)/dummy.o $@ 68 $(call if_changed,objcopy)
63 69
64LDFLAGS_vmlinuz := $(LDFLAGS) -Ttext $(VMLINUZ_LOAD_ADDRESS) -T 70LDFLAGS_vmlinuz := $(LDFLAGS) -Ttext $(VMLINUZ_LOAD_ADDRESS) -T
65vmlinuz: $(src)/ld.script $(obj-y) $(obj)/piggy.o 71vmlinuz: $(src)/ld.script $(vmlinuzobjs-y) $(obj)/piggy.o
66 $(call if_changed,ld) 72 $(call cmd,ld)
67 $(Q)$(OBJCOPY) $(OBJCOPYFLAGS) $@ 73 $(Q)$(OBJCOPY) $(OBJCOPYFLAGS) $@
68 74
69# 75#
70# Some DECstations need all possible sections of an ECOFF executable 76# Some DECstations need all possible sections of an ECOFF executable
71# 77#
72ifdef CONFIG_MACH_DECSTATION 78ifdef CONFIG_MACH_DECSTATION
73 E2EFLAGS = -a 79 e2eflag := -a
74else
75 E2EFLAGS =
76endif 80endif
77 81
78# elf2ecoff can only handle 32bit image 82# elf2ecoff can only handle 32bit image
83hostprogs-y := ../elf2ecoff
79 84
80ifdef CONFIG_32BIT 85ifdef CONFIG_32BIT
81 VMLINUZ = vmlinuz 86 VMLINUZ = vmlinuz
@@ -83,23 +88,22 @@ else
83 VMLINUZ = vmlinuz.32 88 VMLINUZ = vmlinuz.32
84endif 89endif
85 90
91quiet_cmd_32 = OBJCOPY $@
92 cmd_32 = $(OBJCOPY) -O $(32bit-bfd) $(OBJCOPYFLAGS) $< $@
86vmlinuz.32: vmlinuz 93vmlinuz.32: vmlinuz
87 $(Q)$(OBJCOPY) -O $(32bit-bfd) $(OBJCOPYFLAGS) $< $@ 94 $(call cmd,32)
88 95
96quiet_cmd_ecoff = ECOFF $@
97 cmd_ecoff = $< $(VMLINUZ) $@ $(e2eflag)
89vmlinuz.ecoff: $(obj)/../elf2ecoff $(VMLINUZ) 98vmlinuz.ecoff: $(obj)/../elf2ecoff $(VMLINUZ)
90 $(Q)$(obj)/../elf2ecoff $(VMLINUZ) vmlinuz.ecoff $(E2EFLAGS) 99 $(call cmd,ecoff)
91
92$(obj)/../elf2ecoff: $(src)/../elf2ecoff.c
93 $(Q)$(HOSTCC) -o $@ $^
94 100
95OBJCOPYFLAGS_vmlinuz.bin := $(OBJCOPYFLAGS) -O binary 101OBJCOPYFLAGS_vmlinuz.bin := $(OBJCOPYFLAGS) -O binary
96vmlinuz.bin: vmlinuz 102vmlinuz.bin: vmlinuz
97 $(call if_changed,objcopy) 103 $(call cmd,objcopy)
98 104
99OBJCOPYFLAGS_vmlinuz.srec := $(OBJCOPYFLAGS) -S -O srec 105OBJCOPYFLAGS_vmlinuz.srec := $(OBJCOPYFLAGS) -S -O srec
100vmlinuz.srec: vmlinuz 106vmlinuz.srec: vmlinuz
101 $(call if_changed,objcopy) 107 $(call cmd,objcopy)
102 108
103clean: 109clean-files := $(objtree)/vmlinuz.*
104clean-files += *.o \
105 vmlinu*