[GSoC 2026] Exploring kexec-style kernel switching for Haiku

Hello everyone

my name is Kishan, and I’m an information science student interested in contributing to Haiku for GSOC 2026.I recently started exploring Haiku’s source code and architecture because I’m interested in operating systems and low-level development. I’m currently looking into the idea of a kexec-style mechanism that could allow the system to load a new kernel without going through the full reboot process.At the moment, I’m studying the boot process and trying to understand how the kernel starts in Haiku.

I would appreciate any guidance on

whether this idea has been discussed before

which parts of the codebase would be good to study first

Thank u for ur time for reading this

4 Likes

Hi kishan,

Welcome to Haiku!

I’m Pavan, new contributor like you interested in kexec.
when i approached korli (mentor) sent some links to me to understand about kexec, so i will send those links to you can read and understand.

if you have any doubts regarding this, you can contact either korli or haiku forum.

Thank you,
Pavan

1 Like

Hi pavan, thank u for the warm welcome! I really appreciate your help. It seems the links weren’t included in the message could you please share them when you get a chance? Thanks again!

hi,
check your message box

well, check your message box

Ohh got it

Thanks pavan

are you both from india? (because i also am)

i dont really have any guidance tho, but you can read the bootloader section on the haiku user guide. it would probably be useful

good luck btw

Am from India too

Thank you for suggestion bro.will go through it

It is a cool technical project, but I am not sure if this functionality is needed on a desktop system like Haiku

hi,

yes, I’m also from India

thank you,

Pavan

1 Like

It was suggested by one of Haiku developers. It would save us a ton of time when debugging the kernel. The edit/compile/reboot cycle is not exactly great for testing currently.

Also, usually for GSoC we offer ideas like this, that are useful to us, but not in the critical path of the OS development. You wouldn’t want the next beta release to depend on a GSoC intern who never worked on the project before, and the intern wouldn’t want such pressure either. So, GSoC is a nice opportunity to do such “side projects” which are otherwise not the top priorities.

5 Likes

At least for virtual machines it is possible to make firmware startup phase really fast. Modern PC also support fast boot. So I do not think that it will give significant reboot time speed up.

Most time is currently spent in kernel add-ons startup, not firmware.

I get that is a nice feature, and I didn’t want to sound discouraging.

Just personally I would prefer other features like suspend, or encryption, or multimon or webcam support …

1 Like

Hi everyone,

Thanks for the earlier explanations about how Haiku’s kernel relies on the bootloader for hardware setup (MMU already enabled, a specific memory layout, framebuffer/debug UART availability, etc.). That clarified an important difference from how Linux handles early initialization.

Based on that, I hv refined approach. Instead of trying to recreate the entire bootloader environment from scratch, my idea is to reuse the boot environment that the running kernel already has.

The rough flow I’m considering now is:

1. The running kernel loads the new haiku kernel ELF into a reserved region of physical memory (similar to how segments are handled in FreeBSD’s kexec implementation).

2. Rather than rebuilding everything, the new kernel would reuse the existing “kernel_args” and memory layout from the current kernel, adjusting only what is necessary (eg, kernel image location and entry point).

3. Once the new kernel image and arguments are prepared, the system would stop secondary cpus, disable interrupts, and perform an architecture specific jump to the new kernel entry point.

4. Since the MMU and memory layout are already established, the new kernel would start in an environment similar to what it normally expects after the bootloader stage.

Does this direct jump approach make sense for haiku’s architecture, or are there additional bootloader responsibilities (such as module loading or device state teardown) that would need to be replicated before the jump?

Also, regarding @waddlesplash’s point about EFI in some kexec implementation chat : I’m open to exploring that route as well. Would adapting the standard EFI loader to start the new kernel be considered a cleaner or preferred approach compared to the state reuse method described above?

I’ve merged your post into your original thread; I don’t think a separate thread was needed here.

The bootloader has to load the basic kernel modules also, yes. It also has to handle SMP initialization and various other things. So, in the end, whether or not you implement EFI services, you are going to have to reuse large parts of the existing bootloader.

1 Like

Thanks for the clarification,

So if I understand correctly, even with a kexec style approach we would still need to reuse significant parts of the existing bootloader logic, since it is responsible for things like loading the basic kernel modules, preparing “kernel_args”, and setting up SMP and other hardware state before the kernel starts.

In that case, it sounds like my approach must to reuse or adapt parts of the bootloader code to prepare the environment for the new kernel, rather than trying to rely only on the current kernel state.

Would it make sense for the kexec path to effectively invoke a subset of the bootloader logic (for example module loading and kernel_args preparation) before performing the final jump to the new kernel entry point?

I’ll also spend some time studying the bootloader code to better understand which parts would need to be reused

Fundamentally this will probably be most useful if we can just run the whole bootloader itself, including the menus, to set and change boot options. Hence the suggestion to use EFI.

I think Linux kexec has supported starting Windows via EFI kexec for some time. Perhaps you might start by seeing if the Haiku EFI loader works under that environment, and so whether we can just implement something similar for the Haiku kernel?

If I’m not mistaken @waddlesplash recently made it possible to build a “test” version of the bootloader that builds and runs under Haiku as a command line app. At the moment this is mostly used to test the menu itself, and not for actual booting.

Could it be extended to the point that it actually manages to start another kernel? Would that be a good way to achieve the idea of using the bootloader to implement this, or would the interaction with the kernel be too complex and too different from how the bootloader usually does things?

Hmm. Interesting idea. Not sure if it will work; I think there is a bunch of code in the bootloader that expects to be able to disable or send interrupts, for SMP init and other such things?

(Though it might be argued that SMP init should move to the kernel anyway…)

Thanks, that’s an interesting idea.

Running the full bootloader again through EFI does sound like it could simplify things, since it would let us reuse the existing module loading, kernel_args setup, and other boot logic instead of reimplementing it.

I’ll take a look at how Linux handles EFI-based kexec and see if something similar could work with the Haiku EFI loader.do you think the current Haiku EFI loader would need major changes to run in that context, or could it mostly work as-is?

If the bootloader can already be built as a cmd ine app and run under Haiku, extending it so it can actually load and start another kernel could be a nice way to reuse most of the existing boot logic.i’ll try to find that test bootloader code and see how it currently works.

Do you know roughly where that code lives in the tree?