Commit 27c524d1 authored by Maciej W. Rozycki's avatar Maciej W. Rozycki Committed by James Hogan

MIPS: Use the entry point from the ELF file header

In order to fetch the correct entry point with the ISA bit included, for
use by non-ELF boot loaders, parse the output of `objdump -f' for the
start address recorded in the kernel executable itself, rather than
using `nm' to get the value of the `kernel_entry' symbol.

Sign-extend the address retrieved if 32-bit, so that execution is
correctly started on 64-bit processors as well.  The tool always prints
the entry point using either 8 or 16 hexadecimal digits, matching the
address width (aka class) of the ELF file, even in the presence of
leading zeros.
Signed-off-by: default avatarMaciej W. Rozycki <macro@mips.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Burton <paul.burton@mips.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/18912/Signed-off-by: default avatarJames Hogan <jhogan@kernel.org>
parent b9120c01
...@@ -251,20 +251,12 @@ ifdef CONFIG_PHYSICAL_START ...@@ -251,20 +251,12 @@ ifdef CONFIG_PHYSICAL_START
load-y = $(CONFIG_PHYSICAL_START) load-y = $(CONFIG_PHYSICAL_START)
endif endif
entry-noisa-y = 0x$(shell $(NM) vmlinux 2>/dev/null \ # Sign-extend the entry point to 64 bits if retrieved as a 32-bit number.
| grep "\bkernel_entry\b" | cut -f1 -d \ ) entry-y = $(shell $(OBJDUMP) -f vmlinux 2>/dev/null \
ifdef CONFIG_CPU_MICROMIPS | sed -n '/^start address / { \
# s/^.* //; \
# Set the ISA bit, since the kernel_entry symbol in the ELF will have it s/0x\([0-7].......\)$$/0x00000000\1/; \
# clear which would lead to images containing addresses which bootloaders may s/0x\(........\)$$/0xffffffff\1/; p }')
# jump to as MIPS32 code.
#
entry-y = $(patsubst %0,%1,$(patsubst %2,%3,$(patsubst %4,%5, \
$(patsubst %6,%7,$(patsubst %8,%9,$(patsubst %a,%b, \
$(patsubst %c,%d,$(patsubst %e,%f,$(entry-noisa-y)))))))))
else
entry-y = $(entry-noisa-y)
endif
cflags-y += -I$(srctree)/arch/mips/include/asm/mach-generic cflags-y += -I$(srctree)/arch/mips/include/asm/mach-generic
drivers-$(CONFIG_PCI) += arch/mips/pci/ drivers-$(CONFIG_PCI) += arch/mips/pci/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment