Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Writing your own Toy OS (linuxgazette.net)
16 points by smanek on May 12, 2008 | hide | past | favorite | 10 comments


While writing your own boot loader may be fun, I think it's a waste of time. If you are interested in operating systems programming, I recommend you skip the boot loader stage and use GRUB to boot your kernel.

It's actually pretty simple to get a "hello world" kernel booting using GRUB. After that, you have real, actual operating systems programming like implementing paging, multitasking, interrupts, and so on.


Writing one is not a waste of time, because you learn what's really going on just after POST. But trying to actually use your own and maintain it is pretty much a waste. Write one to learn how it works, then throw it away and use Grub.


If you consider that valuable knowledge, then I agree with you there. There may be some merit to writing (and understanding) a minimal bootloader that enables A20, switches to protected mode, and loads a kernel from a floppy disc. Just getting that far will teach you quite a bit about writing and debugging low-level assembly code. However, if you go this route then, as you say, you should definitely consider it throwaway code.

But, I don't think that knowledge is important. You'll gain much of the same knowledge from implementing virtual memory and multitasking. Besides, the bootloading process is highly architecture-specific. Switch to an ARM or PPC chip, and it's a completely different process.


  Switch to an ARM or PPC chip, and it's a completely
  different process.
Yup. That's why you should do it for learning purposes - getting your head around how a machine bootstraps itself is, to my mind, one of the harder things to understand about a computing system. Part of that is because someone who doesn't know how it works might look at booting mechanisms as a sort of "black box", or just magic. Once you peer into the black box and understand some of it, suddenly, none of it seems all that mysterious anymore, even if you've only learned the particulars for one specific machine.


I'm not sure I understand your point. If writing your own boot loader is fun, how can it be a waste of time?


If writing the other parts are more fun.


OK, got you there.



What's a floppy?


A USB drive, hard drive, or CD ROM all work just fine. Floppies are just a simple and conventional way to get a kernel booting. Personally, I like netbooting the best.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: