Introduction: Learn How to Make an OS

An OS (operating system) is the foundation of every computer. It contains all of the programs and files necessary for the computer to function. Operating systems are made out of hundreds of thousands of lines of code and is usually programmed in C, C++, and most importantly, assembly. Making an OS is no walk in the park. This instructable assumes that you have knowledge about programming and know some intermediate to advanced programming topics.

Step 1: Learn How to Program

Learn programming before you begin. Assembly language is vital, another supplementary low level language such as C is strongly recommended.

Step 2: Deciding Your Choice of Media

Decide what media you want to load your OS on. It can be a floppy disk, CD drive, DVD drive, flash drive, a hard disk, or another PC.

Step 3: Designing Your OS

Decide what you want your OS to do. Whether it is a fully capable OS with a graphical user interface (GUI) or something a bit more minimalistic, you'll need to know what direction you are taking it before beginning.

Step 4: Choose a Processing Platform

Target what processor platform your operating system will support. If you are not sure, your best bet is to target the X86 (32 bit) processor platform, as most computers use X86 platform processors.

Step 5: Decisions, Decisions

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, for example. See Tips for an external link.

Step 6: Deciding a Bootloader

Decide if you're going to use your own bootloader or a pre-created one such as Grand Unified Bootloader (GRUB). While coding your own bootloader will give a lot of knowledge of the hardware and the BIOS, it may set you back on the programming of the actual kernel.

Step 7: What Programming Language?

Decide what programming language to use. 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 Assembly. Assembly is absolutely necessary, as some vital parts of an operating system require it. C++, on the other hand, contains keywords that need another fully-built OS to run.

● In order to compile an operating system from C or C++ code, you will of course be using one compiler or another. You should therefore read the user guide/manuals/documentation for your chosen C/C++ compiler, whether it comes packaged with the software or is available on the distributor's website. You will need to know many intricate things about your compiler and, for C++ development, you should know about the compiler's mangling scheme and its ABI. You are expected to understand the various executable formats (ELF, PE, COFF, plain binary, etc.), and understand that the Windows proprietary format, PE (.exe), has been copyrighted.

Step 8: Designing an API

Decide on your application programming interface (API). One good API to choose is POSIX, which is well documented. All Unix systems have at least partial support for POSIX, so it would be trivial to port Unix programs to your OS.

Step 9: Making a Kernel

Decide on your design. The kernel acts a bridge between hardware and software. 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.

Step 10: Tips

●Consider developing working in a team. That way, less time is required to solve more problems, producing a better OS.

● Do not wipe your hard drive completely. Remember, wiping your drive will clear out all your data and is irreversible! Use GRUB or another boot manager to dual-boot your system with another OS until yours is fully functional.

● Start small. Begin with small things such as displaying text and interrupts before moving on to things such as memory management and multitasking.

● Keep a backup of the last working source. In case something goes terribly wrong with the current version or your development PC crashes and is unable to boot, it is an excellent idea to have a second copy to work with/troubleshoot.

● Consider testing your new operating system with 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. VM applications include VMWare (which also has a freely available server product), the open-source alternative Bochs, Microsoft Virtual PC (not compatible with Linux), and xVM VirtualBox. See Tips for more information.

● Release a "release candidate." This will allow users to tell you about potential problems with your operating system.

Step 11: Sources

I've seen this question a lot on most programming forums so I decided to post an instructable about this here.

Sources:

●Wikihow
●Me. I used some of my limited knowledge about OS programming. I've been an ethical hacker and programmer for almost five years now.

Check out my "Learn How to Hack" to learn how to begin ethical hacking and "Learn the Types of Malware" instructable to learn the different types of malware, how they operate, and how to defend yourself against them. Also check out my "The Ethical Hacking Process" to learn the different steps and approach styles on how to hack your target.

Comments

author
AliI12 made it! (author)2015-08-20

I noticed this thread from wikihow.Though, Instructables may have made it first.Anyways can I use an opensource OS such as Linux and build on it heavily

or can I only edit it partly any help will be apricieated :)

author
Reiki Weedman made it! (author)2014-11-27

is there aplace or website or something u can get these "GRUB" things?is it like an OS that you can build off of, are they free? and i have many more questions

author
nerd7473 made it! (author)nerd74732015-08-06

GRUB is just a bootloader it stands for GRand Unified Bootloader

author
Ayush 007 made it! (author)2015-07-05

Hey please give the codes for make a os for pc

author
OpenSourceF made it! (author)2015-05-28

GRUB is a open source bootloader

author
Reiki Weedman made it! (author)2014-11-27

is there aplace or website or something u can get these "GRUB" things?is it like an OS that you can build off of, are they free? and i have many more questions

author
halofreak101 made it! (author)2013-06-27

This seems useful if you want a custom OS for specialized task

author
THAWKK made it! (author)2013-06-17

If you have any questions or are confused, please comment and I most certainly will have an answer.

author
THAWKK made it! (author)2013-06-17

If you have any questions or are confused, please comment and I most certainly will have an answer.

About This Instructable

39,099views

133favorites

License:

Bio: I have been an ethical gray-hat hacker and programmer for 10 years now.
More by THAWKK:How to Create More Secure CodeLearn To Grasp C++ PointersLearn How To Make An OS
Add instructable to: