Wednesday, April 1, 2009

How to Make a Computer Operating System

An Operating System (OS) is how you tell your computer what to do. Whether the ones you have found don't measure up, or if you are a hobbyist wanting to have a creation to call your own, it can be a daunting task and it may take years to get your own operating system to be of any use. Remastering an existing Linux distro can also be straightforward and easy.

STEPS
  1. Decide what you want your OS to do. Whether it is a fully capable OS with a GUI or something a bit more minimalistic, you'll need to know what direction you are taking it before beginning.
  2. Decide if you would rather do it all yourself from the ground up, or if there is an existing kernel you would like to build on top of. Linux from Scratch is a project for those that would like to build their own Linux distro.
  3. Decide if you're going to create your own bootloader or a pre-created one such as GRUB. While coding your own bootloader will give a lot of knowledge of computer hardware and the BIOS, it may set you back on the programming of the actual kernel.
  4. While it is possible to create an operating system in a language such as Pascal or BASIC you will be better off using C or C++ and Assembly. Assembly is absolutely required as some vital parts of an operating system require it.
  5. Start small. Begin with small things such as displaying text and interrupts before moving on to things such as memory management and multitasking.
  6. Decide on your API. While this is a long way off it is a good idea to plan ahead. A good API to choose is POSIX, which is well documented. All Unices have at least partial support for POSIX, so it would be trivial to port Unix programs to your OS.
  7. Decide on your design. There are monolithic kernels and microkernels. Monolithic kernels implement all the services in the kernel, while microkernels have a small kernel combined with user daemons implementing services. In general, monolithic kernels are faster, but microkernels have better fault isolation and reliability.
  8. If you want an easy way, consider Ubuntu remastersys, Fedora Revisor, Custom NimbleX, Puppy Remaster, PCLinuxOS mklivecd and SuSE KIWI.