diff options
author | Wu Zhangjin <wuzhangjin@gmail.com> | 2010-06-02 04:35:25 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2010-08-05 08:26:33 -0400 |
commit | 3c4b7fde941639bd96c7d0429b4da925f07be75f (patch) | |
tree | 312895f2055bdbf67166ebdf07be002b30abaf84 /arch/mips/boot/compressed | |
parent | 1e1a77d6984a0010a2225de97009ae22f1ffa026 (diff) |
MIPS: Clean up the calculation of VMLINUZ_LOAD_ADDRESS
We have calculated VMLINUZ_LOAD_ADDRESS in shell, which is indecipherable. This
patch rewrites it in C.
Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
To: linux-mips <linux-mips@linux-mips.org>
Cc: Alexander Clouter <alex@digriz.org.uk>
Cc: Manuel Lauss <manuel.lauss@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Alexander Clouter <alex@digriz.org.uk>
Patchwork: https://patchwork.linux-mips.org/patch/1324/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/boot/compressed')
-rw-r--r-- | arch/mips/boot/compressed/Makefile | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile index 3bdbeef0e0f5..583149043293 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 | ||
16 | VMLINUX_SIZE := $(shell wc -c $(objtree)/$(KBUILD_IMAGE) 2>/dev/null | cut -d' ' -f1) | ||
17 | VMLINUX_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" | ||
19 | HIGH32 := $(shell A=$(VMLINUX_LOAD_ADDRESS); [ $${\#A} -gt 10 ] && expr substr "$(VMLINUX_LOAD_ADDRESS)" 3 $$(($${\#A} - 10))) | ||
20 | LOW32 := $(shell [ -n "$(HIGH32)" ] && A=11 || A=3; expr substr "$(VMLINUX_LOAD_ADDRESS)" $${A} 8) | ||
21 | VMLINUZ_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 |
24 | BOOT_HEAP_SIZE := 0x400000 | 16 | BOOT_HEAP_SIZE := 0x400000 |
25 | 17 | ||
@@ -63,10 +55,18 @@ OBJCOPYFLAGS_piggy.o := --add-section=.image=$(obj)/vmlinux.bin.z \ | |||
63 | $(obj)/piggy.o: $(obj)/dummy.o $(obj)/vmlinux.bin.z FORCE | 55 | $(obj)/piggy.o: $(obj)/dummy.o $(obj)/vmlinux.bin.z FORCE |
64 | $(call if_changed,objcopy) | 56 | $(call if_changed,objcopy) |
65 | 57 | ||
66 | LDFLAGS_vmlinuz := $(LDFLAGS) -Ttext $(VMLINUZ_LOAD_ADDRESS) -T | 58 | # Calculate the load address of the compressed kernel image |
67 | vmlinuz: $(src)/ld.script $(vmlinuzobjs-y) $(obj)/piggy.o | 59 | hostprogs-y := calc_vmlinuz_load_addr |
68 | $(call cmd,ld) | 60 | |
69 | $(Q)$(OBJCOPY) $(OBJCOPYFLAGS) $@ | 61 | VMLINUZ_LOAD_ADDRESS = $(shell $(obj)/calc_vmlinuz_load_addr \ |
62 | $(objtree)/$(KBUILD_IMAGE) $(VMLINUX_LOAD_ADDRESS)) | ||
63 | |||
64 | vmlinuzobjs-y += $(obj)/piggy.o | ||
65 | |||
66 | quiet_cmd_zld = LD $@ | ||
67 | cmd_zld = $(LD) $(LDFLAGS) -Ttext $(VMLINUZ_LOAD_ADDRESS) -T $< $(vmlinuzobjs-y) -o $@ | ||
68 | vmlinuz: $(src)/ld.script $(vmlinuzobjs-y) $(obj)/calc_vmlinuz_load_addr | ||
69 | $(call cmd,zld) | ||
70 | 70 | ||
71 | # | 71 | # |
72 | # Some DECstations need all possible sections of an ECOFF executable | 72 | # Some DECstations need all possible sections of an ECOFF executable |
@@ -76,7 +76,7 @@ ifdef CONFIG_MACH_DECSTATION | |||
76 | endif | 76 | endif |
77 | 77 | ||
78 | # elf2ecoff can only handle 32bit image | 78 | # elf2ecoff can only handle 32bit image |
79 | hostprogs-y := ../elf2ecoff | 79 | hostprogs-y += ../elf2ecoff |
80 | 80 | ||
81 | ifdef CONFIG_32BIT | 81 | ifdef CONFIG_32BIT |
82 | VMLINUZ = vmlinuz | 82 | VMLINUZ = vmlinuz |