How would you go about building your own Operating System?
Posted Jul 28, 2008, 2:20 AM UTC
Posted Jul 28, 2008, 2:20 AM UTC
I'm not talking about things like linux from scratch, but actually coding your own operating system. Anyone have any good books/websites?
(I'm not talking about creating a hugely complex kernel/os like linux, just something relatively small that runs on a predetermined set of hardware.)
Alternatively, complete the projects from the course of the same name at CMU: http://www.cs.cmu.edu/~410/
LOL. Just curious - where did Tanenbaum get his bootstrapping from? ;-) .. I think that would help the d00d more than this tome.
I dunno... where?
You'll need to write a kernel. Most kernels are written in C, with the essential bootstrapping parts in assembly. Here's a good wiki on the subject.
Isn't the kernel the operating system?
[deleted]
I smell a "Linux vs. GNU/Linux" fight brewing.
So by changing a basic application, you change the OS? Windows 8 changelog: new icons on wordpad.
By far the best resource I've found on this subject is Hoare's "Communicating Sequential Processes".
This is a very theory-heavy book; focusing more on the "why" than the "how". However, if your goal is learning, then this is the way to go. I implemented my own little OS before reading this book, but I found that going through it and doing the exercises gave me a deeper understanding of multitasking than I got from my OS project.
I'd start with a floppy disk.
This showed up on reddit a few months ago: http://www.reddit.com/comments/6f6rl/ and looks like an interesting starting point.
Become familiar with the GRUB boot loader, and launch your program (Operating System) from there. You could look at the main code of the Linux kernel to see how minimal you can make it, to start with.
Here's somebody who did just this and wrote a descriptive book including all source code. http://www.ipdatacorp.com/mmurtl.html There are alos other books that do that same for RTOS's, but I don't remember the names right now.
I was going to recommend MMURTL as well.
Here is a link to MIT's graduate operating systems course. If you more or less follow the labs, by the end you will have written your own operating system. There are some groups out there that you can google that have mailing lists to discuss the class if you have problems.
The class website comes complete with reference materials, source code, emulation software, and many seminal academic papers throughout the history of operating systems. I guarantee you that if you actually go through and work through the labs (it might take you the better part of a few months, it's a graduate level class meant to take a whole semester), you'll have an excellent knowledge base to go on and start hacking on real-world systems.
Oh, one more thing. The MIT OS labs have been ported to many other courses at other universities, so if you get lost, you can google for the equivalent courses at other universities and often times you'll find slight variations on the projects that may help you get past certain tricky concepts. I wouldn't recommend looking at Linux kernel code just yet, it's complicated, not well documented, and filled with many little optimizations that are counter-intuitive until you understand the basic concepts of what's going on.
Step 1. Put on robe and wizard hat.
This appears to be what the link I posted earlier is based on, except mine was the undergrad (albeit honors) version.
Very poorly.
There's two basic approaches here.
Write your own kernel. Go look at something like VSTa for reference. Eventually get it booting and printing "hello world". Watch as it fades into obscurity.
Use an existing kernel (Linux, BSD, etc). Get the benefit of hardware and driver support done for you. Build your own user layer over the top, and insulate the user from ever having to know about the kernel. Make millions. (see also: Mac OS X)
if you finish this project you will have a working os: http://www.cs.utexas.edu/~lorenzo/corsi/cs372h/07S/project.html
Try looking for information on "real time operating systems". You should be able to knock one together in a few sessions and it will teach you a great deal.
Here's another. RTOS's are fairly simple to write. http://www.micrium.com/products/rtos/kernel/rtos.html
Smart ass.
How to Write your Own Operating System
Now at Wired How-To Wiki.
An idea I have had is to start with the Xen system. You can let Linux do the hardware stuff in the hypervisor while you experiment with the middleware and API of your OS in a host OS.
Later you can add more lower level stuff.
Hell, if you're writing a kernel, you don't need the performance boost from xen. You could just as easily use qemu, vmware or something like that.
I wouldn't build an OS. They are meant to be like the roads and sewers in a city. Something most of do want to notice and just need to work.
Unless some of us are curious, or are maybe planning on working for the appropriate city department one day.
junior year, cs program.
check it out.
I've been messing around with a hobby kernel for just over a year. Here's what I've come across:
http://www.osdev.org/
http://www.osdever.net/
http://www.osdever.net/cottontail/
http://nondot.org/sabre/os/articles
Also, Andy Tanenbaum's book is great. Hardware-wise (accessing keyboard ports and such), a good book is The Indispensible PC Hardware Book, by Hans-Peter Messmer, though it's a bit outdated. Also, on this page, Intel document numbers 253665-253669 -- everything there is to know about the x86 architecture, assuming that's what you're developing for:
http://www.intel.com/products/processor/manuals/
[deleted]
Since you are into lists, I suggest taking a look at a page my OS prof pointed me to: http://tunes.org/Review/OSes.html