]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/kexec_load.2
intro.1, _exit.2, access.2, alarm.2, alloc_hugepages.2, arch_prctl.2, bind.2, chdir...
[thirdparty/man-pages.git] / man2 / kexec_load.2
CommitLineData
32318739
MK
1.\" Copyright (C) 2010 Intel Corporation
2.\" Author: Andi Kleen
e4f282ab 3.\"
4b72fb64 4.\" %%%LICENSE_START(verbatim)
e4f282ab
MK
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.
8.\"
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.
13.\"
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
20.\" professionally.
21.\"
22.\" Formatted or processed versions of this manual, if unaccompanied by
23.\" the source, must acknowledge the copyright and authors of this work.
4b72fb64 24.\" %%%LICENSE_END
45c99e3e 25.TH KEXEC_LOAD 2 2012-07-13 "Linux" "Linux Programmer's Manual"
0bd8e0bf 26.SH NAME
ece948b4 27kexec_load \- load a new kernel for later execution
0bd8e0bf 28.SH SYNOPSIS
ce06aee2 29.B #include <linux/kexec.h>
0bd8e0bf
AK
30.br
31.BI "long kexec_load(unsigned long " entry ", unsigned long " nr_segments ","
32.br
ece948b4
MK
33.BI " struct kexec_segment *" segments \
34", unsigned long " flags ");"
45c99e3e
MK
35
36.IR Note :
37There is no glibc wrapper for this system call; see NOTES.
0bd8e0bf 38.SH DESCRIPTION
ece948b4
MK
39The
40.BR kexec_load ()
41system call loads a new kernel that can be executed later by
531bc088 42.BR reboot (2).
ece948b4
MK
43.PP
44The
0bd8e0bf 45.I flags
ece948b4
MK
46argument is a mask whose high-order bits control the operation of the call.
47The following values can be specified in
48.IR flags :
49.TP
dc3df548 50.BR KEXEC_ON_CRASH " (since Linux 2.6.13)"
ece948b4
MK
51Execute the new kernel automatically on a system crash.
52.\" FIXME figure out how this is really used
53.TP
50cebc04 54.BR KEXEC_PRESERVE_CONTEXT " (since Linux 2.6.27)"
ece948b4
MK
55Preserve the system hardware and
56software states before executing the new kernel.
57This could be used for system suspend.
58This flag is only available if the kernel was configured with
59.BR CONFIG_KEXEC_JUMP ,
60and is only effective if
61.I nr_segments
62is greater than 0.
63.PP
64The low-order bits of
0bd8e0bf 65.I flags
ece948b4
MK
66contain the architecture of the to-be-executed kernel.
67Specify (OR) the constant
68.B KEXEC_ARCH_DEFAULT
69to use the current architecture,
70or one of the following architecture constants
71.BR KEXEC_ARCH_386 ,
72.BR KEXEC_ARCH_X86_64 ,
73.BR KEXEC_ARCH_PPC ,
74.BR KEXEC_ARCH_PPC64 ,
75.BR KEXEC_ARCH_IA_64 ,
76.BR KEXEC_ARCH_ARM ,
77.BR KEXEC_ARCH_S390 ,
78.BR KEXEC_ARCH_SH ,
79.BR KEXEC_ARCH_MIPS ,
80and
81.BR KEXEC_ARCH_MIPS_LE .
0bd8e0bf
AK
82The architecture must be executable on the CPU of the system.
83
ece948b4
MK
84The
85.I entry
02a4b9e9 86argument is the physical entry address in the kernel image.
ece948b4 87The
0bd8e0bf 88.I nr_segments
ece948b4 89argument is the number of segments pointed to by the
0bd8e0bf 90.I segments
ece948b4
MK
91pointer.
92The
93.I segments
94argument is an array of
95.I kexec_segment
0bd8e0bf
AK
96structures which define the kernel layout:
97.in +4n
98.nf
99
100struct kexec_segment {
ece948b4
MK
101 void *buf; /* Buffer in user space */
102 size_t bufsz; /* Buffer length in user space */
02a4b9e9
MK
103 void *mem; /* Physical address of kernel */
104 size_t memsz; /* Physical address length */
0bd8e0bf
AK
105};
106.fi
107.in
108.PP
ece948b4 109.\" FIXME elaborate on the following:
0bd8e0bf
AK
110The kernel image defined by
111.I segments
112is copied from the calling process into previously reserved memory.
ece948b4
MK
113.SH RETURN VALUE
114On success,
115.BR kexec_load ()
116returns 0.
c3074d70 117On error, \-1 is returned and
ece948b4
MK
118.I errno
119is set to indicate the error.
120.SH ERRORS
121.TP
122.B EBUSY
123Another crash kernel is already being loaded
124or a crash kernel is already in use.
125.TP
126.B EINVAL
127.I flags
531bc088
DB
128is invalid; or
129.IR nr_segments
130is too large
ece948b4
MK
131.\" KEXEC_SEGMENT_MAX == 16
132.TP
133.B EPERM
134The caller does not have the
135.BR CAP_SYS_BOOT
136capability.
2a09a261
MK
137.SH VERSIONS
138The
139.BR kexec_load ()
53bdbeec 140system call first appeared in Linux 2.6.13.
d1e833fe
MK
141.SH CONFORMING TO
142This system call is Linux-specific.
0bd8e0bf 143.SH NOTES
ece948b4
MK
144Currently, there is no glibc support for
145.BR kexec_load ().
146Call it using
147.BR syscall (2).
0bd8e0bf 148.PP
66a9882e 149The required constants are in the Linux kernel source file
ece948b4
MK
150.IR linux/kexec.h ,
151which is not currently exported to glibc.
152.\" FIXME Andi submitted a patch for this.
153.\" Check if it got accepted later.
154Therefore, these constants must be defined manually.
577dd8b1
MK
155
156This system call is only available if the kernel was configured with
157.BR CONFIG_KEXEC .
0bd8e0bf 158.SH SEE ALSO
3e5c319e
MK
159.BR reboot (2),
160.BR syscall (2)