How to Make a Computer Operating System
An operating system is a piece of software to manage and interact with the hardware effectively and provides a shell for other programs to run on. One can be built from scratch, which is a slow and challenging process, or remastered from another source (ex. an existing Linux distro), which is faster and more straightforward. To make a computer operating system, use these guidelines and pointers.
Step 1:
Learn Programing before you begin. Assembly Language is vital, another supplementary low level language such as C is strongly recommended.
Step 2:
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:
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:
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:
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:
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. See Tips.
Step 7:
Decide what a 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.
Tip :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:
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
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.
Step:10
Consider developing working in a team. That way, less time is required to solve more problems, producing a better OS.
Step:11
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.
Step:12
Start small. Begin with small things such as displaying text and interrupts before moving on to things such as memory management and multitasking.
Step:13
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.
Step:14
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.
Step:15
Release a "release candidate." This will allow users to tell you about potential problems with your operating system.
Tips:
- Do not start an operating system project in order to begin learning programming. No. Uh-uh. Do not. If you don't already know C, C++, Pascal, or some other suitable language inside out, including pointer manipulation, low-level bit manipulation, bit shifting, inline assembly language, etc., you are not ready for operating-system development.
- It may be a good choice to make a completely new partition for developing the OS.
- Check for potential deadlocks and other bugs. Bugs, deadlocks and other problems will affect your Operating System project.
- If you want an easy way, consider Linux distros like Fedora Revisor, Custom Nimble X, Puppy Remaster, PCLinuxOS mklivecd, or SUSE Studio and SUSE KIWI. However, the operating system you create belongs to the company who started the service first (though you have rights to distribute it freely, change it and run it however you like under the GPL).
- After all development is done, decide if you want to release the code as open source, or proprietary.
- Use websites such as OSDev and OSDever to help you develop your own operating system. Please note well that for most purposes, the OSDev.org community would prefer that you stick to using their wiki, and do not join the forum. If you do decide to join the forum, there are prerequisites: You are required to thoroughly know C or C++, and x86 Assembly language. You must also understand general, and complex programming concepts such as Linked Lists, Queues, etc. The OSDev community, in its rules, explicitly states that the community is not around to babysit new programmers. If you are trying to develop an operating system, it goes without saying that you are expected to be a programming "god." You are also required to have read the processor manuals for the processor architecture you have chosen; whether x86 (Intel), ARM, MIPS, PPC, etc. The manuals for a processor architecture may be easily found using a Google search ("Intel Manuals", "ARM manuals" etc). Do not join the OSDev.org forums and start asking obvious questions. It will simply result in "Read the f*** ing Manual" answers. You should try reading Wikipedia, and the manuals for the various tools you wish to use.
- For more information, see these sources.
- Manual: Linux From Scratch
- Bootloader: GRUB
- Virtual machine applications: Bochs, VM Ware, XM Virtual Box.
- Processor manuals: Intel manuals
- OS development sites: OSDev, OSDever
0 comments: