Hi Haiku Development team,
I was reviewing the GSoC project list and am very interested in Haiku’s proposal for implementing kexec (and potentially kload). I’ve spent some time looking into the architecture and wanted to share my initial understanding of the implementation strategy to see if I am on the right track.
Here is my current mental model and proposed approach:
-
The primary goal of
kexecis to bypass the standard bootloader and BIOS/UEFI firmware phases, loading a new kernel image directly from the currently running one, while giving the new kernel the illusion of a fresh boot. -
To safely load the target kernel binary and avoid memory fragmentation issues, I plan to allocate discrete 4KB pages (explicitly marked to prevent swapping). The host kernel will create an array of these physical addresses and pass it to the
kexectrampoline (should I load trampoline as part of the kernel or as a separate module?). -
The trampoline code will be responsible for parsing this address array, copying the target kernel fragments to their correct contiguous physical locations, and ensuring the hardware/device state is completely clean. It will then replicate the necessary bootloader hand-off sequence before jumping to the new kernel.
-
For the initial implementation,
kexeccan simply pass the existing host kernel’s arguments to the target kernel. As the project progresses, this will be expanded to accept and parse custom command-line arguments via user-space tools.
I would love to get your feedback on this initial high-level approach. Are there any Haiku-specific quirks regarding device teardown or the bootloader sequence that I should investigate next?
Best regards,
My Bad 2