Skip to contentSkip to conversation

kexec: kexec-generic

PATCH In review Eric W. Biederman 1 participant 1 message Aug 20, 2004 kexec

lore
Share & tools
lore
#0 lore raw

PATCH 8/14 kexec: kexec-generic

Here is the architecture independent part of kexec.

MAINTAINERS +11 -0
diff -uNr linux-2.6.8.1-mm2-e820-64bit.x86_64/MAINTAINERS linux-2.6.8.1-mm2-kexec-generic/MAINTAINERS
@@ -1244,6 +1244,17 @@
 W:	http://www.cse.unsw.edu.au/~neilb/patches/linux-devel/
 S:	Maintained
 
+KEXEC
+P:	Eric Biederman
+P:	Randy Dunlap
+M:	[email protected]
+M:	[email protected]
+W:	http://www.xmission.com/~ebiederm/files/kexec/
+W:	http://developer.osdl.org/rddunlap/kexec/
+L:	[email protected]
+L:	[email protected]
+S:	Maintained
+
 LANMEDIA WAN CARD DRIVER
 P:	Andrew Stanley-Jones
 M:	[email protected]
include/linux/kexec.h +56 -0

56 lines not on this page · raw message

include/linux/reboot.h +2 -0
diff -uNr linux-2.6.8.1-mm2-e820-64bit.x86_64/include/linux/reboot.h linux-2.6.8.1-mm2-kexec-generic/include/linux/reboot.h
@@ -51,6 +51,8 @@
 extern void machine_halt(void);
 extern void machine_power_off(void);
 
+extern void machine_shutdown(void);
+
 #endif
 
 #endif /* _LINUX_REBOOT_H */
kernel/Makefile +1 -0
diff -uNr linux-2.6.8.1-mm2-e820-64bit.x86_64/kernel/Makefile linux-2.6.8.1-mm2-kexec-generic/kernel/Makefile
@@ -18,6 +18,7 @@
 obj-$(CONFIG_KALLSYMS) += kallsyms.o
 obj-$(CONFIG_PM) += power/
 obj-$(CONFIG_BSD_PROCESS_ACCT) += acct.o
+obj-$(CONFIG_KEXEC) += kexec.o
 obj-$(CONFIG_COMPAT) += compat.o
 obj-$(CONFIG_IKCONFIG) += configs.o
 obj-$(CONFIG_IKCONFIG_PROC) += configs.o
kernel/kexec.c +640 -0

640 lines not on this page · raw message

kernel/sys.c +21 -0
diff -uNr linux-2.6.8.1-mm2-e820-64bit.x86_64/kernel/sys.c linux-2.6.8.1-mm2-kexec-generic/kernel/sys.c
@@ -17,6 +17,8 @@
 #include <linux/init.h>
 #include <linux/highuid.h>
 #include <linux/fs.h>
+#include <linux/kernel.h>
+#include <linux/kexec.h>
 #include <linux/workqueue.h>
 #include <linux/device.h>
 #include <linux/times.h>
@@ -225,6 +227,7 @@
 cond_syscall(sys_lookup_dcookie)
 cond_syscall(sys_swapon)
 cond_syscall(sys_swapoff)
+cond_syscall(sys_kexec_load)
 cond_syscall(sys_init_module)
 cond_syscall(sys_delete_module)
 cond_syscall(sys_socketpair)
@@ -510,6 +513,24 @@
 		machine_restart(buffer);
 		break;
 
+#ifdef CONFIG_KEXEC
+	case LINUX_REBOOT_CMD_KEXEC:
+	{
+		struct kimage *image;
+		image = xchg(&kexec_image, 0);
+		if (!image) {
+			unlock_kernel();
+			return -EINVAL;
+		}
+		notifier_call_chain(&reboot_notifier_list, SYS_RESTART, NULL);
+		system_state = SYSTEM_BOOTING;
+		device_shutdown();
+		printk(KERN_EMERG "Starting new kernel\n");
+		machine_shutdown();
+		machine_kexec(image);
+		break;
+	}
+#endif
 #ifdef CONFIG_SOFTWARE_SUSPEND
 	case LINUX_REBOOT_CMD_SW_SUSPEND:
 		{