MIPS: Octeon: add option to ignore PT_NOTE section
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
@@ -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
@@ -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
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 ignorePT_NOTEsectionSome early Octeon bootloaders cannot process
PT_NOTEprogram 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
Kconfigoption to ignore thePT_NOTEsection.Signed-off-by Philby John<[email protected]>---
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 ignorePT_NOTEsectionSome early Octeon bootloaders cannot process
PT_NOTEprogram 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
Kconfigoption to ignore thePT_NOTEsection.Signed-off-by Philby John<[email protected]>---
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
@@ -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
@@ -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
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 ignorePT_NOTEsectionSome early Octeon bootloaders cannot process
PT_NOTEprogram 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
Kconfigoption to ignore thePT_NOTEsection.Signed-off-by David Daney <[email protected]>Signed-off-by Philby John <[email protected]>--- 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@@ -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_STATICarch/mips/kernel/vmlinux.lds.S +6
-0@@ -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
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 +#endifAnd 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-vmlinuxSo 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_aligned01Where as if one were to remove the
PT_NOTEsection readelf would show ...Elf file type is EXEC (Executable file) Entry point
0xffffffff81105d10
There are 1 program headers, starting at offset 64Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
LOAD0x00000000000100000xffffffff811000000xffffffff811000000x000000000098be00 0x0000000000a00000 RWE 10000Section 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_alignedShouldn't we just follow what strip does?
Regards,
PhilbyQuoted 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 ignorePT_NOTEsectionSome early Octeon bootloaders cannot process
PT_NOTEprogram 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
Kconfigoption to ignore thePT_NOTEsection.Signed-off-by David Daney<[email protected]>Signed-off-by Philby John<[email protected]>--- 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@@ -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_STATICarch/mips/kernel/vmlinux.lds.S +6
-0@@ -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
Quoted 5 lines · David Daney
Can someone with a defective bootloader verify that a zero size
PT_NOTEheader is as good as *no*PT_NOTEheader?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
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 ignorePT_NOTEsectionSome early Octeon bootloaders cannot process
PT_NOTEprogram 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
Kconfigoption to ignore thePT_NOTEsection.
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
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 ignorePT_NOTEsectionSome early Octeon bootloaders cannot process
PT_NOTEprogram 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
Kconfigoption to ignore thePT_NOTEsection.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
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 ignorePT_NOTEsectionSome early Octeon bootloaders cannot process
PT_NOTEprogram 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
Kconfigoption to ignore thePT_NOTEsection.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
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 ignorePT_NOTEsectionSome early Octeon bootloaders cannot process
PT_NOTEprogram 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
Kconfigoption to ignore thePT_NOTEsection.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
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 ignorePT_NOTEsectionSome early Octeon bootloaders cannot process
PT_NOTEprogram 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
Kconfigoption to ignore thePT_NOTEsection.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_NOTEsection. 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
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 ignorePT_NOTEsectionSome early Octeon bootloaders cannot process
PT_NOTEprogram 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
Kconfigoption to ignore thePT_NOTEsection.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_NOTEsection. 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 +#endifstrip 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