Converting higher half bootloader to simple (not higher half
Converting higher half bootloader to simple (not higher half
I've wanted to write my own bootloader so I started researching and found this repository which I think is very good for studying as it seems very complete (at least the bootloader part that is what I'm interested in). After some tweaks here and there I've managed to adapt and rewrite it to my own needs but this specific bootloader was designed to run a higher half kernel, instead I just want a simple kernel wich runs at 0x100000. This file contains all the memory layout that the bootloader uses to load the kernel, I tried to play with these values but I failed. I think that I've to adjust only the Mem.Kernel.* but at this point I'm not really sure. What do you think about it?
Regards, Bonfra.
-
- Member
- Posts: 5568
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Converting higher half bootloader to simple (not higher
I think copying someone else's code isn't really writing your own bootloader.Bonfra wrote:I've wanted to write my own bootloader
No it wasn't.Bonfra wrote:this specific bootloader was designed to run a higher half kernel
I think you would have to modify the code that sets up the page tables, since it makes some assumptions about the memory layout that aren't valid if the kernel is loaded at a different address.Bonfra wrote:I think that I've to adjust only the Mem.Kernel.* but at this point I'm not really sure. What do you think about it?
Re: Converting higher half bootloader to simple (not higher
Guess is not, now I'm just learning how bootloader works to then write my own and this one seemed to be good.Octocontrabass wrote:I think copying someone else's code isn't really writing your own bootloader.
Really dumb question, I'm a beginner, how should i modify it? Or at least wich part? Also which address do I have to modify with what in mem.inc?Octocontrabass wrote:I think you would have to modify the code that sets up the page tables, since it makes some assumptions about the memory layout that aren't valid if the kernel is loaded at a different address.
Regards, Bonfra.
-
- Member
- Posts: 5568
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Converting higher half bootloader to simple (not higher
If you want to learn how to write a bootloader, you should probably start with something simpler so you can practice x86 assembly.
If you don't want to learn how to write a bootloader, use GRUB.
If you don't want to learn how to write a bootloader, use GRUB.
-
- Posts: 8
- Joined: Fri Jan 31, 2020 7:28 pm
Re: Converting higher half bootloader to simple (not higher
I've read the code of the repo and it seems that the kernel's code is at 0x00301000 (not exactly higher-half). Also, mem.inc isn't the only thing you would want to change. You also want to change the linker script of MonkOS (kernel/kernel.ld) so that it relocates all symbols to 0x100000 instead of 0x00301000.