I have an interesting question, I was trying to make a simple bootloader that would boot and display text. As I did further research, I discovered that the bootloader needed to reserve memory for something. Here are my questions:
- How do you reserve memory for the bootloader?
- Why do you need to reserve memory?
- What other functions does a bootloader need to preform.
- How do I pass control to the kernel?
You don’t really need to “reserve” memory, rather just use it.
Really though, you need this because your kernel expects to be at the start of addressable memory. For that reason, the first thing you should do is to copy the bootloader, which will probably be running from the MBR at this point, into high memory (way past where the kernel will be), then jump to it. You then need to load the kernel into the start of memory, set up the rest of the environment for the kernel (again, it will expect certain things, like the Linux kernel command line, to be at specific places in memory), then jump to its entry point.
When you have gotten here, you don’t care about the bootloader any more, it’s purpose in life is done. Control has been passed to the kernel, and it will probably overwrite the section of RAM used for your loader at some point.
This might also help to get your head around the early stages of the boot process: IBM