Skip to contentSkip to conversation

Retrieve elfcorehdr address from command line

PATCH In review Vivek Goyal 1 participant 1 message Mar 28, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 13/17 Retrieve elfcorehdr address from command line

From: "Vivek Goyal" <[email protected]>

o This patch adds support for retrieving the address of elf core header if one is passed in command line.

---

 linux-2.6.12-rc1-mm1-1M-root/Documentation/kernel-parameters.txt |    4 ++++
 linux-2.6.12-rc1-mm1-1M-root/arch/i386/kernel/setup.c            |    8 ++++++++
 linux-2.6.12-rc1-mm1-1M-root/include/linux/crash_dump.h          |    1 +
 linux-2.6.12-rc1-mm1-1M-root/kernel/crash_dump.c                 |    3 +++
 4 files changed, 16 insertions(+)
arch/i386/kernel/setup.c renamed from arch/i386/kernel/setup.c~crashdump-x86-retrieve-elfcorehdr-addr +8 -0
diff -puN arch/i386/kernel/setup.c~crashdump-x86-retrieve-elfcorehdr-addr arch/i386/kernel/setup.c
@@ -42,6 +42,7 @@
 #include <linux/edd.h>
 #include <linux/nodemask.h>
 #include <linux/kexec.h>
+#include <linux/crash_dump.h>
 
 #include <video/edid.h>
 
@@ -860,6 +861,13 @@ static void __init parse_cmdline_early (
 			}
 		}
 #endif
+#ifdef CONFIG_CRASH_DUMP
+		/* elfcorehdr= specifies the location of elf core header
+		 * stored by the crashed kernel.
+		 */
+		else if (!memcmp(from, "elfcorehdr=", 11))
+			elfcorehdr_addr = memparse(from+11, &from);
+#endif
 
 		/*
 		 * highmem=size forces highmem to be exactly 'size' bytes.
Documentation/kernel-parameters.txt renamed from Documentation/kernel-parameters.txt~crashdump-x86-retrieve-elfcorehdr-addr +4 -0
diff -puN Documentation/kernel-parameters.txt~crashdump-x86-retrieve-elfcorehdr-addr Documentation/kernel-parameters.txt
@@ -455,6 +455,10 @@ running once the system is up.
 			Format: {"as"|"cfq"|"deadline"|"noop"}
 			See Documentation/block/as-iosched.txt
 			and Documentation/block/deadline-iosched.txt for details.
+	elfcorehdr=	[IA-32]
+			Specifies physical address of start of kernel core image
+			elf header.
+			See Documentation/kdump.txt for details.
 
 	enforcing	[SELINUX] Set initial enforcing status.
 			Format: {"0" | "1"}
include/linux/crash_dump.h renamed from include/linux/crash_dump.h~crashdump-x86-retrieve-elfcorehdr-addr +1 -0
diff -puN include/linux/crash_dump.h~crashdump-x86-retrieve-elfcorehdr-addr include/linux/crash_dump.h
@@ -7,6 +7,7 @@
 #include <linux/device.h>
 #include <linux/proc_fs.h>
 
+extern unsigned long long elfcorehdr_addr;
 extern ssize_t copy_oldmem_page(unsigned long, char *, size_t,
 						unsigned long, int);
 #endif /* CONFIG_CRASH_DUMP */
kernel/crash_dump.c renamed from kernel/crash_dump.c~crashdump-x86-retrieve-elfcorehdr-addr +3 -0
diff -puN kernel/crash_dump.c~crashdump-x86-retrieve-elfcorehdr-addr kernel/crash_dump.c
@@ -15,6 +15,9 @@
 #include <asm/io.h>
 #include <asm/uaccess.h>
 
+/* Stores the physical address of elf header of crash image. */
+unsigned long long elfcorehdr_addr;
+
 /*
  * Copy a page from "oldmem". For this page, there is no pte mapped
  * in the current kernel. We stitch up a pte, similar to kmap_atomic.

_