The operating system allows the user to interact with the computer hardware. The system is made up of hundreds of thousands of lines of code. Usually the operating system is made using the C#, C, C++, and assembly programming languages. The operating system allows you to browse your computer while saving and executing commands. Don't think creating an operating system is easy. It takes a lot of knowledge to make it.
Step
Step 1. First of all, learn about programming
Assembly language is very important; it is highly recommended that you learn another complementary high-level language such as C language.
Step 2. Decide what media you want to use to load the OS
This media can be a CD drive, DVD drive, flash drive, hard drive, floppy disk, or another PC.
Step 3. Define the core idea of an SO
For example, on Windows, the core idea is an easy-to-use GUI and lots of security.
Step 4. Determine what processor platform your operating system will support
IA-32, ARM, and x86_64 are the most common platforms for personal computers. So, all of them are your best choice.
Step 5. Decide if you prefer to do everything yourself from scratch, or is there a kernel already available that you'd like to build on
For example, Linux from scratch is a project for people who want to build their own Linux distro.
Step 6. Decide whether you will use your own boot-loader or a pre-built one such as the Grand Unified Bootloader (GRUB)
Encoding the bootloader yourself will require extensive knowledge of hardware and BIOS. As a result, this step may hinder the actual kernel programming schedule.
Step 7. Decide what programming language to use
It's fine to have an operating system in a language like Pascal or BASIC, but you should use C or Assembly. Assembly is very necessary, because some important parts of an operating system require it. On the other hand, the C++ language contains keywords that require other full SO to run.
To compile an operating system from C or C++ code, of course you will use one compiler or the other. Therefore, it is a good idea to consult the user guide/manual/documentation for the C/C++ compiler of your choice, whether included in the software or available on the distributor's website. You need to know a lot of complicated things about the compiler and, for C++ development, you need to know about the compiler's mangling scheme and its ABI. You are expected to understand the various executable formats (ELF, PE, COFF, basic binary, etc.), and understand that the exclusive Windows format, PE (.exe), is copyright protected
Step 8. Define your application programming interface (API)
One good API to choose from is POSIX as it is well documented. All Unix systems have at least partial support for POSIX. So connecting Unix programs to your OS should be easy.
Step 9. Decide on your design
There is such a thing as a monolithic kernel and a micro kernel. Monolithic kernels implement all services in the kernel, while micro kernels have small kernels bundled with user daemon deployment services. In general, monolithic kernels are faster, but microkernels have better fault isolation and reliability.
Step 10. Consider developing and working in a team
That way, it takes less time to solve more problems, which will probably speed up building a better OS.
Step 11. Don't wipe your hard drive completely
Remember, deleting a drive will erase all data on it irreversibly! Use GRUB or another boot manager to double boot your system with another OS until your OS is fully functional.
Step 12. Start small
Start with small things like displaying text and pause before moving on to things like memory management and compound work. Also make sure you make the 32 bit and 64 bit versions.
Step 13. Keep a backup of the last working source code
This step is useful as a safeguard in case something goes wrong with the current version of SO or development. If your computer crashes and won't boot, it's a good idea to have a second copy to work with so you can fix the problem.
Step 14. Consider testing your new operating system with a virtual machine
Instead of rebooting your computer every time you make changes or after sending files from your development computer to your test machine, you can use a virtual machine application to run your OS while your current OS is running. Current VM applications include: VMWare (which also has a server product available for free), open source alternatives, Bochs, Microsoft Virtual PC (not compatible with Linux), and Oracle VirtualBox.
Step 15. Launch the "release candidate" or Beta version
This step will allow users to notify them of potential problems with your operating system.
Step 16. The operating system should also be user friendly
Make sure you add user-friendly features, make these an integral part of your design.
Tips
- Check for potential deadlocks and other bugs. Bugs, deadlocks, and other issues will affect your operating system build project.
- Make sure you implement security features as a top priority if you want the system to run properly.
- Use websites like OSDev and OSDever to help you develop your own operating system. Please kindly note that for most purposes, the OSDev.org community will be more than happy if you use their wiki, and not join the forum. If you decide to join a forum, there's a prerequisite: you need to really know about C or C++, and the x86 assembly language. You should also understand general and complex programming concepts like Linked Lists, Queues, etc. The OSDev community, in its regulations, explicitly states that its community is not created to nurture new programmers.
- Don't join with the OSDev.org forum and then ask the obvious question. You will only be asked to read the guide. Read Wikipedia and the instructions for whatever equipment you want to use.
- If you're trying to develop an operating system, you're definitely considered the "god" of programming.
- You should also have read the processor manual for the processor architecture you have selected; whether x86 (Intel), ARM, MIPS, PPC, etc. Manuals for processor architectures are easy to find using a Google search ("Intel manual", "ARM manual", etc.).
- Once all development work is complete, decide whether you want to release the code as open code, or by copyright.
- Don't start an operating system project to start learning programming. If you don't know inside and out about C, C++, Pascal, or some other suitable language, including pointer manipulation, low-level bit manipulation, bit shifting, inline assembly languages, etc., you're not ready for operating system development.
- Creating an entirely new partition to 'expand' SO might be a good option.
- If you want an easy way, consider Linux distros like Fedora Revisor, Custom Nimble X, Puppy Remaster, PCLinuxOS Mk LiveCD, or SUSE Studio and SUSE KIWI. However, the operating system you create belongs to the company that started the service first (although you have the right to freely distribute it, modify it and run it as you wish under the GPL).
Warning
- You won't get a full operating system within two weeks. Start with a bootable SO, then move on to cooler stuff.
- Carelessly writing your operating system on a hard drive can completely damage it. Be careful.
- If you do something that's not recommended, like write random bytes on random I/O ports, you'll crash your OS, and (in theory) could scorch your hardware.
- Do not expect that the operating system is easy to build. There are a lot of complicated interdependencies. For example, to create an operating system capable of handling multiple processors, your Memory Manager must have a "locking" mechanism to prevent multiple processors from accessing the same resource at the same time. The "lock" used for this would require a scheduler to ensure that only one processor accesses critical resources at any given time and all others have to wait. In fact, the scheduler depends on the presence of the Memory Manager. This is an example of a dead end dependency. There is no standard way to solve this kind of problem; every operating system programmer is expected to be skilled enough to know his own way of dealing with it.
Additional Resources
- Guidelines: Linux From Scratch
- Bootloader: GRUB
- Virtual machine applications: Bochs, VM Ware, XM Virtual Box.
- Processor manual: Intel manual
- SO development sites: OSDev, OSDever