Kernel Entry Point and Linking
Kernel Entry Point and Linking
I’m a beginner in operating system development, and I have a question: Does every operating system need to have a main kernel, which is loaded by the bootloader? And when I write the other kernel components like memory management, drivers, and other kernels, do I need to define the function in the main kernel’s main function? The linker places the main kernel at an address like 0x100000, and for the headers of the other kernels that are in the main function of the main kernel, does the linker calculate where to place them in RAM based on the linker’s base address? So, anything I put in the main of the main kernel, the linker makes a call to a specific address it calculated. Is what I’m saying correct?
-
Octocontrabass
- Member

- Posts: 6245
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Kernel Entry Point and Linking
You may as well include a link to your Reddit post.
Anyway...
Anyway...
One of the binaries loaded by the bootloader has to contain the code that will execute next. Usually the binary containing that code is the kernel.
There are no "other kernels" - are you perhaps thinking of kernel modules? In any case, you get to decide how everything is connected together when you're the one writing the kernel.
I don't really understand your question. If you're linking a single kernel binary that contains all of your code, the linker calculates the addresses. If you're separating your code into multiple binaries, you have to come up with your own solution because your linker can't figure it out for you.karim wrote: ↑Fri Jul 18, 2025 6:54 pmThe linker places the main kernel at an address like 0x100000, and for the headers of the other kernels that are in the main function of the main kernel, does the linker calculate where to place them in RAM based on the linker’s base address? So, anything I put in the main of the main kernel, the linker makes a call to a specific address it calculated. Is what I’m saying correct?