[PATCH] MIPS: Use objdump -f to find kernel entry point

From
Paul Burton <hidden>
Date
2016-08-19 17:16:54
When using nm to find the address of the kernel_entry symbol, the
microMIPS ISA bit is not set for microMIPS kernels. This means that the
entry address reported for the kernel is one that is treated as MIPS32
code, which causes problems if it is placed into an image such as a
uImage or FIT image from which the bootloader will read the entry
address & branch to it as non-microMIPS code.

Fix this by instead using the objdump tool to determine the kernel entry
address instead. We already pass $(OBJDUMP) around the kernel makefiles,
and it reports the entry address with the microMIPS ISA bit intact.

Signed-off-by: Paul Burton <redacted>
---
 arch/mips/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index efd7a9d..9bf611d 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -232,8 +232,9 @@ include arch/mips/Kbuild.platforms
 ifdef CONFIG_PHYSICAL_START
 load-y					= $(CONFIG_PHYSICAL_START)
 endif
-entry-y				= 0x$(shell $(NM) vmlinux 2>/dev/null \
-					| grep "\bkernel_entry\b" | cut -f1 -d \ )
+entry-y				= $(shell $(OBJDUMP) -f vmlinux 2>/dev/null \
+					| grep "^start address " \
+					| cut -f3 -d \ )
 
 cflags-y			+= -I$(srctree)/arch/mips/include/asm/mach-generic
 drivers-$(CONFIG_PCI)		+= arch/mips/pci/
-- 
2.9.3
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help