OSDev.org

The Place to Start for Operating System Developers
It is currently Wed Apr 24, 2024 3:09 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Create my first bootloader
PostPosted: Thu Oct 20, 2011 2:04 pm 
Offline
Member
Member

Joined: Mon Oct 17, 2011 7:44 am
Posts: 45
My first OS has expanded beyond the size of the boot sector, so I need to create a bootloader. Now there are many ready-made bootloaders to be found, however I want to understand everything that goes on in my bootloader. I couldn't find any tutorials on creating bootloaders. I want to simply load a file containing code, and then jump to it. Does anyone know of a complete tutorial on how to do this? My floppy disk is currently formatted as FAT12. And I do want to know how to do everything without BIOS interrupts, if that is feasible.


Top
 Profile  
 
 Post subject: Re: Create my first bootloader
PostPosted: Thu Oct 20, 2011 3:24 pm 
Offline

Joined: Mon Aug 01, 2011 7:59 pm
Posts: 8
ask and ye shall recieve: http://brokenthorn.com/Resources/OSDev5.html

This is number 5 of Broken Thorn's OS tutorial... 5 and 6 teach how to load the kernel using FAT12 file system


Top
 Profile  
 
 Post subject: Re: Create my first bootloader
PostPosted: Thu Oct 20, 2011 4:08 pm 
Offline
Member
Member

Joined: Mon Oct 17, 2011 7:44 am
Posts: 45
This looks like something useful. I will try to use it, even though it is littered with errors (floppy disks have 63 tracks total?). I would still be glad if I could do this without BIOS interrupts.


Top
 Profile  
 
 Post subject: Re: Create my first bootloader
PostPosted: Thu Oct 20, 2011 4:19 pm 
Offline

Joined: Mon Aug 01, 2011 7:59 pm
Posts: 8
The tutorial works, that's all I know. I'm not sure you could create a floppy disk driver AND load a kernel using FAT12 file system in 512 bytes. BIOS is your friend in real mode


Top
 Profile  
 
 Post subject: Re: Create my first bootloader
PostPosted: Thu Oct 20, 2011 4:32 pm 
Offline
Member
Member

Joined: Mon Oct 17, 2011 7:44 am
Posts: 45
I take it it's pretty complicated to read a floppy. I should probably stick to BIOS then. I have another question: Is it possible to copy a multi-stage bootloader to a CD and have it work the same as a floppy? What about using a USB stick? I don't have real floppies, but I would like to sometime run my OS on something besides an emulator.


Top
 Profile  
 
 Post subject: Re: Create my first bootloader
PostPosted: Thu Oct 20, 2011 4:49 pm 
Offline

Joined: Mon Aug 01, 2011 7:59 pm
Posts: 8
I think you can. I usually use mkisofs to turn a .ima or .img floppy image into a cd image and burn it to a cd. It usually has the same effect on my computer that a floppy image does in an emulator.
As far as making a floppy driver, number 19 in that OSDev series talks about making a DMA floppy driver. Judging by what it says, I'd say the driver would be just under 512 bytes but it plus the code required to load the kernel would probably exceed the limit.


Top
 Profile  
 
 Post subject: Re: Create my first bootloader
PostPosted: Fri Oct 21, 2011 2:20 am 
Offline
Member
Member

Joined: Wed Oct 01, 2008 1:55 pm
Posts: 3193
kendfrey wrote:
This looks like something useful. I will try to use it, even though it is littered with errors (floppy disks have 63 tracks total?). I would still be glad if I could do this without BIOS interrupts.


You shouldn't do a bootloader that doesn't use BIOS interrupts. Installing drivers for different disc-hardware should not be done in the bootloader, but in the OS. By using BIOS you make sure that your bootloader works regardless of disc-hardware, and if you have an OS driver for the disc or not.


Top
 Profile  
 
 Post subject: Re: Create my first bootloader
PostPosted: Fri Oct 21, 2011 3:22 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 3:45 am
Posts: 9301
Location: On the balcony, where I can actually keep 1½m distance
kendfrey wrote:
I have another question: Is it possible to copy a multi-stage bootloader to a CD and have it work the same as a floppy?
Yes, using emulation as mentioned. However a CD has much larger native bootloader sizes supported and you don't need the two-stage setup with native CD boot (besides the fact that not all computers supporting CD boot support El-Torito emulation)
Quote:
What about using a USB stick?
An USB is usually treated like a harddisk (and they usually have partitions and the whole shebang), and might need other BIOS calls to actually read the data from the far end of the (USB) drive.

_________________
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], SemrushBot [Bot] and 132 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