[PATCH 018/18] kdb-add-kdump-cmd
[email protected] Thu, 10 Jul 2008 20:58:12 +0000 (UTC)
| Newsgroups | gmane.linux.kernel.debugging |
|---|---|
| Message-ID | <[email protected]> |
Add kdump command to KDB. This command triggers a dump of the kernel via the kexec/kdump mechanism. Author: Jim Houston <[email protected]> Signed-off-by: Joe Korty <[email protected]> Index: 2.6.26-rc9/kdb/modules/Makefile =================================================================== --- 2.6.26-rc9.orig/kdb/modules/Makefile 2008-07-10 12:14:15.000000000 -0400 +++ 2.6.26-rc9/kdb/modules/Makefile 2008-07-10 13:41:59.000000000 -0400 @@ -6,7 +6,7 @@ # Copyright (c) 1999-2006 Silicon Graphics, Inc. All Rights Reserved. # -obj-$(CONFIG_KDB_MODULES) += kdbm_pg.o kdbm_task.o kdbm_vm.o kdbm_sched.o +obj-$(CONFIG_KDB_MODULES) += kdbm_pg.o kdbm_task.o kdbm_vm.o kdbm_sched.o kdbm_kdump.o obj-m += kdbm_debugtypes.o ifdef CONFIG_X86 obj-$(CONFIG_KDB_MODULES) += kdbm_x86.o Index: 2.6.26-rc9/kdb/modules/kdbm_kdump.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ 2.6.26-rc9/kdb/modules/kdbm_kdump.c 2008-07-10 13:40:59.000000000 -0400 @@ -0,0 +1,43 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (c) 2006 Concurrent Computer Corp + */ + +#include <linux/kdb.h> +#include <linux/kdbprivate.h> +#include <linux/module.h> +#include <linux/init.h> +#include <linux/irq.h> +#include <linux/sched.h> +#include <linux/kexec.h> + + +MODULE_AUTHOR("Concurrent Computer Corp"); +MODULE_DESCRIPTION("interface to request kdump crash dump"); +MODULE_LICENSE("GPL"); + +static int +kdbm_kdump(int argc, const char **argv) +{ + kdb_printf("Calling crash_kexec\n"); + crash_kexec(get_irq_regs()); + kdb_printf("crash_kexec failed\n"); + return 0; +} + +static int __init kdbm_kdump_init(void) +{ + kdb_register("kdump", kdbm_kdump, "", "request kdump crash dump", 0); + return 0; +} + +static void __exit kdbm_kdump_exit(void) +{ + kdb_unregister("kdump"); +} + +module_init(kdbm_kdump_init) +module_exit(kdbm_kdump_exit) Index: 2.6.26-rc9/kernel/kexec.c =================================================================== --- 2.6.26-rc9.orig/kernel/kexec.c 2008-07-10 12:12:51.000000000 -0400 +++ 2.6.26-rc9/kernel/kexec.c 2008-07-10 13:40:59.000000000 -0400 @@ -19,6 +19,7 @@ #include <linux/reboot.h> #include <linux/ioport.h> #include <linux/hardirq.h> +#include <linux/module.h> #include <linux/elf.h> #include <linux/elfcore.h> #include <linux/utsrelease.h> @@ -1077,6 +1078,7 @@ BUG_ON(!locked); } } +EXPORT_SYMBOL_GPL(crash_kexec); static u32 *append_elf_note(u32 *buf, char *name, unsigned type, void *data, size_t data_len) --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe.