OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 2:51 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Converting higher half bootloader to simple (not higher half
PostPosted: Sat Oct 24, 2020 4:41 pm 
Offline
Member
Member
User avatar

Joined: Wed Feb 19, 2020 1:08 pm
Posts: 270
Location: Italy
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.


Top
 Profile  
 
 Post subject: Re: Converting higher half bootloader to simple (not higher
PostPosted: Sat Oct 24, 2020 5:13 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
Bonfra wrote:
I've wanted to write my own bootloader

I think copying someone else's code isn't really writing your own bootloader.

Bonfra wrote:
this specific bootloader was designed to run a higher half kernel

No it wasn't.

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?

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.


Top
 Profile  
 
 Post subject: Re: Converting higher half bootloader to simple (not higher
PostPosted: Sat Oct 24, 2020 5:26 pm 
Offline
Member
Member
User avatar

Joined: Wed Feb 19, 2020 1:08 pm
Posts: 270
Location: Italy
Octocontrabass wrote:
I think copying someone else's code isn't really writing your own bootloader.

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 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.

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?

_________________
Regards, Bonfra.


Top
 Profile  
 
 Post subject: Re: Converting higher half bootloader to simple (not higher
PostPosted: Sat Oct 24, 2020 5:56 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
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.


Top
 Profile  
 
 Post subject: Re: Converting higher half bootloader to simple (not higher
PostPosted: Sat Oct 24, 2020 7:13 pm 
Offline

Joined: Fri Jan 31, 2020 7:28 pm
Posts: 8
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.

_________________
My public domain NASM OS


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 56 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group