diff options
| author | Sam Ravnborg <sam@ravnborg.org> | 2010-05-30 10:28:03 -0400 |
|---|---|---|
| committer | Ralf Baechle <ralf@linux-mips.org> | 2010-08-05 08:25:58 -0400 |
| commit | 35eaa1e9c9b4579100320814aeebff167ee59b0a (patch) | |
| tree | ffa02e53532248ff0f24fa4aaa5ac0922d03a70d /arch/mips/boot | |
| parent | 961e196c7a3b3c3d1d9eb32629b0e745ce0a68d1 (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/Makefile | 54 |
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 | ||
| 36 | obj-y := $(obj)/head.o $(obj)/decompress.o $(obj)/dbg.o | 36 | targets := head.o decompress.o dbg.o uart-16550.o uart-alchemy.o |
| 37 | |||
| 38 | # decompressor objects (linked with vmlinuz) | ||
| 39 | vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/dbg.o | ||
| 37 | 40 | ||
| 38 | ifdef CONFIG_DEBUG_ZBOOT | 41 | ifdef CONFIG_DEBUG_ZBOOT |
| 39 | obj-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o | 42 | vmlinuzobjs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o |
| 40 | obj-$(CONFIG_MACH_ALCHEMY) += $(obj)/uart-alchemy.o | 43 | vmlinuzobjs-$(CONFIG_MACH_ALCHEMY) += $(obj)/uart-alchemy.o |
| 41 | endif | 44 | endif |
| 42 | 45 | ||
| 46 | targets += vmlinux.bin | ||
| 43 | OBJCOPYFLAGS_vmlinux.bin := $(OBJCOPYFLAGS) -O binary -R .comment -S | 47 | OBJCOPYFLAGS_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 | ||
| 47 | suffix_$(CONFIG_KERNEL_GZIP) = gz | 51 | suffix_$(CONFIG_KERNEL_GZIP) = gz |
| @@ -52,30 +56,31 @@ tool_$(CONFIG_KERNEL_GZIP) = gzip | |||
| 52 | tool_$(CONFIG_KERNEL_BZIP2) = bzip2 | 56 | tool_$(CONFIG_KERNEL_BZIP2) = bzip2 |
| 53 | tool_$(CONFIG_KERNEL_LZMA) = lzma | 57 | tool_$(CONFIG_KERNEL_LZMA) = lzma |
| 54 | tool_$(CONFIG_KERNEL_LZO) = lzo | 58 | tool_$(CONFIG_KERNEL_LZO) = lzo |
| 55 | $(obj)/vmlinux.$(suffix_y): $(obj)/vmlinux.bin | 59 | |
| 60 | targets += 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 | 64 | targets += piggy.o |
| 59 | $(Q)$(OBJCOPY) $(OBJCOPYFLAGS) \ | 65 | OBJCOPYFLAGS_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 | ||
| 64 | LDFLAGS_vmlinuz := $(LDFLAGS) -Ttext $(VMLINUZ_LOAD_ADDRESS) -T | 70 | LDFLAGS_vmlinuz := $(LDFLAGS) -Ttext $(VMLINUZ_LOAD_ADDRESS) -T |
| 65 | vmlinuz: $(src)/ld.script $(obj-y) $(obj)/piggy.o | 71 | vmlinuz: $(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 | # |
| 72 | ifdef CONFIG_MACH_DECSTATION | 78 | ifdef CONFIG_MACH_DECSTATION |
| 73 | E2EFLAGS = -a | 79 | e2eflag := -a |
| 74 | else | ||
| 75 | E2EFLAGS = | ||
| 76 | endif | 80 | endif |
| 77 | 81 | ||
| 78 | # elf2ecoff can only handle 32bit image | 82 | # elf2ecoff can only handle 32bit image |
| 83 | hostprogs-y := ../elf2ecoff | ||
| 79 | 84 | ||
| 80 | ifdef CONFIG_32BIT | 85 | ifdef CONFIG_32BIT |
| 81 | VMLINUZ = vmlinuz | 86 | VMLINUZ = vmlinuz |
| @@ -83,23 +88,22 @@ else | |||
| 83 | VMLINUZ = vmlinuz.32 | 88 | VMLINUZ = vmlinuz.32 |
| 84 | endif | 89 | endif |
| 85 | 90 | ||
| 91 | quiet_cmd_32 = OBJCOPY $@ | ||
| 92 | cmd_32 = $(OBJCOPY) -O $(32bit-bfd) $(OBJCOPYFLAGS) $< $@ | ||
| 86 | vmlinuz.32: vmlinuz | 93 | vmlinuz.32: vmlinuz |
| 87 | $(Q)$(OBJCOPY) -O $(32bit-bfd) $(OBJCOPYFLAGS) $< $@ | 94 | $(call cmd,32) |
| 88 | 95 | ||
| 96 | quiet_cmd_ecoff = ECOFF $@ | ||
| 97 | cmd_ecoff = $< $(VMLINUZ) $@ $(e2eflag) | ||
| 89 | vmlinuz.ecoff: $(obj)/../elf2ecoff $(VMLINUZ) | 98 | vmlinuz.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 | ||
| 95 | OBJCOPYFLAGS_vmlinuz.bin := $(OBJCOPYFLAGS) -O binary | 101 | OBJCOPYFLAGS_vmlinuz.bin := $(OBJCOPYFLAGS) -O binary |
| 96 | vmlinuz.bin: vmlinuz | 102 | vmlinuz.bin: vmlinuz |
| 97 | $(call if_changed,objcopy) | 103 | $(call cmd,objcopy) |
| 98 | 104 | ||
| 99 | OBJCOPYFLAGS_vmlinuz.srec := $(OBJCOPYFLAGS) -S -O srec | 105 | OBJCOPYFLAGS_vmlinuz.srec := $(OBJCOPYFLAGS) -S -O srec |
| 100 | vmlinuz.srec: vmlinuz | 106 | vmlinuz.srec: vmlinuz |
| 101 | $(call if_changed,objcopy) | 107 | $(call cmd,objcopy) |
| 102 | 108 | ||
| 103 | clean: | 109 | clean-files := $(objtree)/vmlinuz.* |
| 104 | clean-files += *.o \ | ||
| 105 | vmlinu* | ||
