How to load kernel in custom bootloader

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Corkthomas
Posts: 2
Joined: Sun Feb 05, 2012 1:22 am

How to load kernel in custom bootloader

Post by Corkthomas »

Hi everyone,

I currently have a custom bootloader OS that works fine, but the 512 byte size limit is a major problem. I've tried adding code after the boot signature but obviously it can't be read since only the 512 bytes are being loaded into memory. Could anyone tell me how I'm supposed to load more than 512 bytes into memory? Any specific commands, techniques, etc would be greatly appreciated. Im developing on Mac, testing on virtualbox, and using nasm to compile.

The code I already have: http://filecabwebsite.kodingen.com/files/boot.txt
User avatar
eaglexrlnk
Posts: 11
Joined: Tue Nov 08, 2011 8:30 am
Location: Ukraine

Re: How to load kernel in custom bootloader

Post by eaglexrlnk »

Hello!

Of course it is very hard to get much of 512 bytes, but you don't have to. Usually bootloaders are split into several stages, each of which is doing its own job and giving control to the next one. The classical bootloader consists of two stages: first one just loads the second stage, which handles all the other stuff of initialization and loading your operating system. The other option is to use GRUB and focus on you kernel design.
Good luck!

EDIT: Or you could wait until May :) (see the topic about contest)
"A
computer program
does what you tell it
to do, not what you
want it to do." --
Greer's Third Law
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: How to load kernel in custom bootloader

Post by bluemoon »

If you have not yet check the wiki, it's a very good place to start. Since you have limited code size, basically you read from storage with some sort of API, be that old fashion BIOS disk service, EFI, or network boot APIs.
Yashas
Member
Member
Posts: 45
Joined: Sun Feb 05, 2012 5:19 am
Location: India
Contact:

Re: How to load kernel in custom bootloader

Post by Yashas »

Can we enable A_20 at the bootloader stage and get more???
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: How to load kernel in custom bootloader

Post by bluemoon »

Yashas wrote:Can we enable A_20 at the bootloader stage
Yes.
Yashas wrote:and get more???
More what?

PS. It's not a good idea to hijack a thread.
Yashas
Member
Member
Posts: 45
Joined: Sun Feb 05, 2012 5:19 am
Location: India
Contact:

Re: How to load kernel in custom bootloader

Post by Yashas »

Memory more than 1MB
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: How to load kernel in custom bootloader

Post by bluemoon »

Yes you can.
Corkthomas
Posts: 2
Joined: Sun Feb 05, 2012 1:22 am

Re: How to load kernel in custom bootloader

Post by Corkthomas »

I've read through everything on the wiki and searched the forums but didn't find anything very helpful since I have no clue how this is supposed to be done. Is there any example code you could link me to?
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: How to load kernel in custom bootloader

Post by bluemoon »

Corkthomas wrote:I've read through everything on the wiki and searched the forums but didn't find anything very helpful since I have no clue how this is supposed to be done.
#-o
Read them 10 times and you will see things that helpful.
User avatar
DavidCooper
Member
Member
Posts: 1150
Joined: Wed Oct 27, 2010 4:53 pm
Location: Scotland

Re: How to load kernel in custom bootloader

Post by DavidCooper »

What is all that stuff in your bootsector? Your immediate priority in a boot sector is to load more sectors in and not to display lots of data to the screen. Bluemoon said something about BIOS disk service, which might be a useful clue. I've just googled that to see what happens and the second search result was http://en.wikipedia.org/wiki/INT_13H - that should give you a few ideas about what you need to do.

Out of interest, what are you booting from? Floppy disk? Hard disk? USB flash drive? Real disk or disk image?
Help the people of Laos by liking - https://www.facebook.com/TheSBInitiative/?ref=py_c

MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming
Post Reply