1kexec(8) User Manuals kexec(8)
2
3
4
6 kexec - directly boot into a new kernel
7
9 /sbin/kexec [-v (--version)] [-f (--force)] [-x (--no-ifdown)] [-y
10 (--no-sync)] [-l (--load)] [-p (--load-panic)] [-u (--unload)] [-e
11 (--exec)] [-t (--type)] [--mem-min=addr] [--mem-max=addr]
12
13
15 kexec is a system call that enables you to load and boot into another
16 kernel from the currently running kernel. kexec performs the function
17 of the boot loader from within the kernel. The primary difference
18 between a standard system boot and a kexec boot is that the hardware
19 initialization normally performed by the BIOS or firmware (depending on
20 architecture) is not performed during a kexec boot. This has the effect
21 of reducing the time required for a reboot.
22
23 Make sure you have selected CONFIG_KEXEC=y when configuring the kernel.
24 The CONFIG_KEXEC option enables the kexec system call.
25
27 Using kexec consists of
28
29 (1) loading the kernel to be rebooted to into memory, and
30 (2) actually rebooting to the pre-loaded kernel.
31
32 To load a kernel, the syntax is as follows:
33
34 kexec -l kernel-image --append=command-line-options --ini‐
35 trd=initrd-image
36
37 where kernel-image is the kernel file that you intend to reboot to.
38
39 Insert the command-line parameters that must be passed to the new ker‐
40 nel into command-line-options. Passing the exact contents of
41 /proc/cmdline into command-line-options is the safest way to ensure
42 that correct values are passed to the rebooting kernel.
43
44 The optional initrd-image is the initrd image to be used during boot.
45
46 It's also possible to invoke kexec without an option parameter. In that
47 case, kexec loads the specified kernel and then invokes shutdown(8).
48 If the shutdown scripts of your Linux distribution support kexec-based
49 rebooting, they then call kexec -e just before actually rebooting the
50 machine. That way, the machine does a clean shutdown including all
51 shutdown scripts.
52
53
55 For example, if the kernel image you want to reboot to is
56 /boot/vmlinux, the contents of /proc/cmdline is root=/dev/hda1, and the
57 path to the initrd is /boot/initrd, then you would use the following
58 command to load the kernel:
59
60 kexec -l /boot/vmlinux --append=root=/dev/hda1 --ini‐
61 trd=/boot/initrd
62
63 After this kernel is loaded, it can be booted to at any time using the
64 command:
65
66 kexec -e
67
68
70 -d (--debug)
71 Enable debugging messages.
72
73 -S (--status)
74 Return 0 if the type (by default crash) is loaded. Can be used
75 in conjuction with -l or -p to toggle the type. Note this option
76 supersedes other options and it will not load or unload the ker‐
77 nel.
78
79 -e (--exec)
80 Run the currently loaded kernel. Note that it will reboot into
81 the loaded kernel without calling shutdown(8).
82
83 -f (--force)
84 Force an immediate kexec call, do not call shutdown(8) (contrary
85 to the default action without any option parameter). This option
86 performs the same actions like executing -l and -e in one call.
87
88 -h (--help)
89 Open a help file for kexec.
90
91 -l (--load) kernel
92 Load the specified kernel into the current kernel.
93
94 -p (--load-panic)
95 Load the new kernel for use on panic.
96
97 -t (--type=type)
98 Specify that the new kernel is of this type.
99
100 -u (--unload)
101 Unload the current kexec target kernel. If a capture kernel is
102 being unloaded then specify -p with -u.
103
104 -v (--version)
105 Return the version number of the installed utility.
106
107 -x (--no-ifdown)
108 Shut down the running kernel, but restore the interface on
109 reload.
110
111 -y (--no-sync)
112 Shut down the running kernel, but skip syncing the filesystems.
113
114 --mem-min=addr
115 Specify the lowest memory address addr to load code into.
116
117 --mem-max=addr
118 Specify the highest memory address addr to load code into.
119
120 --entry=addr
121 Specify the jump back address. (0 means it's not jump back or
122 preserve context)
123
124 --load-preserve-context
125 Load the new kernel and preserve context of current kernel dur‐
126 ing kexec.
127
128 --load-jump-back-helper
129 Load a helper image to jump back to original kernel.
130
131 --reuseinitrd
132 Reuse initrd from first boot.
133
134 --print-ckr-size
135 Print crash kernel region size, if available.
136
137
138
140 Beoboot-x86
141
142 --args-elf
143 Pass ELF boot notes.
144
145 --args-linux
146 Pass Linux kernel style options.
147
148 --real-mode
149 Use the kernel's real mode entry point.
150
151 elf-x86
152
153 --append=string
154 Append string to the kernel command line.
155
156 --command-line=string
157 Set the kernel command line to string.
158
159 --reuse-cmdline
160 Use the command line from the running system. When a
161 panic kernel is loaded, it strips the crashkernel parame‐
162 ter automatically. The BOOT_IMAGE parameter is also
163 stripped.
164
165 --initrd=file
166 Use file as the kernel's initial ramdisk.
167
168 --ramdisk=file
169 Use file as the kernel's initial ramdisk.
170
171 bzImage-x86
172
173 --append=string
174 Append string to the kernel command line.
175
176 --command-line=string
177 Set the kernel command line to string.
178
179 --reuse-cmdline
180 Use the command line from the running system. When a
181 panic kernel is loaded, it strips the crashkernel parame‐
182 ter automatically. The BOOT_IMAGE parameter is also
183 stripped.
184
185 --initrd=file
186 Use file as the kernel's initial ramdisk.
187
188 --ramdisk=file
189 Use file as the kernel's initial ramdisk.
190
191 --real-mode
192 Use real-mode entry point.
193
194 multiboot-x86
195
196 --command-line=string
197 Set the kernel command line to string.
198
199 --reuse-cmdline
200 Use the command line from the running system. When a
201 panic kernel is loaded, it strips the crashkernel parame‐
202 ter automatically. The BOOT_IMAGE parameter is also
203 stripped.
204
205 --module=mod arg1 arg2 ...
206 Load module mod with command-line arguments arg1 arg2 ...
207 This parameter can be specified multiple times.
208
209
211 --console-serial
212 Enable the serial console.
213
214 --console-vga
215 Enable the VGA console.
216
217 --elf32-core-headers
218 Prepare core headers in ELF32 format.
219
220 --elf64-core-headers
221 Prepare core headers in ELF64 format.
222
223 --reset-vga
224 Attempt to reset a standard VGA device.
225
226 --serial=port
227 Specify the serial port for debug output.
228
229 --serial-baud=baud_rate
230 Specify the baud rate of the serial port.
231
232
233
234Linux April 2006 kexec(8)