Kexec: where does the kernel image get relocated?
Eric W. Biederman
ebiederm at xmission.com
Wed Jun 13 12:54:04 EDT 2012
Ben Shelton <beshelto at vt.edu> writes:
> 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 addresses are specified in the kexec_load system call.
If the kernel doesn't like those addresses it might move itself as Cong
Wang mentioned.
/sbin/kexec looks at the headers of the kernel image and either use
where the kernel is required to be loaded by the boot protocol or if the
image is relocatable an available extent of memory that is supported by
the boot protocol is picked.
Eric
More information about the kexec
mailing list