1 .\" Copyright (C) 2010 Intel Corporation, Author: Andi Kleen
2 .\" and Copyright 2014, Vivek Goyal <vgoyal@redhat.com>
4 .\" %%%LICENSE_START(VERBATIM)
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date. The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein. The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
26 .TH KEXEC_LOAD 2 2014-08-19 "Linux" "Linux Programmer's Manual"
28 kexec_load, kexec_file_load \- load a new kernel for later execution
31 .B #include <linux/kexec.h>
33 .BI "long kexec_load(unsigned long " entry ", unsigned long " nr_segments ","
34 .BI " struct kexec_segment *" segments \
35 ", unsigned long " flags ");"
37 .BI "long kexec_file_load(int " kernel_fd ", int " initrd_fd ","
39 .BI " unsigned long " cmdline_len \
40 ", const char *" cmdline ","
41 .BI " unsigned long " flags ");"
45 There are no glibc wrappers for these system calls; see NOTES.
49 system call loads a new kernel that can be executed later by
54 argument is a bit mask that controls the operation of the call.
55 The following values can be specified in
58 .BR KEXEC_ON_CRASH " (since Linux 2.6.13)"
59 Execute the new kernel automatically on a system crash.
60 .\" FIXME Explain in more detail how KEXEC_ON_CRASH is actually used
62 .BR KEXEC_PRESERVE_CONTEXT " (since Linux 2.6.27)"
63 Preserve the system hardware and
64 software states before executing the new kernel.
65 This could be used for system suspend.
66 This flag is available only if the kernel was configured with
67 .BR CONFIG_KEXEC_JUMP ,
68 and is effective only if
72 The high-order bits (corresponding to the mask 0xffff0000) of
74 contain the architecture of the to-be-executed kernel.
75 Specify (OR) the constant
77 to use the current architecture,
78 or one of the following architecture constants
81 .BR KEXEC_ARCH_X86_64 ,
83 .BR KEXEC_ARCH_PPC64 ,
84 .BR KEXEC_ARCH_IA_64 ,
90 .BR KEXEC_ARCH_MIPS_LE .
91 The architecture must be executable on the CPU of the system.
95 argument is the physical entry address in the kernel image.
98 argument is the number of segments pointed to by the
101 the kernel imposes an (arbitrary) limit of 16 on the number of segments.
104 argument is an array of
106 structures which define the kernel layout:
110 struct kexec_segment {
111 void *buf; /* Buffer in user space */
112 size_t bufsz; /* Buffer length in user space */
113 void *mem; /* Physical address of kernel */
114 size_t memsz; /* Physical address length */
119 .\" FIXME Explain the details of how the kernel image defined by segments
120 .\" is copied from the calling process into previously reserved memory.
121 The kernel image defined by
123 is copied from the calling process into previously reserved memory.
127 system call is available only if the kernel was configured with
129 .SS kexec_file_load()
131 .BR kexec_file_load ()
132 system call is similar to
134 but it takes a different set of arguments.
135 It reads the kernel to be loaded from the file referred to by the descriptor
137 and the initrd (initial RAM disk)
138 to be loaded from file referred to by the descriptor
142 argument is a pointer to a string containing the command line
143 for the new kernel; the
145 argument specifies the length of the string in
150 argument is a bit mask which modifies the behavior of the call.
151 The following values can be specified in
154 .BR KEXEC_FILE_UNLOAD
155 Unload the currently loaded kernel.
157 .BR KEXEC_FILE_ON_CRASH
158 Load the new kernel in the memory region reserved for the crash kernel.
159 This kernel is booted if the currently running kernel crashes.
161 .BR KEXEC_FILE_NO_INITRAMFS
162 Loading initrd/initramfs is optional.
163 Specify this flag if no initramfs is being loaded.
164 If this flag is set, the value passed in
169 .BR kexec_file_load ()
170 .\" See also http://lwn.net/Articles/603116/
171 system call was added to provide support for systems
172 where "kexec" loading should be restricted to
173 only kernels that are signed.
174 This system call is available only if the kernel was configured with
175 .BR CONFIG_KEXEC_FILE .
177 On success, these system calls returns 0.
178 On error, \-1 is returned and
180 is set to indicate the error.
184 Another crash kernel is already being loaded
185 or a crash kernel is already in use.
192 .\" KEXEC_SEGMENT_MAX == 16
196 does not refer to an open file, or the kernel can't load this file.
199 The caller does not have the
205 system call first appeared in Linux 2.6.13.
207 .BR kexec_file_load ()
208 system call first appeared in Linux 3.17.
210 These system calls are Linux-specific.
212 Currently, there is no glibc support for these system calls.
216 The required constants are in the Linux kernel source file
218 which is not currently exported to glibc.
219 Therefore, these constants must be defined manually.
225 The kernel source files
226 .IR Documentation/kdump/kdump.txt
228 .IR Documentation/kernel-parameters.txt .