Boot Loader sans FAT?

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
Jubbens

Boot Loader sans FAT?

Post by Jubbens »

I'm starting my OS project, and I hope to keep it as simple as possible. The problem with that plan is that OSdev isn't simple. I ran into a problem in my first step: the boot sector.

My boot loader needs to be able to load my kernel, but I don't want to screw with FAT yet. Is it possible to write my kernel to a physical location on the floppy and just have my loader look there? Any pointers on doing this?

Thanks.
Dex4u

Re:Boot Loader sans FAT?

Post by Dex4u »

Why not do what i do and load your OS with bootprog, this let you boot a bin, com or mz exe, from a fat12 floppy, once the bootprog is put on the boot sector, all you do is put your OS on the floppy and reboot your pc simple.

Note: It loads a file called a certan name.
you can down load it here: http://alexfru.chat.ru/epm.html#bootprog
User avatar
Colonel Kernel
Member
Member
Posts: 1437
Joined: Tue Oct 17, 2006 6:06 pm
Location: Vancouver, BC, Canada
Contact:

Re:Boot Loader sans FAT?

Post by Colonel Kernel »

There is also a ready-made floppy with GRUB installed on it. That's what I use and it works great.

http://www.osdev.org/osfaq2/index.php/W ... k%20Images
Top three reasons why my OS project died:
  1. Too much overtime at work
  2. Got married
  3. My brain got stuck in an infinite loop while trying to design the memory manager
Don't let this happen to you!
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Boot Loader sans FAT?

Post by Pype.Clicker »

another option is just to start writing your kernel at a "well known" location on the floppy and start reading sectors from that point. I suggest the amount of sector to be generated automatically from the image's size (so that you don't miss parts of your kernel when it'll get bigger ;)

You can even keep the floppy FAT-compatible by placing your kernel in the "reserved sectors" ...
User avatar
bubach
Member
Member
Posts: 1223
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Re:Boot Loader sans FAT?

Post by bubach »

If you want to have your kernel directly after the bootsector you can put it on the floppy at offset 0x200 with PARTCOPY, by John S. Fine.
http://bos.asmhackers.net/downloads/pcopy02.zip

After that all you have to worry about is putting the right values in the registers, and call BIOS.
An example of this can be found in the xosdev tutorial, on http://www.osdever.net/
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
DruG5t0r3

Re:Boot Loader sans FAT?

Post by DruG5t0r3 »

I suggest using grub. It supports tons of filesystems and will load your kernel image where you want. + the multiboot headers provide you with some usefull information such as available memory and some mmapings (not always usefull though)
Jubbens

Re:Boot Loader sans FAT?

Post by Jubbens »

Thanks all.

Especially Bubach.
Jubbens

Re:Boot Loader sans FAT?

Post by Jubbens »

One final question on the kernel loading crap....I'm new to this.

I want to load my kernel right after low memory, at 65kb. So is this right?

65KB = 66560 bytes = 0x10400 = 0x0020:0x0000

Segment:offset memory addressing has me confused.
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re:Boot Loader sans FAT?

Post by Brendan »

Hi,
Jubbens wrote:I want to load my kernel right after low memory, at 65kb. So is this right?

65KB = 66560 bytes = 0x10400 = 0x0020:0x0000

Segment:offset memory addressing has me confused.
It's almost correct (except for the segment:offset part :) ).

0x10400 = 0x1040:0x0000 and/or 0x1000:0x0400

0x0020:0x0000 = 0x200 = 512 bytes


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
User avatar
bubach
Member
Member
Posts: 1223
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Re:Boot Loader sans FAT?

Post by bubach »

Might I suggest that you load it at 0x1000:0x0000 (64kb) instead?
0x1040:0x0000 is just wierd... :P
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
Post Reply