4

It's clear that you need the kexec syscalls in the 'first' kernel. But does the kernel that should get loaded (with kexec_load and reboot) need to be compiled with kexec?

If yes, what extra code needs to get executed inside the kernel to do a kexec boot instead of a normal boot?

Uroc327
  • 245
  • 1
  • 4
  • 9
  • Worth noting that when `--reuse-cmdline` arg is used to `/usr/bin/kexec`, `man kexec` says: `Use the command line from the running system. When a panic kernel is loaded, it strips the crashkernel parameter automatically. The BOOT_IMAGE parameter is also stripped.` –  Sep 10 '19 at 11:36

1 Answers1

0

I haven't seen an explicit statement about that and I haven't given it a try but I guess this is not necessary. In addition to my guess the man pages says:

kexec performs the function of the boot loader from within the kernel.

An adaption of the kernel to be loaded would be necessary only if some black magic instead of the boot loader procedure was involved but not if the running kernel does the samle like the boot loader.

Hauke Laging
  • 88,146
  • 18
  • 125
  • 174
  • That's interesting.. Does that mean, I can (theoretically) kexec a completely different kernel like the NT kernel? – Uroc327 Dec 09 '14 at 14:47
  • 1
    @Uroc327 No, that is not going to work because there is no general standard how a kernel must be loaded. There is a standard for Linux kernels which covers both those with and without `kexec` support but the Windows kernel expects to be loaded differently. Thus the Linux boot loaders (Grub) do load Linux and e.g. BSD kernels directly but not Windows kernels. Windows is loaded indirectly by starting ("chain loading") the Windows boot loader (which is not the kernel). I don't think that loading the Windows (or even Linux) boot loader is supported by `kexec`. – Hauke Laging Dec 09 '14 at 15:33