1. NAME

kexec - directly boot into a new kernel

2. SYNOPSIS

/sbin/kexec

[-v (--version)] [-f (--force)] [-x (--no-ifdown)] [-l (--load)] [-p (--load-panic)] [-u (--unload)] [-e (--exec)] [-t (--type)] [--mem-min= addr ] [--mem-max= addr ]

3. DESCRIPTION

kexec is a system call that enables you to load and boot into another kernel from the currently running kernel.

kexec performs the function of the boot loader from within the kernel. The primary difference between a standard system boot and a

kexec boot is that the hardware initialization normally performed by the BIOS or firmware (depending on architecture) is not performed during a

kexec boot. This has the effect of reducing the time required for a reboot.

Make sure you have selected

CONFIG_KEXEC=y when configuring the kernel. The

CONFIG_KEXEC option enables the

kexec system call.

4. USAGE

Using

kexec consists of (1) loading the kernel to be rebooted to into memory, and (2) actually rebooting to the pre-loaded kernel.

To load a kernel, the syntax is as follows:

kexec -l  kernel-image "--append=" command-line-options "--initrd=" initrd-image where kernel-imageis the kernel file that you intend to reboot to.

Insert the command-line parameters that must be passed to the new kernel into command-line-options . Passing the exact contents of /proc/cmdline into command-line-optionsis the safest way to ensure that correct values are passed to the rebooting kernel.

The optional initrd-imageis the initrd image to be used during boot.

It's also possible to invoke

kexec without an option parameter. In that case, kexec loads the specified kernel and then invokes

R shutdown (1). If the shutdown scripts of your Linux distribution support kexec-based rebooting, they then call

kexec -ejust before actually rebooting the machine. That way, the machine does a clean shutdown including all shutdown scripts.

5. EXAMPLE

For example, if the kernel image you want to reboot to is

R /boot/vmlinux , the contents of /proc/cmdline is

R and the path to the initrd is

R /boot/initrd , then you would use the following command to load the kernel:

kexec -l  /boot/vmlinux "--append=" "root=/dev/hda1" " --initrd=" /boot/initrd

After this kernel is loaded, it can be booted to at any time using the command:

R kexec  -e

6. OPTIONS

-e (--exec)

    Run the currently loaded kernel. Note that it calls shutdown (8)

-f (--force)

    Force an immediate

kexec call, do not call

R shutdown (8) (contrary to the default action without any option parameter). This option performs the same actions like executing -l and -e in one call.

-h (--help)

    Open a help file for

R kexec .

  • -l (--load)  kernel
        Load the specified kernelinto the current kernel.

-p (--load-panic)

    Load the new kernel for use on panic.

  • -t (--type= type )
        Specify that the new kernel is of this type.

-u (--unload)

    Unload the current

kexec target kernel. If a capture kernel is being unloaded then specify -p with -u.

-v (--version)

    Return the version number of the installed utility.

-x (--no-ifdown)

    Shut down the running kernel, but restore the interface on reload. (If this option is used, it must be specified last.)

  • --mem-min= addr
        Specify the lowest memory address addrto load code into.
  • --mem-max= addr
        Specify the highest memory address addrto load code into.

7. SUPPORTED KERNEL FILE TYPES AND OPTIONS

Beoboot-x86

--args-elf

    Pass ELF boot notes.

--args-linux

    Pass Linux kernel style options.

-d  (--debug)

    Enable debugging messages.

--real-mode

    Use the kernel's real mode entry point.

elf-x86

  • --append= string
        Append stringto the kernel command line.
  • --command-line= string
        Set the kernel command line to string .
  • --reuse-cmdline
        Use the command line from the running system. When a panic kernel is loaded, it strips the .I crashkernel parameter automatically. The BOOT_IMAGEparameter is also stripped.
  • --initrd= file
        Use fileas the kernel's initial ramdisk.
  • --ramdisk= file
        Use fileas the kernel's initial ramdisk.

bzImage-x86

  • --append= string
        Append stringto the kernel command line.
  • --command-line= string
        Set the kernel command line to string .
  • --reuse-cmdline
        Use the command line from the running system. When a panic kernel is loaded, it strips the .I crashkernel parameter automatically. The BOOT_IMAGEparameter is also stripped.
  • --initrd= file
        Use fileas the kernel's initial ramdisk.
  • --ramdisk= file
        Use fileas the kernel's initial ramdisk.
  • --real-mode
        Use real-mode entry point.

multiboot-x86

  • --command-line= string
        Set the kernel command line to string .
  • --reuse-cmdline
        Use the command line from the running system. When a panic kernel is loaded, it strips the .I crashkernel parameter automatically. The BOOT_IMAGEparameter is also stripped.
  • --module= mod arg1 arg2 ...
        Load module modwith command-line arguments "arg1 arg2 ..."This parameter can be specified multiple times.

8. ARCHITECTURE OPTIONS

--console-serial

    Enable the serial console.

--console-vga

    Enable the VGA console.

--elf32-core-headers

    Prepare core headers in ELF32 format.

--elf64-core-headers

    Prepare core headers in ELF64 format.

--reset-vga

    Attempt to reset a standard VGA device.

  • --serial= port
        Specify the serial portfor debug output.
  • --serial-baud= baud_rate
        Specify the baud rateof the serial port.