All of lore.kernel.org
 help / color / mirror / Atom feed
From: philby john <pjohn@mvista.com>
To: linux-mips@linux-mips.org
Cc: David Daney <ddaney@caviumnetworks.com>
Subject: Re: [PATCH] MIPS: Octeon: add option to ignore PT_NOTE section
Date: Thu, 14 Apr 2011 23:26:55 +0530	[thread overview]
Message-ID: <1302803815.3322.4.camel@localhost.localdomain> (raw)
In-Reply-To: <4DA5DF7A.1030207@caviumnetworks.com>

From: David Daney <ddaney@caviumnetworks.com>
Date: Wed, 13 Apr 2011 20:46:32 +0530
Subject: [PATCH] MIPS: Octeon: add option to ignore PT_NOTE section

Some early Octeon bootloaders cannot process PT_NOTE program
headers as reported in numerous sections of the web, here is
an example http://www.spinics.net/lists/mips/msg37799.html
Loading usually fails with such an error ...
Error allocating memory for elf image!

The work around usually is to strip the .notes section by using
such a command $mips-gnu-strip -R .notes vmlinux -o fixed-vmlinux
It is expected that the vmlinux image got after compilation be
bootable. Add a Kconfig option to ignore the PT_NOTE section.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
Signed-off-by: Philby John <pjohn@mvista.com>
---
 arch/mips/cavium-octeon/Kconfig |    8 ++++++++
 arch/mips/kernel/vmlinux.lds.S  |    6 ++++++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/arch/mips/cavium-octeon/Kconfig b/arch/mips/cavium-octeon/Kconfig
index caae228..ddecee3 100644
--- a/arch/mips/cavium-octeon/Kconfig
+++ b/arch/mips/cavium-octeon/Kconfig
@@ -90,6 +90,14 @@ config CAVIUM_OCTEON_LOCK_L2_MEMCPY
 	help
 	  Lock the kernel's implementation of memcpy() into L2.
 
+config DISABLE_ELF_NOTE_HEADER
+       bool "Disable the creation of the ELF PT_NOTE program header in vmlinux"
+       depends on CPU_CAVIUM_OCTEON
+       help
+         Some early Octeon bootloaders cannot process PT_NOTE program
+         headers.  Select y to omit these headers so that the kernel
+         can be loaded with older bootloaders.
+
 config ARCH_SPARSEMEM_ENABLE
 	def_bool y
 	select SPARSEMEM_STATIC
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
index 832afbb..0536910 100644
--- a/arch/mips/kernel/vmlinux.lds.S
+++ b/arch/mips/kernel/vmlinux.lds.S
@@ -8,7 +8,9 @@ OUTPUT_ARCH(mips)
 ENTRY(kernel_entry)
 PHDRS {
 	text PT_LOAD FLAGS(7);	/* RWX */
+#ifndef CONFIG_DISABLE_ELF_NOTE_HEADER
 	note PT_NOTE FLAGS(4);	/* R__ */
+#endif
 }
 
 #ifdef CONFIG_32BIT
@@ -62,7 +64,11 @@ SECTIONS
 		__stop___dbe_table = .;
 	}
 
+#ifndef CONFIG_DISABLE_ELF_NOTE_HEADER
 	NOTES :text :note
+#else
+	NOTES :text
+#endif
 	.dummy : { *(.dummy) } :text
 
 	RODATA
-- 
1.7.4

  parent reply	other threads:[~2011-04-14 17:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-13 16:07 [PATCH] MIPS: Octeon: add option to ignore PT_NOTE section philby john
2011-04-13 17:38 ` David Daney
2011-04-14 17:54   ` philby john
2011-04-14 17:56   ` philby john [this message]
2011-04-14 19:41     ` Philby John
2011-04-14 20:02       ` David Daney
2011-05-19 10:28         ` Ralf Baechle
2011-04-15  8:24   ` Florian Fainelli
2011-04-15  8:55     ` Philby John
2011-04-15 16:27       ` David Daney
2011-04-16 15:21         ` Philby John
2011-04-16 15:51           ` Florian Fainelli
2011-04-17  5:16             ` Philby John

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1302803815.3322.4.camel@localhost.localdomain \
    --to=pjohn@mvista.com \
    --cc=ddaney@caviumnetworks.com \
    --cc=linux-mips@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.