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.

Tips:
* Do not wipe your hard drive completely. Use GRUB or another boot manager to dual boot your system with another OS until yours is fully functional.
* An alternative method of testing your new operating system is to use a virtual machine. Rather than rebooting your computer each time you make changes, or having to transfer the files from your development computer to your test machine, you use a virtual machine application to run your OS while your current OS is still running. Two such VM applications are VMWare (http://www.vmware.com) and the open source alternative bochs (http://bochs.sourceforge.net). VMware also has a freely available server product which should suit nicely.(http://www.vmware.com/products/server/) An easy one is sun's xVM VirtualBox. (http://www.virtualbox.org)
* Getting a copy of the Intel developer manuals from http://developer.intel.com/products/processor/manuals/index.htm is vital
* Use websites such as http://osdev.org and http://osdever.net to help you develop your own operating system.
* It is an excellent idea to keep a backup of the last working source, in case something goes terribly wrong with the current version.
* Consider developing it in a team; that way, less time is required and more problems can be solved and generally the OS may be better.
* It may be a good choice to make a completely new partition for developing the OS.
* You will not have a full system in two weeks. Start with an OS that boots, then move on to the cool stuff.

Warnings:
* Having your operating system carelessly written to the hard drive can corrupt it completely. Be careful.
* Be sure to implement security features as your top priority if you ever want to use it for anything.
* If you do something really stupid, like write random bytes to random I/O ports, you *will* crash your OS, and (in theory) can fry your hardware. For a demonstration, execute 'cat /dev/port' on Linux as root. Your computer *will* crash.

Things You'll Need:
* A good computer
* A CPU for the Architecture you will be developing
* Enough memory (RAM) for a Virtual Machine
* A 'Host' OS, used to develop the Assembler (and others) source code, also to build and package it, while it is in its early stages, eventually your own OS can be its host.

4 comments:

Unknown said...

fantastic post, I have an article at http://www.goarticles.com/cgi-bin/showa.cgi?C=1321667 take alook

Computer Rental Company said...

Very informative. I hope there is a step by step tutorial also posted here on how to create your own operating software. A sample would also be helpful.

Anonymous said...

yer but were are we ment to find a program to build are operating sys tems, no offecnce XD

Anonymous said...

13andincrediblycut says:

If you want to build your own OS from scratch email me at ANDY13andincrediblycut@hotmail.com :)

Post a Comment