Kexec: where does the kernel image get relocated?
xiyou.wangcong at gmail.com
Tue Jun 12 22:21:34 EDT 2012
On Thu, 07 Jun 2012 at 22:47 GMT, Ben Shelton <beshelto at vt.edu> wrote:
> Hi all,
> I'm working on a distributed-computing project where we'd like to boot multiple instances of the Linux kernel on the same machine. We'd like to leverage kexec to decompress each guest kernel and copy it to an area within the physical address space.
> From following through the code and using GDB/QEMU, it seems like the steps to reboot with kexec look like this:
> - Decompress the kernel somewhere (not necessarily contiguous)
> - In relocate_kernel_64.S, copy the kernel to a contiguous space and jump/return to purgatory
> - In purgatory, reinitialize the hardware if necessary, then jump to the start of the kernel
> My issue is that I can't seem to find where the address to which the kernel is copied in step 2 is defined. Can anyone give me a brief description of how this works?
The kernel relocates itself, you can check the code under
#ifdef CONFIG_RELOCATABLE in arch/x86/boot/compressed/head_64.S and
More information about the kexec