PDA

View Full Version : I'm feeling like accomplishing something ambitious...



TandyMan100
April 3rd, 2009, 06:31 AM
Does anyone know of a good place to start for creating your own *nix OS? I would like to use this as an oppertunity to learn C. Is there any good places to start and get some information for this? I would like to base it on a standard unix kernal and filesystem so that I can still run linux apps on it.

Help appreciated.

84TAVeRT
April 3rd, 2009, 07:45 AM
http://www.gentoo.org/

it is a good place to start...

if you want to go deeper than that, i don't know :)

Vlad
April 3rd, 2009, 08:09 AM
Look up Linux From Scratch. That'll get you into the inside workings and all that. You basically start from the beginning and put it all together which sounds like what you're looking to do.

chuckcmagee
April 3rd, 2009, 09:12 AM
Back in 1976, a young guy conned my then boss into paying him to write a operating system. They don't say "26 MAN YEARS of work" for nothing. I tried to tell my boss that the amount of work in writing a OS from scratch was almost unbelievable. Mind you, I had made extensive modifications to assembler code in a IBM COBOL compiler by then. That task alone took me almost 6 months of 12 to 14 hour days, 7 days a week.

Anyway, as you guessed, one day it became clear that the young guy that said he would produce disappeared from sight (as in ran with the money).

Linus started in, what? 1991. Here we are in 2009, and Linux is finally becoming a fairly good product. Still has plenty of rough spots. My point? People really, really have no concept of just how much work writing a O.S. from scratch is. Device drivers are a prime example. It can take one or two people 5 years to finally get the code just right, and that's just a tiny chunk of code for one device.

mbbrutman
April 3rd, 2009, 09:31 AM
Which is why I giggle when somebody says that Windows sucks. ;-0

Yeah, everything is relative. But they all take an enormous investment in time and effort, and require very high levels of skills.

Mike Chambers
April 3rd, 2009, 09:51 AM
well you didn't lie, that IS ambitious. the more distros, the better but it will definitely be a royal pain in the blank. if you ever get this done, i'll try it but you have a lot of work to do if you want it to get me to switch from debian. :p

barythrin
April 3rd, 2009, 10:28 AM
but it will definitely be a royal pain in the blank

Ooh..ooh I know! Ass! Royal pain in the ass. Right? ;-)

I've typed about it before so I won't bore everyone with the same old news but yeah me a friend a few years (hmm.. that "few years" has probably grown a bit) ago tried writing our own OS from scratch. Quite an interesting project. I'd say a lot was kind of fun, but when you get to those "why isn't this working like it should?" stunts for several days with no progress it wears on you a lot. For obsolete systems and simple stuff, or even a bootable game it would still be fun. Bringing things up to current hardware and resources, that's when it became a lot of blank stares and rereading of paper. We though "ok, we'll change the processor into protected mode memory. What'll that be an instruction or something?" ... "um.. memory matrix.. wait *I* have to map out memory myself?? bleh" and the project died around there. We had it working after looking at other folks code and had it reading FAT12,16,32 file systems and added a debugger (something we actually needed to figure out some of our own coding errors). We used a few operating system development books, including Andrew Tanenbaum's texts, and a few books on assembly/hardware to get our BIOS/hardware interrupts down. The interesting part was we couldn't use DOS interrupts so it kept us in only a segment of our books on assembly. I was surprised how many people just assume if you write assembly you'd be in a Microsoft OS.

So yeah we already had an appreciation of "Yes, we may not like the marketing or costs, but MS does have the leading operating system and we agree why." but afterwards a better understanding of the work needed and done. It's doable and fun but to get a releasable product, and to compete with what's out right now is extremely low probability.

Mike Chambers
April 3rd, 2009, 11:39 AM
Ooh..ooh I know! Ass! Royal pain in the ass. Right? ;-)

I've typed about it before so I won't bore everyone with the same old news but yeah me a friend a few years (hmm.. that "few years" has probably grown a bit) ago tried writing our own OS from scratch. Quite an interesting project. I'd say a lot was kind of fun, but when you get to those "why isn't this working like it should?" stunts for several days with no progress it wears on you a lot. For obsolete systems and simple stuff, or even a bootable game it would still be fun. Bringing things up to current hardware and resources, that's when it became a lot of blank stares and rereading of paper. We though "ok, we'll change the processor into protected mode memory. What'll that be an instruction or something?" ... "um.. memory matrix.. wait *I* have to map out memory myself?? bleh" and the project died around there. We had it working after looking at other folks code and had it reading FAT12,16,32 file systems and added a debugger (something we actually needed to figure out some of our own coding errors). We used a few operating system development books, including Andrew Tanenbaum's texts, and a few books on assembly/hardware to get our BIOS/hardware interrupts down. The interesting part was we couldn't use DOS interrupts so it kept us in only a segment of our books on assembly. I was surprised how many people just assume if you write assembly you'd be in a Microsoft OS.

So yeah we already had an appreciation of "Yes, we may not like the marketing or costs, but MS does have the leading operating system and we agree why." but afterwards a better understanding of the work needed and done. It's doable and fun but to get a releasable product, and to compete with what's out right now is extremely low probability.

interesting, do you have a copy anywhere i could try on one of my ancient machines? :)

and yes, MS operating systems are entirely under rated. i'm a linux fanboy, but truth be told, windows is pretty amazing and as far as ease of use for the average user it is far superior in every way to linux. linux is perfect for technogeeks and server admins, but most people want an OS that "just works" ... and MS has done a ridiculously good job of making that possible.

DreadStorm
April 3rd, 2009, 04:51 PM
I had dreams once of making an operating system. Up until the time I had fun with Toshiba's DOS 4.01 that I mentioned in another post. It was then that I realized how difficult it would be when I decompiled it.

Anyone that dares such an undertaking has my full support.....and my sympathies. heh

Ole Juul
April 3rd, 2009, 06:47 PM
Does anyone know of a good place to start for creating your own *nix OS? I would like to use this as an oppertunity to learn C. Is there any good places to start and get some information for this? I would like to base it on a standard unix kernal and filesystem so that I can still run linux apps on it.

There's a standard unix kernel?

I'm not a programmer, but Andrew Tanenbaum's books are obviously classic if you want to "write" an OS - thats what Linus did. However, it sounds more like you're looking to put together another Linux distribution in which case you might want to go with Linux From Scratch (http://www.linuxfromscratch.org/) by Gerard Beekmans. Actually, why now join one of the many many little distributions that realy really need more manpower? :)

TandyMan100
April 10th, 2009, 07:47 AM
Perhaps we could all band together and create a Vintage Computer Linux Distro!! Those of you wizard programmers could keep busy, and us n00bs could *gasp* learn something! I wouldn't be much help with the kernal, but I might be able to help with the GUI. We should model it after a classic gui. What do you guys think? It could come pre-installed with DOSBox and MESS, and perhaps more.

So, what GUI should it be modeled after, what software should come on it, and ARE YOU UP TO THE CHALLENGE?!?!?!?!?

Chuck(G)
April 10th, 2009, 10:41 AM
There's a standard unix kernel?

Linux isn't Unix and I think Linus Torvalds would be the first to tell you this. There are some strong resemblances in the implementation, but they're different OSes. Linux probably would not be anything other than a footnote if it weren't for the collateral developed over many years by Unix.

The closest thing to a "standard" Unix are those using the "Berkeley" system (e.g. 4.2BSD) as their basis (FreeBSD, BSD386, NetBSD, OpenBSD). Source code is available for most of these. BSD is also the basis ISTR of Mac OS X.

Of these, NetBSD is probably the one that most vintage computer users will find useful--it runs on most relatively recent (even "vintage") 32-bit platforms. The web site is http://www.netbsd.org

However, if you've got an old PDP-11 system, there are still sources and binary distros from The Unix Heritage Society (http://www.tuhs.org/).

Vlad
April 10th, 2009, 12:40 PM
UNICOS and Sun Solaris are pretty close to Sys V but no one around here is going to have a use for UNICOS (that I know of) and Solairs is a pain for a home user. (Package management makes me want to stab something) OpenSolaris is friendlier to someone who wants to get closer to UNIX but I just stick to the BSD's. I don't know enough about Irix beyond it was fun to play with but I'd assume itís a descendent of Sys V somehow as well. Shame its EOL.

Also "Linux" isn't an OS, its just a kernel so you're gonna need a compiler and tool chain to get much further. :rolleyes:

Vlad
April 10th, 2009, 12:54 PM
I'll admit I had toyed with the idea of doing this before but I never had the time to bother with it. Could be interesting though, I've seen other online communities band together to make a Linux based OS before. It'd take a lot of time and effort to do it right though.


Perhaps we could all band together and create a Vintage Computer Linux Distro!!

TandyMan100
April 10th, 2009, 02:00 PM
I'll admit I had toyed with the idea of doing this before but I never had the time to bother with it. Could be interesting though, I've seen other online communities band together to make a Linux based OS before. It'd take a lot of time and effort to do it right though.
Perhaps we could modify an existing Linux disto, then? Or we could start with something small, like a floppy linux disto that just boots up and gives you a text-mode menu interface? That would be the best starting point. Start with a floppy linux disto, and the build it into something more, something.... ...spectacular, something.... ....that's ours.

I'm a good inspirational speaker :rolleyes:

TandyMan100
April 10th, 2009, 02:08 PM
This would be a good starting point: http://blueflops.sourceforge.net/

I have used it myself, and like it quite a bit.

Ole Juul
April 10th, 2009, 02:22 PM
This would be a good starting point: http://blueflops.sourceforge.net/

I have used it myself, and like it quite a bit.
Now you sucked me into it. :) I shouldn't be doing this today, but the 2.8meg zip file just came down so fast ....

Terry Yager
April 11th, 2009, 01:10 AM
I'm a good inspirational speaker :rolleyes:

I'm not inspired...:rastarolleye:

--T

mbbrutman
April 11th, 2009, 07:01 AM
Perhaps we could modify an existing Linux disto, then?

Why? What problem are you trying to solve, or what need are you trying to fill?

There are so many things that I would have as a higher priority. Scanning old documentation, preserving old software, and picking up the skills needed to keep these old 8 and 16 bitters running. The world don't need another Linux distribution, there are already more out there than there are Linux users.

Vlad
April 11th, 2009, 07:32 AM
That's the main reason I never bothered with it. Too many other things take priority over making the billionth and a half distro.

cosam
April 11th, 2009, 10:59 AM
Building the distro is the easy part; maintaining it is the real time sink. Maybe instead of creating the 10^x+1st new distro, you should look into standing on the shoulders of an existing one.

I'm thinking along the lines of how Ubuntu is magically transformed into Xubuntu (of some other "sub-distro") by installing just one package. Better said: a meta-package which depends upon a whole set of packages which modify the user interface and/or install software specific to that distro.

TandyMan100
April 11th, 2009, 11:04 AM
Building the distro is the easy part; maintaining it is the real time sink. Maybe instead of creating the 10^x+1st new distro, you should look into standing on the shoulders of an existing one.

I'm thinking along the lines of how Ubuntu is magically transformed into Xubuntu (of some other "sub-distro") by installing just one package. Better said: a meta-package which depends upon a whole set of packages which modify the user interface and/or install software specific to that distro.
That's kind of what I'm thinking of doing with that linux distro I posted. A few TUI mods, some new software packages, and BAM!! The Vintage Computer Mini-Linux distro. I realise that this is not really important, but, if I may point it out, neither was the Vintage Computer Game that *i forget the name* made. It's just a fun little community thing. If you don't want to do it, you don't have to.

TandyMan100
April 11th, 2009, 11:05 AM
Now you sucked me into it. :) I shouldn't be doing this today, but the 2.8meg zip file just came down so fast ....
Good ol' broadband! It's an interesting little OS. I'll be interested to look at the C source code.

scorch
April 16th, 2009, 04:37 PM
Hi Tandy,

Instead of trying to write a YAOS (yet another OS), you might give some consideration to a little proggie called TCC (for Tiny C Compiler)

http://bellard.org/tcc/

This small compiler is fun to play around with, and a good learning tool. Once operational, it will even compile itself. The only problem is you have to bootstrap it onto your system. There are a couple of ways to accomplish this, but I'll leave it as a learning exercise for you.

Just a thot...

txomsy
April 8th, 2010, 02:48 AM
Goethe wrote that long ago. The full translation would be something like "Is it such a big mistery like Man, World and God? Not! But nobody dares to unveal it, hence it's still a mistery".

Writing and OS is not that difficult. It's been done over and again, and has become easier as tools have evolved. Many CS schools have OS courses where students are expected to write an OS or parts of it. Minix, Oberon, VSTa, Linux, OMU, and an endless list of OSes come to mind that were written by one person in a reasonable time. Even venerable old CP/M and the original DOS are said to.

What is costly is writing drivers for all possible existing hardware, and tweaking it for optimal speed. But if all you want is to learn the basics, that is no big deal.

As for the rest of arguments: first, define UNIX. If you mean a full bloated cluster, SMP, distributed, POSIX compliant system it certainly will take more time. If you mean UNIX v6 or v7 making a clone from scratch using only C might be done in a few months by a competent programmer. Even so, with adequate reasoning one might argue if anything beyond that is really needed inside the kernel. For someone wanting to learn, v6 (or MINIX) maybe a sensible project.

Next, define "programming". If you are going to do it in assembler as it was still done in the 70's I agree that it will be more difficult. If you allow using tools, moving to PL/I (or PL/M as for CP/M), C or C++ will certainly help speed up development, mostly so if you rely on Minix or Oberon books. If you add more tools, it becomes even easier: Sprite over Mach took about 6 student months to develop. Using L4 or similars and extra tools will certainly speed things up as well. It all depends on the tools. Even the machine itself can be a tool: a virtual machine like the one used for Nachos in teaching OS development simplifies things a lot as well.

Then, after all that, consider using your brain: even driver development needs not be a nightmare, you can hijack others' drivers, as L4 can do, or as happens with ndiswrapper, or you could implement hooks to a well defined DDK API... You would concentrate on true OS design decisions instead of low level details.

The point is, writing and OS is not difficult, what is difficult is making the right design decisions. And that is why people complains so much about Windows: even when they start from good design decisions MS tends to spoil them later on by bloating their OS and making it needlessly complex and inherently more buggy and difficult to maintain. MS persistently ignores the KISS principle to earn moot/imaginary marketing advantages, and that's their problem.

As for the OP, my advice would be: consider getting a copy of Tannenbaum's MINIX book or Wirth's Oberon books, have a look at the code of other similar OSes for inspiration (like VSTa, OMU, whichever), set up an emulator to start working and google the Net for some recent discussions on OS design principles. Who knows? You may end up with a great new idea that beats us all and brings us to a new OS era. At the very worst you may end up learning something -and maybe even get to write a few lines of code.

Raven
April 23rd, 2010, 06:26 PM
I was down this road several times, and what I learned then was "you need to know x86 assembly, or you cannot make a bootloader". I now know x86 assembly well enough that I could probably pull off a bootloader - perhaps I will attack writing my own little OS again sometime soon, but not now - first the sound project I mentioned elsewhere (if you don't know what I'm talking about don't worry about it, I'll make a big thread on it when I get going).

ajcc
May 3rd, 2010, 06:31 PM
Good ol' broadband! It's an interesting little OS. I'll be interested to look at the C source code.

Insanely much later, are you still thinking about making a floppy based Linux distrobution? Any change of plans or new ideas?

ppo
May 4th, 2010, 12:27 PM
If you start something, make sure you'll keep us updated with your progress.

I'm still a noob but would like to learn more about the making of an OS.