Page 1 of 1

where to go from here

Posted: Wed Nov 11, 2009 10:42 am
by ChrisSkura
k, I just wrote a boot program which prints out some text and draws a couple of lines but I've been told I shouldn't put graphics in my boot loader. I need help trying to make and link a kernel to my bootloader but I don't know where to start. when linking do I link the bootloader and kernel into one binary file or do I write both files to the floppy disk?

Re: where to go from here

Posted: Wed Nov 11, 2009 11:13 am
by Grunt
A bootloader can only be 512 bytes long, which really limits your possibilities. The preferred method is to write the bootloader onto the MBR, then have it load the kernel into the memory. Using GRUB really helps in this case.

You can take a look at some examples, maybe this one. Googling around will lead you to numerous other examples.

Re: where to go from here

Posted: Wed Nov 11, 2009 11:13 am
by neon
Hello,

You cannot link a program to your boot code. (Well, maybe you can, if you compile the C project to flat binary somehow. Not a good idea though sense you are limited to 512 bytes.) In any case, you will want your boot loader to parse the filesystem and load another, bigger program. This can be your kernel, or another, bigger, bootloader.

Re: where to go from here

Posted: Wed Nov 11, 2009 2:16 pm
by jal
ChrisSkura wrote:k, I just wrote a boot program which prints out some text and draws a couple of lines but I've been told I shouldn't put graphics in my boot loader.
By whom? There's nothing wrong with graphics in your bootloader, if they are bootloader specific.


JAL

Re: where to go from here

Posted: Wed Nov 11, 2009 2:59 pm
by neon
jal wrote:
ChrisSkura wrote:k, I just wrote a boot program which prints out some text and draws a couple of lines but I've been told I shouldn't put graphics in my boot loader.
By whom? There's nothing wrong with graphics in your bootloader, if they are bootloader specific
There is when it is boot code that is limited to 512 bytes. Of course, if he decides to load a bigger program, ie, a kernel or "2nd stage" there isnt a problem. Graphics in boot code is not recommended do to being limited to 512 bytes.

Re: where to go from here

Posted: Wed Nov 11, 2009 11:28 pm
by ChrisSkura
k, I don't really want to use grub because I want to write EVERYTHING in my os. I need to know how to set up the gdt and how to load the kernel.

Re: where to go from here

Posted: Thu Nov 12, 2009 12:16 am
by smeezekitty
you will ether load the sectors direct into memory or parse a filesystem with the kernel on it
and load it into memory then do a far jump to it.

Re: where to go from here

Posted: Thu Nov 12, 2009 2:13 am
by Combuster
I suggest you look up your keywords in the wiki - Bootloader - GDT - <insert random link> - there is a lot waiting to be found.

It also helps you ask more specific questions, and by doing so, yield better answers.

Re: where to go from here

Posted: Thu Nov 12, 2009 4:46 am
by jal
neon wrote:Graphics in boot code is not recommended do to being limited to 512 bytes.
Again, why not? Of course the boot code is limited to that, but if you manage to put it in there anyway, why not? The OP didn't ask "I've got graphics in my bootloader, and now I've hit the 510 byte limit", right? If I remember correctly Dex has a bootsector CD player including graphics, so one can do it.


JAL

Re: where to go from here

Posted: Thu Nov 12, 2009 9:24 am
by Dex
jal wrote:
neon wrote:Graphics in boot code is not recommended do to being limited to 512 bytes.
Again, why not? Of course the boot code is limited to that, but if you manage to put it in there anyway, why not? The OP didn't ask "I've got graphics in my bootloader, and now I've hit the 510 byte limit", right? If I remember correctly Dex has a bootsector CD player including graphics, so one can do it.


JAL
JAL is right its possable, http://www.dex4u.com/ASMcompo512b/CdPod.zip
This demo fits sets vesa 640x480 32bpp, sets up a basic ATAPI driver, goes to pmode, sets up a simple menu driven gui and vesa fonts, and a cdplayer, all in less than 512bytes.
You will also find full games that fit in boot sector from that compo
CdPod
Image
Tetris game
Image
Scroll game
Image

See here for the rest:
http://www.dex4u.com/ASMcompo512b/

Re: where to go from here

Posted: Thu Nov 12, 2009 9:37 am
by neon
Just because something is possible does not make it a good idea. I suppose its fine if he can fit it along with the necessary code to load a bigger program (kernel or "2nd stage").