1KEXEC_LOAD(2) Linux Programmer's Manual KEXEC_LOAD(2)
2
3
4
6 kexec_load - load a new kernel for later execution
7
9 #include <linux/kexec.h>
10 long kexec_load(unsigned long entry, unsigned long nr_segments,
11 struct kexec_segment *segments, unsigned long flags);
12
13 Note: There is no glibc wrapper for this system call; see NOTES.
14
16 The kexec_load() system call loads a new kernel that can be executed
17 later by reboot(2).
18
19 The flags argument is a mask whose high-order bits control the opera‐
20 tion of the call. The following values can be specified in flags:
21
22 KEXEC_ON_CRASH (since Linux 2.6.13)
23 Execute the new kernel automatically on a system crash.
24
25 KEXEC_PRESERVE_CONTEXT (since Linux 2.6.27)
26 Preserve the system hardware and software states before execut‐
27 ing the new kernel. This could be used for system suspend.
28 This flag is available only if the kernel was configured with
29 CONFIG_KEXEC_JUMP, and is effective only if nr_segments is
30 greater than 0.
31
32 The low-order bits of flags contain the architecture of the to-be-exe‐
33 cuted kernel. Specify (OR) the constant KEXEC_ARCH_DEFAULT to use the
34 current architecture, or one of the following architecture constants
35 KEXEC_ARCH_386, KEXEC_ARCH_X86_64, KEXEC_ARCH_PPC, KEXEC_ARCH_PPC64,
36 KEXEC_ARCH_IA_64, KEXEC_ARCH_ARM, KEXEC_ARCH_S390, KEXEC_ARCH_SH,
37 KEXEC_ARCH_MIPS, and KEXEC_ARCH_MIPS_LE. The architecture must be exe‐
38 cutable on the CPU of the system.
39
40 The entry argument is the physical entry address in the kernel image.
41 The nr_segments argument is the number of segments pointed to by the
42 segments pointer. The segments argument is an array of kexec_segment
43 structures which define the kernel layout:
44
45 struct kexec_segment {
46 void *buf; /* Buffer in user space */
47 size_t bufsz; /* Buffer length in user space */
48 void *mem; /* Physical address of kernel */
49 size_t memsz; /* Physical address length */
50 };
51
52 The kernel image defined by segments is copied from the calling process
53 into previously reserved memory.
54
56 On success, kexec_load() returns 0. On error, -1 is returned and errno
57 is set to indicate the error.
58
60 EBUSY Another crash kernel is already being loaded or a crash kernel
61 is already in use.
62
63 EINVAL flags is invalid; or nr_segments is too large
64
65 EPERM The caller does not have the CAP_SYS_BOOT capability.
66
68 The kexec_load() system call first appeared in Linux 2.6.13.
69
71 This system call is Linux-specific.
72
74 Currently, there is no glibc support for kexec_load(). Call it using
75 syscall(2).
76
77 The required constants are in the Linux kernel source file
78 linux/kexec.h, which is not currently exported to glibc. Therefore,
79 these constants must be defined manually.
80
81 This system call is available only if the kernel was configured with
82 CONFIG_KEXEC.
83
85 reboot(2), syscall(2)
86
88 This page is part of release 3.53 of the Linux man-pages project. A
89 description of the project, and information about reporting bugs, can
90 be found at http://www.kernel.org/doc/man-pages/.
91
92
93
94Linux 2012-07-13 KEXEC_LOAD(2)