Skip to contentSkip to conversation

MIPS: Octeon: add option to ignore PT_NOTE section

PATCH In review philby john 4 participants 13 messages Apr 13, 2011 – May 19, 2011 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MIPS: Octeon: add option to ignore PT_NOTE section

From: Philby John <[email protected]>
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.

---
 arch/mips/cavium-octeon/Kconfig |    8 ++++++++
 arch/mips/kernel/vmlinux.lds.S  |    6 ++++++
 2 files changed, 14 insertions(+), 0 deletions(-)
arch/mips/cavium-octeon/Kconfig +8 -0
index caae228..ddecee3 100644
@@ -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
arch/mips/kernel/vmlinux.lds.S +6 -0
index 832afbb..0536910 100644
@@ -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
Signature · 1 line
1.7.4
#1 lore raw
Quoted 1 line · philby john

From: Philby John<[email protected]>

^^^^^^^^ I believe that statement to be not entirely correct.

Perhaps you should change it to something like:
From: David Daney <[email protected]>

Quoted 16 lines

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.

---

#2 lore raw
Quoted 4 lines · David Daney
Quoted 1 line · philby john

From: Philby John<[email protected]>

^^^^^^^^ I believe that statement to be not entirely correct.

To be honest, we had a xyz customer report this issue with a patch that had no original author sign-off. Good to know its origin. Another shot with correct attributions follows in a second.

Regards,
Philby

Quoted 21 lines

Perhaps you should change it to something like:
From: David Daney <[email protected]>

Quoted 16 lines

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.

---

#3 lore raw
In reply to David Daney

From: David Daney <[email protected]>
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.

---
 arch/mips/cavium-octeon/Kconfig |    8 ++++++++
 arch/mips/kernel/vmlinux.lds.S  |    6 ++++++
 2 files changed, 14 insertions(+), 0 deletions(-)
arch/mips/cavium-octeon/Kconfig +8 -0
index caae228..ddecee3 100644
@@ -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
arch/mips/kernel/vmlinux.lds.S +6 -0
index 832afbb..0536910 100644
@@ -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
Signature · 1 line
1.7.4
#4 lore raw

Another finding to be noted about this approach is that, booting works fine with just these lines of code

+#ifndef CONFIG_DISABLE_ELF_NOTE_HEADER
NOTES :text :note
+#else
+ NOTES :text
+#endif

And IMHO we should be just using this, which is what you get if one were to use the command
$mips-gnu-strip -R .notes vmlinux -o fixed-vmlinux

So with just the above lines of code or with the strip command above readelf shows this output

Elf file type is EXEC (Executable file) Entry point 0xffffffff81105d10
There are 2 program headers, starting at offset 64

Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
LOAD 0x0000000000010000 0xffffffff81100000 0xffffffff81100000

                 0x000000000098be00 0x0000000000a00000  RWE    10000
  NOTE           0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000000 0x0000000000000000  R      8

Section to Segment mapping:
Segment Sections...
00 .text __ex_table .notes .rodata .pci_fixup __ksymtab
__ksymtab_gpl __ksymtab_strings __init_rodata __param .data .init.text .init.data .exit.text .data.percpu .bss .bss.superpage_aligned
01

Where as if one were to remove the PT_NOTE section readelf would show ...

Elf file type is EXEC (Executable file) Entry point 0xffffffff81105d10
There are 1 program headers, starting at offset 64

Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
LOAD 0x0000000000010000 0xffffffff81100000 0xffffffff81100000

                 0x000000000098be00 0x0000000000a00000  RWE    10000

Section to Segment mapping:
Segment Sections...
00 .text __ex_table .notes .rodata .pci_fixup __ksymtab
__ksymtab_gpl __ksymtab_strings __init_rodata __param .data .init.text .init.data .exit.text .data.percpu .bss .bss.superpage_aligned

Shouldn't we just follow what strip does?

Regards,
Philby

Quoted 67 lines · philby john

From: David Daney <[email protected]>
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.

---
 arch/mips/cavium-octeon/Kconfig |    8 ++++++++
 arch/mips/kernel/vmlinux.lds.S  |    6 ++++++
 2 files changed, 14 insertions(+), 0 deletions(-)
arch/mips/cavium-octeon/Kconfig +8 -0
index caae228..ddecee3 100644
@@ -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
arch/mips/kernel/vmlinux.lds.S +6 -0
index 832afbb..0536910 100644
@@ -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
#5 lore raw
Quoted 20 lines · Philby John

Another finding to be noted about this approach is that, booting works fine with just these lines of code

arch/mips/kernel/vmlinux.lds.S +4 -0
+#ifndef CONFIG_DISABLE_ELF_NOTE_HEADER
  	NOTES :text :note
+#else
+	NOTES :text
+#endif

And IMHO we should be just using this, which is what you get if one were to use the command
$mips-gnu-strip -R .notes vmlinux -o fixed-vmlinux

So with just the above lines of code or with the strip command above readelf shows this output

Elf file type is EXEC (Executable file) Entry point 0xffffffff81105d10
There are 2 program headers, starting at offset 64

Quoted 8 lines

Program Headers:

   Type           Offset             VirtAddr           PhysAddr
                  FileSiz            MemSiz              Flags  Align
   LOAD           0x0000000000010000 0xffffffff81100000 0xffffffff81100000
                  0x000000000098be00 0x0000000000a00000  RWE    10000
   NOTE           0x0000000000000000 0x0000000000000000 0x0000000000000000
                  0x0000000000000000 0x0000000000000000  R      8

Can someone with a defective bootloader verify that a zero size PT_NOTE header is as good as *no* PT_NOTE header?

If so, we should just omit the patch all together and tell people who are interested to use the strip command instead.

David Daney

Quoted 101 lines

Section to Segment mapping:
Segment Sections...
00 .text __ex_table .notes .rodata .pci_fixup __ksymtab
__ksymtab_gpl __ksymtab_strings __init_rodata __param .data .init.text .init.data .exit.text .data.percpu .bss .bss.superpage_aligned

    01

Where as if one were to remove the PT_NOTE section readelf would show ...

Elf file type is EXEC (Executable file) Entry point 0xffffffff81105d10
There are 1 program headers, starting at offset 64

Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
LOAD 0x0000000000010000 0xffffffff81100000 0xffffffff81100000

                  0x000000000098be00 0x0000000000a00000  RWE    10000

Section to Segment mapping:
Segment Sections...
00 .text __ex_table .notes .rodata .pci_fixup __ksymtab
__ksymtab_gpl __ksymtab_strings __init_rodata __param .data .init.text .init.data .exit.text .data.percpu .bss .bss.superpage_aligned

Shouldn't we just follow what strip does?

Regards,
Philby

Quoted 67 lines · philby john

From: David Daney<[email protected]>
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.

---
  arch/mips/cavium-octeon/Kconfig |    8 ++++++++
  arch/mips/kernel/vmlinux.lds.S  |    6 ++++++
  2 files changed, 14 insertions(+), 0 deletions(-)
arch/mips/cavium-octeon/Kconfig +8 -0
index caae228..ddecee3 100644
@@ -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
arch/mips/kernel/vmlinux.lds.S +6 -0
index 832afbb..0536910 100644
@@ -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
#6 lore raw
Quoted 5 lines · David Daney

Can someone with a defective bootloader verify that a zero size PT_NOTE header is as good as *no* PT_NOTE header?

If so, we should just omit the patch all together and tell people who are interested to use the strip command instead.

Where are we with this patch? It's still bitrotting in patchworks and the discussion did not seem to have come to a conclusion. So for now I'm going to mark https://patchwork.linux-mips.org/patch/2295/ as "rejected" unless somebody convinces me to resurrect it again.

Ralf

#7 lore raw
In reply to David Daney

Hello,

Quoted 21 lines · On Wednesday 13 April 2011 19:38:02 David Daney wrote:
Quoted 1 line · philby john

From: Philby John<[email protected]>

^^^^^^^^ I believe that statement to be not entirely correct.

Perhaps you should change it to something like:
From: David Daney <[email protected]>

Quoted 13 lines

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.

Do we really want this to be in the kernel? In my opinion, this is a fixup which distributions should be aware of, but not necessarily take place here in the kernel Makefiles.
--
Florian

#8 lore raw
Quoted 20 lines · Florian Fainelli

Hello,

Quoted 17 lines · On Wednesday 13 April 2011 19:38:02 David Daney wrote:
Quoted 1 line · philby john

From: Philby John<[email protected]>

^^^^^^^^ I believe that statement to be not entirely correct.

Perhaps you should change it to something like:
From: David Daney <[email protected]>

Quoted 9 lines

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!

Quoted 8 lines
Quoted 4 lines
Quoted 4 lines

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.

Do we really want this to be in the kernel? In my opinion, this is a fixup which distributions should be aware of, but not necessarily take place here in the kernel Makefiles.

You are right in one way. But as an OS vendor company we will definitely include this patch in our distribution. This incident has been reported many a times and its a pain to see the image not boot up, throw up an error, with the user having to search the work around on the web. What we are trying to do is save all that trouble. If it can be fixed why not fix it.

Cheers,
Philby

#9 lore raw
Quoted 30 lines · Philby John
Quoted 20 lines · Florian Fainelli

Hello,

Quoted 17 lines · On Wednesday 13 April 2011 19:38:02 David Daney wrote:
Quoted 1 line · philby john

From: Philby John<[email protected]>

^^^^^^^^ I believe that statement to be not entirely correct.

Perhaps you should change it to something like:
From: David Daney<[email protected]>

Quoted 9 lines

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!

Quoted 8 lines
Quoted 4 lines
Quoted 4 lines

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.

Do we really want this to be in the kernel? In my opinion, this is a fixup which distributions should be aware of, but not necessarily take place here in the kernel Makefiles.

Quoted 7 lines

You are right in one way. But as an OS vendor company we will definitely include this patch in our distribution. This incident has been reported many a times and its a pain to see the image not boot up, throw up an error, with the user having to search the work around on the web. What we are trying to do is save all that trouble. If it can be fixed why not fix it.

I don't care one way or another. We too (perhaps one and the same...) provide kernels to our SDK customers with the patch applied.

An alternative approach would be to put the $(CROSS_COMPILE)strip command into the arch/mips/Makefile.

David Daney

#10 lore raw
Quoted 41 lines · David Daney
Quoted 32 lines · Philby John
Quoted 25 lines · Florian Fainelli

Hello,

Quoted 21 lines · On Wednesday 13 April 2011 19:38:02 David Daney wrote:
Quoted 1 line · philby john

From: Philby John<[email protected]>

^^^^^^^^ I believe that statement to be not entirely correct.

Perhaps you should change it to something like:
From: David Daney<[email protected]>

Quoted 13 lines

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.

Quoted 5 lines

Do we really want this to be in the kernel? In my opinion, this is a fixup
which distributions should be aware of, but not necessarily take place here in
the kernel Makefiles.

Quoted 7 lines

You are right in one way. But as an OS vendor company we will definitely include this patch in our distribution. This incident has been reported many a times and its a pain to see the image not boot up, throw up an error, with the user having to search the work around on the web. What we are trying to do is save all that trouble. If it can be fixed why not fix it.

Quoted 5 lines

I don't care one way or another. We too (perhaps one and the same...) provide kernels to our SDK customers with the patch applied.

An alternative approach would be to put the $(CROSS_COMPILE)strip command into the arch/mips/Makefile.

I doubt that's any good, strip also removes debug symbols along with the notes section and I am not aware of a specific command to strip just the PT_NOTE section. Just these lines of code seem to get the job done though ...

+#ifndef CONFIG_DISABLE_ELF_NOTE_HEADER
NOTES :text :note
+#else
+ NOTES :text
+#endif

Regards,
Philby

#11 lore raw

Hello,

Quoted 53 lines · Philby John
Quoted 41 lines · David Daney
Quoted 32 lines · Philby John
Quoted 25 lines · Florian Fainelli

Hello,

Quoted 21 lines · On Wednesday 13 April 2011 19:38:02 David Daney wrote:
Quoted 1 line · philby john

From: Philby John<[email protected]>

^^^^^^^^ I believe that statement to be not entirely correct.

Perhaps you should change it to something like:
From: David Daney<[email protected]>

Quoted 13 lines

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.

Quoted 5 lines

Do we really want this to be in the kernel? In my opinion, this is a fixup
which distributions should be aware of, but not necessarily take place here in
the kernel Makefiles.

Quoted 7 lines

You are right in one way. But as an OS vendor company we will definitely include this patch in our distribution. This incident has been reported many a times and its a pain to see the image not boot up, throw up an error, with the user having to search the work around on the web. What we are trying to do is save all that trouble. If it can be fixed why not fix it.

Quoted 5 lines

I don't care one way or another. We too (perhaps one and the same...) provide kernels to our SDK customers with the patch applied.

An alternative approach would be to put the $(CROSS_COMPILE)strip command into the arch/mips/Makefile.

I doubt that's any good, strip also removes debug symbols along with the notes section and I am not aware of a specific command to strip just the PT_NOTE section. Just these lines of code seem to get the job done though ...

arch/mips/kernel/vmlinux.lds.S SECTIONS · line 71

Quoted 5 lines
arch/mips/kernel/vmlinux.lds.S +4 -0
+#ifndef CONFIG_DISABLE_ELF_NOTE_HEADER
       NOTES :text :note
+#else
+    NOTES :text
+#endif

strip can be told to only strip a particular section, e.g: $(TARGET_CROSS)strip -R .notes

like David, I prefer this option rather than modifying the linker script. --
Florian

#12 lore raw
Quoted 58 lines · Florian Fainelli

Hello,

Quoted 55 lines · Philby John
Quoted 43 lines · David Daney
Quoted 32 lines · Philby John
Quoted 25 lines · Florian Fainelli

Hello,

Quoted 21 lines · On Wednesday 13 April 2011 19:38:02 David Daney wrote:
Quoted 1 line · philby john

From: Philby John<[email protected]>

^^^^^^^^ I believe that statement to be not entirely correct.

Perhaps you should change it to something like:
From: David Daney<[email protected]>

Quoted 13 lines

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.

Quoted 5 lines

Do we really want this to be in the kernel? In my opinion, this is a fixup
which distributions should be aware of, but not necessarily take place here in
the kernel Makefiles.

Quoted 9 lines

You are right in one way. But as an OS vendor company we will definitely
include this patch in our distribution. This incident has been reported many a times and its a pain to see the image not boot up, throw up an error, with the user having to search the work around on the web. What we are trying to do is save all that trouble. If it can be fixed why not
fix it.

Quoted 5 lines

I don't care one way or another. We too (perhaps one and the same...) provide kernels to our SDK customers with the patch applied.

An alternative approach would be to put the $(CROSS_COMPILE)strip command into the arch/mips/Makefile.

I doubt that's any good, strip also removes debug symbols along with the notes section and I am not aware of a specific command to strip just the PT_NOTE section. Just these lines of code seem to get the job done though ...

Quoted 9 lines

Review

Quoted 5 lines
(quoted diff) +4 -0
+#ifndef CONFIG_DISABLE_ELF_NOTE_HEADER
       NOTES :text :note
+#else
+    NOTES :text
+#endif

strip can be told to only strip a particular section, e.g:
$(TARGET_CROSS)strip -R .notes

But this strips the debug symbols as well, from what I saw. Problems with the strip command? Anyways, I won't be pursuing this matter any further given the limited scope of its inclusion.

Regards,
Philby