Answer the question
In order to leave comments, you need to log in
How to properly boot your kernel?
When trying to start coding on bare metal (x86_64), the question arose about the bootloader. The following options arise:
1. Self-written BIOS-loader
Plus: Everything is simple and clear.
Cons: Haemorrhoids of manually loading the kernel, switching real mode -> long mode. Legacy technology
2. Using multiboot specification + GRUB2
Plus: All boot work is taken off your shoulders.
Cons: I can't estimate the labor involved in maintaining this specification. Can the same kernel image be booted via both BIOS and (U)EFI?
3. Issue the kernel image as a UEFI-application, so that it is directly loaded by iron.
Pros: No special bootloader needed.
Cons: You can't separate the kernel build from the UEFI image build, which will cause build portability issues (complicated Makefiles, requiring the right compilers and tools).
4. Implement a self-written UEFI bootloader for your kernel
Plus: there is no bootloader assembly gem, it can be distributed in binary form
Cons: the need to deeply understand the UEFI API, which does not smile at me much.
Which of the methods seems to you more correct, less time-consuming and more promising? And why? Thank you.
Answer the question
In order to leave comments, you need to log in
Ready bootloader, of course. Otherwise, just stop there, checked many times by many people)
My vote is for multiboot. By the way, it is supported by both grub2 and grub1. And in the grub source code there is an example of a minimal multiboot kernel, based on which it is very convenient to write further.
Hemorrhoids of manually loading the kernel, switching real mode -> long mode
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question