]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man2/kexec_load.2
kexec_load.2: New page documenting kexec_load(2)
[thirdparty/man-pages.git] / man2 / kexec_load.2
1 .TH KEXEC_LOAD 2 2010-06-16 "Linux" "Linux Programmer's Manual"
2 .SH NAME
3 kexec_load \- Load a new kernel for later execution.
4 .SH SYNOPSIS
5 .b #include <linux/kexec.h>
6 .br
7 .BI "long kexec_load(unsigned long " entry ", unsigned long " nr_segments ","
8 .br
9 .BI "struct kexec_segment *" segments ", unsigned long " flags ");"
10 .SH DESCRIPTION
11 .BR kexec_load
12 loads a new kernel that can be executed later
13 by
14 .I reboot(2).
15 An alternative approach is to specify
16 .B KEXEC_ON_CRASH
17 in the
18 .I flags
19 argument and then the new kernel will be automatically executed on a
20 system crash.
21 .\" XXX figure out how this is really used
22 With
23 .B KEXEC_PRESERVE_CONTEXT
24 specified in
25 .I flags
26 kexec will preserve the system hard and
27 software state before executing the kexec kernel. This
28 could be used for system suspend.
29
30 .I flags
31 also contains the architecture of the executed kernel or
32 be
33 .I KEXEC_ARCH_DEFAULT
34 for the current architecture.
35 Valid architectures are
36 .I KEXEC_ARCH_I386,
37 .I KEXEC_ARCH_X86_64,
38 .I KEXEC_ARCH_PPC,
39 .I KEXEC_ARCH_PPC64,
40 .I KEXEC_ARCH_IA_64,
41 .I KEXEC_ARCH_ARM,
42 .I KEXEC_ARCH_S390,
43 .I KEXEC_ARCH_SH,
44 .I KEXEC_ARCH_MIPS,
45 .I KEXEC_ARCH_MIPS_LE.
46 The architecture must be executable on the CPU of the system.
47
48 .I entry
49 is the virtual entry address in the kernel image.
50 .I nr_segments
51 is the number of segments pointed to by the
52 .I segments
53 pointer.
54 .I segments
55 is an array of
56 .I struct kexec_segment
57 structures which define the kernel layout:
58 .in +4n
59 .nf
60
61 struct kexec_segment {
62 void *buf; /* Buffer in user space */
63 size_t bufsz; /* Buffer length in user space */
64 void *mem; /* Virtual address of kernel */
65 size_t memsz; /* Virtual address length */
66 };
67 .fi
68 .in
69 .PP
70 .\" XXX elaborate on this
71 The kernel image defined by
72 .I segments
73 is copied from the calling process into previously reserved memory.
74 .SH CONFORMING TO
75 This system call is Linux-specific.
76 .SH NOTES
77 kexec_load is currently not defined in glibc. To call it use:
78 .in +4n
79 .nf
80 #define _GNU_SOURCE
81 #include <syscall.h>
82 #include <asm/unistd.h>
83 #include <linux/kexec.h>
84
85 ret = syscall(__NR_kexec_load, entry, nr_segments, segments, flags);
86 .fi
87 .in
88 .PP
89 .I linux/kexec.h as a exported header is only available in 2.6.38
90 and later kernels, in earlier kernels the constants need to be copied
91 out of the kernel source.
92 .SH SEE ALSO
93 .BR syscall (2),
94 .BR reboot (2)