diff options
author | James Hogan <james.hogan@imgtec.com> | 2013-08-30 11:42:41 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2013-09-03 11:58:37 -0400 |
commit | 3185557d1acf8cc0c937b1343de83e2483bde28b (patch) | |
tree | d7b64e678000c35870ab4a00f27f01f456550d79 | |
parent | 38d2d649be17b291a965a2e1370d119ee319caf2 (diff) |
MIPS: Refactor load/entry address calculations
The vmlinux load address and entry address is calculated in multiple
places:
- arch/mips/Makefile defines load-y from CONFIG_PHYSICAL_START (or
defined by the platform) and passes it to
arch/mips/boot/compressed/Makefile.
- arch/mips/boot/compressed/Makefile calculates kernel entry using nm.
- arch/mips/lasat/image/Makefile calculates both load and entry address
using nm.
Lets combine these in the main Makefile and then pass them as Make
parameters to each of the three boot image Makefiles (in boot/,
boot/compressed, lasat/image/). The boot/ Makefile doesn't currently use
them, but will soon need to for U-Boot image targets.
The existing load-y definition is used in preference to calculating the
load address using nm.
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/5794/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r-- | arch/mips/Makefile | 13 | ||||
-rw-r--r-- | arch/mips/boot/compressed/Makefile | 2 | ||||
-rw-r--r-- | arch/mips/lasat/image/Makefile | 6 |
3 files changed, 13 insertions, 8 deletions
diff --git a/arch/mips/Makefile b/arch/mips/Makefile index 6e1ab33f396a..91d5baa66540 100644 --- a/arch/mips/Makefile +++ b/arch/mips/Makefile | |||
@@ -194,6 +194,8 @@ include $(srctree)/arch/mips/Kbuild.platforms | |||
194 | ifdef CONFIG_PHYSICAL_START | 194 | ifdef CONFIG_PHYSICAL_START |
195 | load-y = $(CONFIG_PHYSICAL_START) | 195 | load-y = $(CONFIG_PHYSICAL_START) |
196 | endif | 196 | endif |
197 | entry-y = 0x$(shell $(NM) vmlinux 2>/dev/null \ | ||
198 | | grep "\bkernel_entry\b" | cut -f1 -d \ ) | ||
197 | 199 | ||
198 | cflags-y += -I$(srctree)/arch/mips/include/asm/mach-generic | 200 | cflags-y += -I$(srctree)/arch/mips/include/asm/mach-generic |
199 | drivers-$(CONFIG_PCI) += arch/mips/pci/ | 201 | drivers-$(CONFIG_PCI) += arch/mips/pci/ |
@@ -225,6 +227,9 @@ KBUILD_CFLAGS += $(cflags-y) | |||
225 | KBUILD_CPPFLAGS += -DVMLINUX_LOAD_ADDRESS=$(load-y) | 227 | KBUILD_CPPFLAGS += -DVMLINUX_LOAD_ADDRESS=$(load-y) |
226 | KBUILD_CPPFLAGS += -DDATAOFFSET=$(if $(dataoffset-y),$(dataoffset-y),0) | 228 | KBUILD_CPPFLAGS += -DDATAOFFSET=$(if $(dataoffset-y),$(dataoffset-y),0) |
227 | 229 | ||
230 | bootvars-y = VMLINUX_LOAD_ADDRESS=$(load-y) \ | ||
231 | VMLINUX_ENTRY_ADDRESS=$(entry-y) | ||
232 | |||
228 | LDFLAGS += -m $(ld-emul) | 233 | LDFLAGS += -m $(ld-emul) |
229 | 234 | ||
230 | ifdef CONFIG_CC_STACKPROTECTOR | 235 | ifdef CONFIG_CC_STACKPROTECTOR |
@@ -267,7 +272,8 @@ bootz-y += vmlinuz.srec | |||
267 | 272 | ||
268 | ifdef CONFIG_LASAT | 273 | ifdef CONFIG_LASAT |
269 | rom.bin rom.sw: vmlinux | 274 | rom.bin rom.sw: vmlinux |
270 | $(Q)$(MAKE) $(build)=arch/mips/lasat/image $@ | 275 | $(Q)$(MAKE) $(build)=arch/mips/lasat/image \ |
276 | $(bootvars-y) $@ | ||
271 | endif | 277 | endif |
272 | 278 | ||
273 | # | 279 | # |
@@ -292,12 +298,13 @@ all: $(all-y) | |||
292 | 298 | ||
293 | # boot | 299 | # boot |
294 | $(boot-y): $(vmlinux-32) FORCE | 300 | $(boot-y): $(vmlinux-32) FORCE |
295 | $(Q)$(MAKE) $(build)=arch/mips/boot VMLINUX=$(vmlinux-32) arch/mips/boot/$@ | 301 | $(Q)$(MAKE) $(build)=arch/mips/boot VMLINUX=$(vmlinux-32) \ |
302 | $(bootvars-y) arch/mips/boot/$@ | ||
296 | 303 | ||
297 | # boot/compressed | 304 | # boot/compressed |
298 | $(bootz-y): $(vmlinux-32) FORCE | 305 | $(bootz-y): $(vmlinux-32) FORCE |
299 | $(Q)$(MAKE) $(build)=arch/mips/boot/compressed \ | 306 | $(Q)$(MAKE) $(build)=arch/mips/boot/compressed \ |
300 | VMLINUX_LOAD_ADDRESS=$(load-y) 32bit-bfd=$(32bit-bfd) $@ | 307 | $(bootvars-y) 32bit-bfd=$(32bit-bfd) $@ |
301 | 308 | ||
302 | 309 | ||
303 | CLEAN_FILES += vmlinux.32 vmlinux.64 | 310 | CLEAN_FILES += vmlinux.32 vmlinux.64 |
diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile index bb1dbf4abb9d..0048c0897896 100644 --- a/arch/mips/boot/compressed/Makefile +++ b/arch/mips/boot/compressed/Makefile | |||
@@ -25,7 +25,7 @@ KBUILD_CFLAGS := $(LINUXINCLUDE) $(KBUILD_CFLAGS) -D__KERNEL__ \ | |||
25 | 25 | ||
26 | KBUILD_AFLAGS := $(LINUXINCLUDE) $(KBUILD_AFLAGS) -D__ASSEMBLY__ \ | 26 | KBUILD_AFLAGS := $(LINUXINCLUDE) $(KBUILD_AFLAGS) -D__ASSEMBLY__ \ |
27 | -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) \ | 27 | -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) \ |
28 | -DKERNEL_ENTRY=0x$(shell $(NM) $(objtree)/$(KBUILD_IMAGE) 2>/dev/null | grep " kernel_entry" | cut -f1 -d \ ) | 28 | -DKERNEL_ENTRY=$(VMLINUX_ENTRY_ADDRESS) |
29 | 29 | ||
30 | targets := head.o decompress.o dbg.o uart-16550.o uart-alchemy.o | 30 | targets := head.o decompress.o dbg.o uart-16550.o uart-alchemy.o |
31 | 31 | ||
diff --git a/arch/mips/lasat/image/Makefile b/arch/mips/lasat/image/Makefile index dfb509d21d8e..fd32075679c6 100644 --- a/arch/mips/lasat/image/Makefile +++ b/arch/mips/lasat/image/Makefile | |||
@@ -13,13 +13,11 @@ endif | |||
13 | MKLASATIMG = mklasatimg | 13 | MKLASATIMG = mklasatimg |
14 | MKLASATIMG_ARCH = mq2,mqpro,sp100,sp200 | 14 | MKLASATIMG_ARCH = mq2,mqpro,sp100,sp200 |
15 | KERNEL_IMAGE = vmlinux | 15 | KERNEL_IMAGE = vmlinux |
16 | KERNEL_START = $(shell $(NM) $(KERNEL_IMAGE) | grep " _text" | cut -f1 -d\ ) | ||
17 | KERNEL_ENTRY = $(shell $(NM) $(KERNEL_IMAGE) | grep kernel_entry | cut -f1 -d\ ) | ||
18 | 16 | ||
19 | LDSCRIPT= -L$(srctree)/$(src) -Tromscript.normal | 17 | LDSCRIPT= -L$(srctree)/$(src) -Tromscript.normal |
20 | 18 | ||
21 | HEAD_DEFINES := -D_kernel_start=0x$(KERNEL_START) \ | 19 | HEAD_DEFINES := -D_kernel_start=$(VMLINUX_LOAD_ADDRESS) \ |
22 | -D_kernel_entry=0x$(KERNEL_ENTRY) \ | 20 | -D_kernel_entry=$(VMLINUX_ENTRY_ADDRESS) \ |
23 | -D VERSION="\"$(Version)\"" \ | 21 | -D VERSION="\"$(Version)\"" \ |
24 | -D TIMESTAMP=$(shell date +%s) | 22 | -D TIMESTAMP=$(shell date +%s) |
25 | 23 | ||