Hi,
This is probably going to get me flamed but...
what's so difficult about writing a bootloader (wait...read on!)?
I don't mean a bootloader that will boot windows, linux or (God forbid) OSX but a bootloader that will boot an OS <64k that just does basic FAT stuff. Surely that just involves copying the kernel code into a memory location? There's loads of those out there in the tutorials.
Most people who "write" an OS wil get as far as "Hello world" and a simple command line before they get bored/discouraged/out of their depth/married/kids or whatever else contributes the the millions of kernels that seem to exist in the interweb!
Using Grub to load a "Hello World" kernel just seems like overkill?
I've probably missed something obvious which will make me look like a complete twitter user (according to David Cameron) but if you don't ask you'll never know!
Thanks
Gareth
Bootloaders are difficult?
Re: Bootloaders are difficult?
Hi,
There's nothing difficult about it - if you only plan to write the Hello World kernel.
However, most people trying OS Dev aspire to greater things, for which they'll need something that can enable memory above 1MiB and can coexist with other OSes. For that, you need GRUB or something with a similar complexity level.
By using GRUB from the outset, you don't have to change your kernel entry interface later on.
Cheers,
Adam
There's nothing difficult about it - if you only plan to write the Hello World kernel.
However, most people trying OS Dev aspire to greater things, for which they'll need something that can enable memory above 1MiB and can coexist with other OSes. For that, you need GRUB or something with a similar complexity level.
By using GRUB from the outset, you don't have to change your kernel entry interface later on.
Cheers,
Adam
-
- Posts: 8
- Joined: Tue Sep 15, 2009 4:09 am
Re: Bootloaders are difficult?
O.K., that makes sense. I can see how co-existing could introduce a level of complexity equal to writing an OS in the first place!
Thankfully my aims are much lower - I just want to have full control of the machine and see what I can accomplish in 64k!! (Jeff Minter would be proud of me...)
Thanks
Gareth
Thankfully my aims are much lower - I just want to have full control of the machine and see what I can accomplish in 64k!! (Jeff Minter would be proud of me...)
Thanks
Gareth
Re: Bootloaders are difficult?
The only thing that makes bootloader difficult is that there is no 100% standardization of functions, OR most likely BIOSes have bugs. This also includes inability to read more that 1 sector from a disk.
Rest is really depends how qualified programmer to write a bootloader.
Rest is really depends how qualified programmer to write a bootloader.
-
- Posts: 8
- Joined: Tue Sep 15, 2009 4:09 am
Re: Bootloaders are difficult?
Ah, didn't realise that. So even if my simple bootloader worked on my home laptop it may not work on my eeepc, work PC etc. Interesting!! Beginning to realise what a minefield bootloaders are! I wonder if the author of Grub set out to write an OS and just got a bit sidetracked!
Re: Bootloaders are difficult?
Hi,
Cheers,
Brendan
Yes, but it's a little harder than that because (for PC BIOS) you need different boot loaders for different types of boot devices. For e.g. booting from network, booting from floppy (no "int 0x13 extensions"), booting from hard disk (with "int 0x13 extensions") and booting from CD-ROM (with "no emulation") are all different enough that it's better to write several separate boot loaders than to try to support all of these things in 512 bytes.garethadams wrote:Ah, didn't realise that. So even if my simple bootloader worked on my home laptop it may not work on my eeepc, work PC etc. Interesting!!
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.