Create my first bootloader
Create my first bootloader
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.
Re: Create my first bootloader
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
This is number 5 of Broken Thorn's OS tutorial... 5 and 6 teach how to load the kernel using FAT12 file system
Re: Create my first bootloader
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.
Re: Create my first bootloader
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
Re: Create my first bootloader
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.
Re: Create my first bootloader
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.
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.
Re: Create my first bootloader
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.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.
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Create my first bootloader
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)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?
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.What about using a USB stick?