Page 1 of 1

How to load kernel in custom bootloader

Posted: Sun Feb 05, 2012 1:46 am
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

Re: How to load kernel in custom bootloader

Posted: Sun Feb 05, 2012 2:13 am
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)

Re: How to load kernel in custom bootloader

Posted: Sun Feb 05, 2012 2:50 am
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.

Re: How to load kernel in custom bootloader

Posted: Sun Feb 05, 2012 5:41 am
by Yashas
Can we enable A_20 at the bootloader stage and get more???

Re: How to load kernel in custom bootloader

Posted: Sun Feb 05, 2012 5:47 am
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.

Re: How to load kernel in custom bootloader

Posted: Sun Feb 05, 2012 5:57 am
by Yashas
Memory more than 1MB

Re: How to load kernel in custom bootloader

Posted: Sun Feb 05, 2012 6:03 am
by bluemoon
Yes you can.

Re: How to load kernel in custom bootloader

Posted: Mon Feb 06, 2012 2:05 am
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?

Re: How to load kernel in custom bootloader

Posted: Mon Feb 06, 2012 2:52 am
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.

Re: How to load kernel in custom bootloader

Posted: Tue Feb 07, 2012 3:13 pm
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?