How to Make a Computer Operating System 4/22/12

Transcription

How to Make a Computer Operating System 4/22/12
4/22/12
12 Tips on How to Make a Computer Operating System - wikiHow
the how to manual that you can edit
How to Make a Computer Operating System
An Operating System tells the 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 daunting
to do this 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. 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.
Steps
1
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.
2
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.
3
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.
4
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.
5
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 the hardware
and the BIOS, it may set you back on the programming of the actual kernel.
6
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++ contains keywords that needs
another fully built OS to run. Don't use it.
7
Start small. Begin with small things such as displaying text and interrupts before moving
on to things such as memory management and multitasking.
8
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 Unix systems have at least partial
support for POSIX, so it would be trivial to port Unix programs to your OS.
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.
10
After all development is done, decide if you want to release the code as open
source, or proprietary
11
If you want an easy way. Consider Linux distros like Fedora Revisor, Custom Nimble X,
Puppy Remaster, PCLinuxOS mklivecd, or SUSE Studio[1] and SuSE KIWI. However, the
operating system you create belongs to the company who started the service first.
Although you have rights to distribute it freely, change it and run it however you like (under
the GPL).
12
It's so tough but possible.(papaic)
www.wikihow.com/Make-a-Computer-Operating-System
1/3
4/22/12
12 Tips on How to Make a Computer Operating System - wikiHow
Tips
Do not wipe your hard drive completely. Remember, wiping your drive will clear out ALL your
data and its irreversible! 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. Three such VM applications are VMWare
(http://www.vmware.com ), the open source alternative bochs
(http://bochs.sourceforge.net ), and Microsoft Virtual PC (www.microsoft.com ; Microsoft
Virtual PC is not compatible with Linux). 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. 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.
In order to compile an operating system from C or C++ code, you will of course be using one
compiler or another. 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 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 and
that, if you choose to use it, you are wasting your time and if you ask questions on the forum
about the use of PE in a kernel you are also wasting everyone else's time.
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 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 fit for operating system development. Please, if such is the case,
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.
Do not expect that a proper operating system will be easy to build. There are, lots of times,
intricate interdependencies. For example, in order to make an operating system able to handle
multiple processors, your Memory Manager must have "locking" mechanisms in place to
prevent multiple processors from accessing the same resource at the same time. The "locks"
used for this will require the presence of a scheduler to make sure that only one processor
accesses a critical resource at any given time and all the others are made to wait. Yet the
scheduler depends on the presence of a Memory Manager. This is a case of a deadlocked
dependency. There is no standard way to solve problems like this; each operating system
programmer is expected to be skilled enough to figure out his own way of dealing with it. Do
not ask stupid questions about implementation details.
Last but not least it must be emphasized that if while reading this part of the article you find
that you're shrinking away, then you should either: (1) Man up and go do the right thing, which
is to read fully, and not skim, the manuals for your processor architecture and (2) read the
manuals for your development toolchain (compiler, linker, bootloader, etc).
Your second option is to quit, since it means that you are not a super-1337 programmer and
are going to be wasting both your, and everyone else's, time asking stupid questions and
getting the same answer: Read the f***ing Manual. You are expected to be up to par as a
seasoned sage of a programmer.
It is an excellent idea to 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.
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.
Check for potential deadlocks and other bugs. Bugs, deadlocks and other problems will affect
your Operating System project.
Release a "release candidate" so that users are able to tell you potential problems with your
www.wikihow.com/Make-a-Computer-Operating-System
2/3
4/22/12
12 Tips on How to Make a Computer Operating System - wikiHow
operating system.
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.
Syntax coloring code editor (use if you got no IDE)
Most importantly, you need a compiler.
Don`t Forget a Floppy Drive (not required)..
Related wikiHows
How to
How to
How to
How to
How to
How to
Computerize Business Operations
Get Started Programming in C Sharp
Learn a Programming Language
Build a Seti Supercomputer
Learn to Use Baltija
Be Self Learning
Sources and Citations
1. ↑ http://susestudio.com/
www.wikihow.com/Make-a-Computer-Operating-System
3/3