1 .\" Copyright (C) 2010 Intel Corporation
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
30 .B #include <linux/kexec.h>
33 .BI "long kexec_load(unsigned long " entry ", unsigned long " nr_segments ","
35 .BI " struct kexec_segment *" segments \
36 ", unsigned long " flags ");"
39 .BI "int kexec_file_load(int " kernel_fd ", int " initrd_fd ","
41 .BI " unsigned long " cmdline_len \
42 ", const char *" cmdline ","
44 .BI " unsigned long " flags ");"
47 There are no glibc wrappers for these system calls; see NOTES.
51 system call loads a new kernel that can be executed later by
56 argument is a bit mask that controls the operation of the call.
57 The following values can be specified in
60 .BR KEXEC_ON_CRASH " (since Linux 2.6.13)"
61 Execute the new kernel automatically on a system crash.
62 .\" FIXME Explain in more detail how KEXEC_ON_CRASH is actually used
64 .BR KEXEC_PRESERVE_CONTEXT " (since Linux 2.6.27)"
65 Preserve the system hardware and
66 software states before executing the new kernel.
67 This could be used for system suspend.
68 This flag is available only if the kernel was configured with
69 .BR CONFIG_KEXEC_JUMP ,
70 and is effective only if
74 The high-order bits (corresponding to the mask 0xffff0000) of
76 contain the architecture of the to-be-executed kernel.
77 Specify (OR) the constant
79 to use the current architecture,
80 or one of the following architecture constants
83 .BR KEXEC_ARCH_X86_64 ,
85 .BR KEXEC_ARCH_PPC64 ,
86 .BR KEXEC_ARCH_IA_64 ,
92 .BR KEXEC_ARCH_MIPS_LE .
93 The architecture must be executable on the CPU of the system.
97 argument is the physical entry address in the kernel image.
100 argument is the number of segments pointed to by the
103 the kernel imposes an (arbitrary) limit of 16 on the number of segments.
106 argument is an array of
108 structures which define the kernel layout:
112 struct kexec_segment {
113 void *buf; /* Buffer in user space */
114 size_t bufsz; /* Buffer length in user space */
115 void *mem; /* Physical address of kernel */
116 size_t memsz; /* Physical address length */
121 .\" FIXME Explain the details of how the kernel image defined by segments
122 .\" is copied from the calling process into previously reserved memory.
123 The kernel image defined by
125 is copied from the calling process into previously reserved memory.
126 .SS kexec_file_load()
128 .BR kexec_file_load ()
129 system call is similar to
131 but it takes a different set of arguments.
132 It reads the kernel to be loaded from the file referred to by the descriptor
134 and the initrd to be loaded from file referred to by the descriptor
136 It also takes the length of the kernel command line in
138 and a pointer to the command line in
143 argument is a bit mask which modifies the behavior of the call.
144 The following values can be specified in
147 .BR KEXEC_FILE_UNLOAD
148 Unload the currently loaded kernel.
150 .BR KEXEC_FILE_ON_CRASH
151 Load the new kernel in the memory region reserved for the crash kernel.
152 This kernel is booted if the currently running kernel crashes.
154 .BR KEXEC_FILE_NO_INITRAMFS
155 Loading initrd/initramfs is optional.
156 Specify this flag if no initramfs is being loaded.
157 If this flag is set, the value passed in
161 On success, these system calls returns 0.
162 On error, \-1 is returned and
164 is set to indicate the error.
168 Another crash kernel is already being loaded
169 or a crash kernel is already in use.
176 .\" KEXEC_SEGMENT_MAX == 16
180 does not refer to an open file, or the kernel can't load this file.
183 The caller does not have the
189 system call first appeared in Linux 2.6.13.
191 This system call is Linux-specific.
193 Currently, there is no glibc support for these system calls.
197 The required constants are in the Linux kernel source file
199 which is not currently exported to glibc.
200 .\" FIXME . Andi submitted a patch for this.
201 .\" Check if it got accepted later.
202 Therefore, these constants must be defined manually.
204 This system call is available only if the kernel was configured with