This is an extremely clunky kernel module in the pre-alpha stage. It doesn't even compile lol. Please make any pull requests to improve this program! (sorry for my horrible commit format, I did this entirely locally before creating this repo. and git would not work on my life)
AMD64 kernels already have the kexec functionality built in. This only exists for cases where
- the kernel has kexec disabled (custom built)
- it cannot be rebuilt
The most notable example of this is shimboot.
Kexec as loadable kernel module for Linux AMD64 kernels based on kexec-mod, which is an ARM64 port.
This loadable kernel module enables users of Linux kernels without built-in Kexec support to still make use of Kexec functionality. For instance, you may use this module to boot to a more recent kernel if you are unable to replace the boot image.
(Due to issues with the code, at the moment it fails to build.) The project is comprised of two parts:
kernel/contains the Linux kernel module that exposes Kexec functionality via/dev/kexec.user/contains a helper library that allows the use of an unpatchedkexec-tools.
Make sure you have installed the necessary packages for building Linux kernel
modules on your system (e.g., make and gcc).
Enter the kernel directory and export the path to the Linux kernel sources
against you wish to build:
cd kernel/Then, build the module using make:
make KDIR=/path/to/linuxThis will build kexec_mod.ko and kexec_mod_$ARCH.ko which can be loaded
into the Linux kernel.
Enter the user directory and build the helper as follows:
makeThis will build redir.so that acts as an LD_PRELOAD interposer for Kexec
syscalls, allowing the use of unpatched kexec-tools.
Make sure you have built the module and user-space helper. Also check whether you
have installed kexec-tools. Then, you can use kexec-tools as follows:
LD_PRELOAD=/root/redir.so kexec -l /boot/vmlinuz --reuse-cmdline
LD_PRELOAD=/root/redir.so kexec -eThe code is released under the GPLv2 license. See COPYING.txt.