[PATCH v2] MIPS: Set ISA bit in entry-y for microMIPS kernels

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: Maciej W. Rozycki <macro@xxxxxxxxxx>
---
Ralf,

 As you requested, here's v2 rebased as a replacement for 5fc9484f5e41,
with the heading reused.

 Please apply.

  Maciej

---
 arch/mips/Makefile |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

linux-mips-start-address.diff
Index: linux-sfr-usead/arch/mips/Makefile
===================================================================
--- linux-sfr-usead.orig/arch/mips/Makefile	2017-08-21 20:48:38.000000000 +0100
+++ linux-sfr-usead/arch/mips/Makefile	2017-08-21 17:47:16.802753000 +0100
@@ -243,8 +243,12 @@ 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 \ )
+
+# Sign-extend the entry point to 64 bits if retrieved as a 32-bit number.
+entry-y		= $(shell $(OBJDUMP) -f vmlinux 2>/dev/null \
+			| sed -n '/^start address / { \
+				s/^.*0x\([0-7].......\)$$/0x00000000\1/; \
+				s/^.*0x\(........\)$$/0xffffffff\1/; p }')
 
 cflags-y			+= -I$(srctree)/arch/mips/include/asm/mach-generic
 drivers-$(CONFIG_PCI)		+= arch/mips/pci/




[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux