All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MIPS: Octeon: add option to ignore PT_NOTE section
@ 2011-04-13 16:07 philby john
  2011-04-13 17:38 ` David Daney
  0 siblings, 1 reply; 13+ messages in thread
From: philby john @ 2011-04-13 16:07 UTC (permalink / raw)
  To: linux-mips; +Cc: David Daney

From: Philby John <pjohn@mvista.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: 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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH] MIPS: Octeon: add option to ignore PT_NOTE section
  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
                     ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: David Daney @ 2011-04-13 17:38 UTC (permalink / raw)
  To: philby john; +Cc: linux-mips

On 04/13/2011 09:07 AM, philby john wrote:
> From: Philby John<pjohn@mvista.com>

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

Perhaps you should change it to something like:
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: Philby John<pjohn@mvista.com>
> ---

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] MIPS: Octeon: add option to ignore PT_NOTE section
  2011-04-13 17:38 ` David Daney
@ 2011-04-14 17:54   ` philby john
  2011-04-14 17:56   ` philby john
  2011-04-15  8:24   ` Florian Fainelli
  2 siblings, 0 replies; 13+ messages in thread
From: philby john @ 2011-04-14 17:54 UTC (permalink / raw)
  To: David Daney; +Cc: linux-mips

On Wed, 2011-04-13 at 10:38 -0700, David Daney wrote:
> On 04/13/2011 09:07 AM, philby john wrote:
> > From: Philby John<pjohn@mvista.com>
> 
> ^^^^^^^^ 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
> 
> Perhaps you should change it to something like:
> 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: Philby John<pjohn@mvista.com>
> > ---

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] MIPS: Octeon: add option to ignore PT_NOTE section
  2011-04-13 17:38 ` David Daney
  2011-04-14 17:54   ` philby john
@ 2011-04-14 17:56   ` philby john
  2011-04-14 19:41     ` Philby John
  2011-04-15  8:24   ` Florian Fainelli
  2 siblings, 1 reply; 13+ messages in thread
From: philby john @ 2011-04-14 17:56 UTC (permalink / raw)
  To: linux-mips; +Cc: David Daney

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH] MIPS: Octeon: add option to ignore PT_NOTE section
  2011-04-14 17:56   ` philby john
@ 2011-04-14 19:41     ` Philby John
  2011-04-14 20:02       ` David Daney
  0 siblings, 1 reply; 13+ messages in thread
From: Philby John @ 2011-04-14 19:41 UTC (permalink / raw)
  To: linux-mips; +Cc: David Daney

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

On 04/14/2011 11:26 PM, philby john wrote:
> 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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] MIPS: Octeon: add option to ignore PT_NOTE section
  2011-04-14 19:41     ` Philby John
@ 2011-04-14 20:02       ` David Daney
  2011-05-19 10:28         ` Ralf Baechle
  0 siblings, 1 reply; 13+ messages in thread
From: David Daney @ 2011-04-14 20:02 UTC (permalink / raw)
  To: Philby John; +Cc: linux-mips

On 04/14/2011 12:41 PM, Philby John wrote:
> 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
>

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






>   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
>
> On 04/14/2011 11:26 PM, philby john wrote:
>> 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
>
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] MIPS: Octeon: add option to ignore PT_NOTE section
  2011-04-13 17:38 ` David Daney
  2011-04-14 17:54   ` philby john
  2011-04-14 17:56   ` philby john
@ 2011-04-15  8:24   ` Florian Fainelli
  2011-04-15  8:55     ` Philby John
  2 siblings, 1 reply; 13+ messages in thread
From: Florian Fainelli @ 2011-04-15  8:24 UTC (permalink / raw)
  To: David Daney; +Cc: philby john, linux-mips

Hello,

On Wednesday 13 April 2011 19:38:02 David Daney wrote:
> On 04/13/2011 09:07 AM, philby john wrote:
> > From: Philby John<pjohn@mvista.com>
> 
> ^^^^^^^^ I believe that statement to be not entirely correct.
> 
> Perhaps you should change it to something like:
> 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.

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] MIPS: Octeon: add option to ignore PT_NOTE section
  2011-04-15  8:24   ` Florian Fainelli
@ 2011-04-15  8:55     ` Philby John
  2011-04-15 16:27       ` David Daney
  0 siblings, 1 reply; 13+ messages in thread
From: Philby John @ 2011-04-15  8:55 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: David Daney, linux-mips

On 04/15/2011 01:54 PM, Florian Fainelli wrote:
> Hello,
> 
> On Wednesday 13 April 2011 19:38:02 David Daney wrote:
>> On 04/13/2011 09:07 AM, philby john wrote:
>>> From: Philby John<pjohn@mvista.com>
>>
>> ^^^^^^^^ I believe that statement to be not entirely correct.
>>
>> Perhaps you should change it to something like:
>> 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.
> 
> 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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] MIPS: Octeon: add option to ignore PT_NOTE section
  2011-04-15  8:55     ` Philby John
@ 2011-04-15 16:27       ` David Daney
  2011-04-16 15:21         ` Philby John
  0 siblings, 1 reply; 13+ messages in thread
From: David Daney @ 2011-04-15 16:27 UTC (permalink / raw)
  To: Philby John; +Cc: Florian Fainelli, linux-mips

On 04/15/2011 01:55 AM, Philby John wrote:
> On 04/15/2011 01:54 PM, Florian Fainelli wrote:
>> Hello,
>>
>> On Wednesday 13 April 2011 19:38:02 David Daney wrote:
>>> On 04/13/2011 09:07 AM, philby john wrote:
>>>> From: Philby John<pjohn@mvista.com>
>>>
>>> ^^^^^^^^ I believe that statement to be not entirely correct.
>>>
>>> Perhaps you should change it to something like:
>>> 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.
>>
>> 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.
>

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] MIPS: Octeon: add option to ignore PT_NOTE section
  2011-04-15 16:27       ` David Daney
@ 2011-04-16 15:21         ` Philby John
  2011-04-16 15:51           ` Florian Fainelli
  0 siblings, 1 reply; 13+ messages in thread
From: Philby John @ 2011-04-16 15:21 UTC (permalink / raw)
  To: David Daney; +Cc: Florian Fainelli, linux-mips

On 04/15/2011 09:57 PM, David Daney wrote:
> On 04/15/2011 01:55 AM, Philby John wrote:
>> On 04/15/2011 01:54 PM, Florian Fainelli wrote:
>>> Hello,
>>>
>>> On Wednesday 13 April 2011 19:38:02 David Daney wrote:
>>>> On 04/13/2011 09:07 AM, philby john wrote:
>>>>> From: Philby John<pjohn@mvista.com>
>>>>
>>>> ^^^^^^^^ I believe that statement to be not entirely correct.
>>>>
>>>> Perhaps you should change it to something like:
>>>> 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.
>>>
>>> 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.
>>
> 
> 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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] MIPS: Octeon: add option to ignore PT_NOTE section
  2011-04-16 15:21         ` Philby John
@ 2011-04-16 15:51           ` Florian Fainelli
  2011-04-17  5:16             ` Philby John
  0 siblings, 1 reply; 13+ messages in thread
From: Florian Fainelli @ 2011-04-16 15:51 UTC (permalink / raw)
  To: Philby John; +Cc: David Daney, linux-mips

Hello,

Le 16/04/2011 17:21, Philby John a écrit :
> On 04/15/2011 09:57 PM, David Daney wrote:
>> On 04/15/2011 01:55 AM, Philby John wrote:
>>> On 04/15/2011 01:54 PM, Florian Fainelli wrote:
>>>> Hello,
>>>>
>>>> On Wednesday 13 April 2011 19:38:02 David Daney wrote:
>>>>> On 04/13/2011 09:07 AM, philby john wrote:
>>>>>> From: Philby John<pjohn@mvista.com>
>>>>>
>>>>> ^^^^^^^^ I believe that statement to be not entirely correct.
>>>>>
>>>>> Perhaps you should change it to something like:
>>>>> 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.
>>>>
>>>> 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.
>>>
>>
>> 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

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] MIPS: Octeon: add option to ignore PT_NOTE section
  2011-04-16 15:51           ` Florian Fainelli
@ 2011-04-17  5:16             ` Philby John
  0 siblings, 0 replies; 13+ messages in thread
From: Philby John @ 2011-04-17  5:16 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: David Daney, linux-mips

On 04/16/2011 09:21 PM, Florian Fainelli wrote:
> Hello,
> 
> Le 16/04/2011 17:21, Philby John a écrit :
>> On 04/15/2011 09:57 PM, David Daney wrote:
>>> On 04/15/2011 01:55 AM, Philby John wrote:
>>>> On 04/15/2011 01:54 PM, Florian Fainelli wrote:
>>>>> Hello,
>>>>>
>>>>> On Wednesday 13 April 2011 19:38:02 David Daney wrote:
>>>>>> On 04/13/2011 09:07 AM, philby john wrote:
>>>>>>> From: Philby John<pjohn@mvista.com>
>>>>>>
>>>>>> ^^^^^^^^ I believe that statement to be not entirely correct.
>>>>>>
>>>>>> Perhaps you should change it to something like:
>>>>>> 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.
>>>>>
>>>>> 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.
>>>>
>>>
>>> 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
> 
> 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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] MIPS: Octeon: add option to ignore PT_NOTE section
  2011-04-14 20:02       ` David Daney
@ 2011-05-19 10:28         ` Ralf Baechle
  0 siblings, 0 replies; 13+ messages in thread
From: Ralf Baechle @ 2011-05-19 10:28 UTC (permalink / raw)
  To: David Daney; +Cc: Philby John, linux-mips

On Thu, Apr 14, 2011 at 01:02:22PM -0700, David Daney wrote:

> 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

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2011-05-19 10:29 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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.