Hello Vivek,
* Vivek Goyal <[EMAIL PROTECTED]> [2007-03-06 10:41]:
> > My patch about changing the header in x86_64/i386 was not applied
> > (http://marc.theaimsgroup.com/?l=linux-kernel&m=117138549731788&w=2)
> > although I got positive repsonse from the maintanier (H. Peter Anvin),
> > but he was travelling at that time ...
>
> I think above patch then makes sense. How about posting it again and
> try to get it in. May be this time Peter will like it. To me it makes
> sense. Kernel image should let the bootloader know regarding what
> cmdline size does it support.
I did post it again, now to Andrew so that he takes it in -mm. Can you
maybe Ack the patch? (So far, no repsonse. ;))
> > I'm also not very lucky about the solution to get the size from the
> > ELF symbol table. Maybe a ELF not plus getting the bzImage header
> > applied would be the best compromise. Or do we really want to trust
> > that the kernel that runs has the same command line size as the kernel
> > that is kexec'd to?
>
> We can't assume that running kernel and kernel being kexec'd to are same.
> How about adding an PT_NOTE ELF note to vmlinux image exporting what's the
> size of supported command line? This probably will meet some resistance but
> its worth giving it a try.
I hacked now a first version. Please, I'm not very familar with that
stuff (ELF sections, etc.), so forgive me if it's complete garbage. :)
At least the new information shows up in 'readelf -n' and that's what
I wanted. Patch for i386 and x86_64 is below:
Before I post it on the big linux-kernel list I wanted your opinion
(and the others!) here.
---
For kdump userspace tools it's necessary to know the command line length
of the kernel because the length was changed in 2.6.21 to be able to
warn the user about a too long command line (which frequently happens
when using kdump).
This patch adds an ELF PT_NOTE header that can read out by userspace.
It also adds the version information which could be used by various
scripts (for example the script to create the initial ramdisk) of Linux
distributions.
Signed-off-by: Bernhard Walle <[EMAIL PROTECTED]>
---
arch/i386/kernel/Makefile | 2 +-
arch/i386/kernel/elfinfo.S | 10 ++++++++++
arch/i386/kernel/vsyscall-note.S | 20 ++++----------------
arch/x86_64/kernel/Makefile | 2 +-
arch/x86_64/kernel/elfinfo.S | 11 +++++++++++
include/asm-i386/elf_note.h | 18 ++++++++++++++++++
include/asm-x86_64/elf_note.h | 1 +
7 files changed, 46 insertions(+), 18 deletions(-)
Index: linux-2.6.21-rc3-x86_64/arch/i386/kernel/Makefile
===================================================================
--- linux-2.6.21-rc3-x86_64.orig/arch/i386/kernel/Makefile
+++ linux-2.6.21-rc3-x86_64/arch/i386/kernel/Makefile
@@ -4,7 +4,7 @@
extra-y := head.o init_task.o vmlinux.lds
-obj-y := process.o signal.o entry.o traps.o irq.o \
+obj-y := process.o signal.o entry.o elfinfo.o traps.o irq.o \
ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_i386.o \
pci-dma.o i386_ksyms.o i387.o bootflag.o e820.o\
quirks.o i8237.o topology.o alternative.o i8253.o tsc.o
Index: linux-2.6.21-rc3-x86_64/arch/i386/kernel/elfinfo.S
===================================================================
--- /dev/null
+++ linux-2.6.21-rc3-x86_64/arch/i386/kernel/elfinfo.S
@@ -0,0 +1,10 @@
+#include <linux/version.h>
+#include <linux/uts.h>
+#include <asm/setup.h>
+#include <asm/elf_note.h>
+
+ASM_ELF_NOTE_BEGIN(".noteinfo.kernelinfo", "a", UTS_SYSNAME, 0)
+.long LINUX_VERSION_CODE /* Linux kernel version */
+.long COMMAND_LINE_SIZE-1 /* size of the command line (excluding zero-
+ termination */
+ASM_ELF_NOTE_END
Index: linux-2.6.21-rc3-x86_64/arch/i386/kernel/vsyscall-note.S
===================================================================
--- linux-2.6.21-rc3-x86_64.orig/arch/i386/kernel/vsyscall-note.S
+++ linux-2.6.21-rc3-x86_64/arch/i386/kernel/vsyscall-note.S
@@ -5,21 +5,9 @@
#include <linux/uts.h>
#include <linux/version.h>
+#include <asm/elf_note.h>
-#define ASM_ELF_NOTE_BEGIN(name, flags, vendor, type) \
- .section name, flags; \
- .balign 4; \
- .long 1f - 0f; /* name length */ \
- .long 3f - 2f; /* data length */ \
- .long type; /* note type */ \
-0: .asciz vendor; /* vendor name */ \
-1: .balign 4; \
-2:
-#define ASM_ELF_NOTE_END \
-3: .balign 4; /* pad out section */ \
- .previous
-
- ASM_ELF_NOTE_BEGIN(".note.kernel-version", "a", UTS_SYSNAME, 0)
- .long LINUX_VERSION_CODE
- ASM_ELF_NOTE_END
+ASM_ELF_NOTE_BEGIN(".note.kernel-version", "a", UTS_SYSNAME, 0)
+.long LINUX_VERSION_CODE
+ASM_ELF_NOTE_END
Index: linux-2.6.21-rc3-x86_64/arch/x86_64/kernel/elfinfo.S
===================================================================
--- /dev/null
+++ linux-2.6.21-rc3-x86_64/arch/x86_64/kernel/elfinfo.S
@@ -0,0 +1,11 @@
+#include <linux/version.h>
+#include <linux/uts.h>
+#include <asm/setup.h>
+#include <asm/elf_note.h>
+
+ASM_ELF_NOTE_BEGIN(".noteinfo.kernelinfo", "a", UTS_SYSNAME, 0)
+.long LINUX_VERSION_CODE /* Linux kernel version */
+.long COMMAND_LINE_SIZE-1 /* size of the command line (excluding zero-
+ termination */
+ASM_ELF_NOTE_END
+
Index: linux-2.6.21-rc3-x86_64/include/asm-i386/elf_note.h
===================================================================
--- /dev/null
+++ linux-2.6.21-rc3-x86_64/include/asm-i386/elf_note.h
@@ -0,0 +1,18 @@
+/*
+ * Macros to generate ELF notes
+ */
+
+
+#define ASM_ELF_NOTE_BEGIN(name, flags, vendor, type) \
+ .section name, flags; \
+ .balign 4; \
+ .long 1f - 0f; /* name length */ \
+ .long 3f - 2f; /* data length */ \
+ .long type; /* note type */ \
+0: .asciz vendor; /* vendor name */ \
+1: .balign 4; \
+2:
+
+#define ASM_ELF_NOTE_END \
+3: .balign 4; /* pad out section */ \
+ .previous
Index: linux-2.6.21-rc3-x86_64/include/asm-x86_64/elf_note.h
===================================================================
--- /dev/null
+++ linux-2.6.21-rc3-x86_64/include/asm-x86_64/elf_note.h
@@ -0,0 +1 @@
+#include "../asm-i386/elf_note.h"
Index: linux-2.6.21-rc3-x86_64/arch/x86_64/kernel/Makefile
===================================================================
--- linux-2.6.21-rc3-x86_64.orig/arch/x86_64/kernel/Makefile
+++ linux-2.6.21-rc3-x86_64/arch/x86_64/kernel/Makefile
@@ -4,7 +4,7 @@
extra-y := head.o head64.o init_task.o vmlinux.lds
EXTRA_AFLAGS := -traditional
-obj-y := process.o signal.o entry.o traps.o irq.o \
+obj-y := process.o signal.o entry.o elfinfo.o traps.o irq.o \
ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_x86_64.o \
x8664_ksyms.o i387.o syscall.o vsyscall.o \
setup64.o bootflag.o e820.o reboot.o quirks.o i8237.o \
_______________________________________________
fastboot mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/fastboot