top | item 14125598

How to write a simple operating system

246 points| ingve | 9 years ago |mikeos.sourceforge.net | reply

59 comments

order
[+] roryisok|9 years ago|reply
I'm not sure why, but whenever I see a link pointing to sourceforge my instant gut reaction is that it'll be a decade+ aged code that doesn't work properly anymore. I always avoid sourceforge when searching for solutions. I don't know why I have this bias
[+] userbinator|9 years ago|reply
I have the exact opposite reaction: "This might be something that's been around for a long time, so it's probably more interesting than most of the vapid, insipid, overadvertised crap that passes for knowledge today."

...and indeed, this page has no ads and is in a very readable style, although it's actually quite new.

[+] justin66|9 years ago|reply
Because it's true in 90% of the cases?
[+] lacampbell|9 years ago|reply
Which is sad, that active open source projects are now synonymous with a single companies service built around a single VCS.
[+] nerdponx|9 years ago|reply
Same with Bitbucket, although maybe just 3-4 years instead of a decade.
[+] krat0sprakhar|9 years ago|reply
There's also "How to Make a Computer Operating System in C/C++" in a nice, readable Gitbook: https://samypesse.gitbooks.io/how-to-create-an-operating-sys...
[+] bogomipz|9 years ago|reply
What a great link! I have not seen this before. Thanks for sharing.
[+] mark_l_watson|9 years ago|reply
Nice. And the author started the project in high school?
[+] rbanffy|9 years ago|reply
If one is going to use an emulator to test an OS, why be confined to the x86 ISA and all the historic warts of the PC?

Design a decent computer first, then write an OS for it.

[+] CyberDildonics|9 years ago|reply
I don't want to understand how 'A' computer works, I want to understand how MY computer works.
[+] nickpsecurity|9 years ago|reply
Or just use a simple, stack machine. Or a RISC CPU. Preferrably on an emulator or FPGA already. Oberon did this.
[+] monocasa|9 years ago|reply
Honestly, the other platforms tend to be at least equally weird. Particularly given how there tends to be no way for for software to interrogate the hardware on most non-x86 platforms, so you have to just sort of hardcode topology (either directly in the kernel or in a device tree type file that you generate).
[+] alxmdev|9 years ago|reply
Well-written primer, so cool to see something complex reduced to its simplest form that captures the essence.

Funny to read how PC memory can be "millions of bytes on modern machines". To be fair, I was using a computer with only 128MB as recently as 7 years ago :-)

[+] analognoise|9 years ago|reply
To be fair, that's still millions of bytes.
[+] drewg123|9 years ago|reply
Awesome. We need resources like this to get people into low level programming.

The best class I ever took when I was an undergrad was a class where we built our own OS for a Data General Aviion workstation. Our systems staff was already under contract to help port 4.3BSD to the Aviion, and they had tons of test hardware and docs. So one of the group taught an OS class where whey basically turned us loose with a cross-toolchain and a manual and let us hack all semester. I think by the time we were done, we had something that booted and interacted with a very basic shell (but could not fork, no multi-tasking, no mem prot, etc).

If it were not for this class, I think the more theoretical OS class that I took later in grad school (all dreadfully boring queueing theory style stuff) would have turned me off to doing OS work. Instead, I've had a career doing lots of low-level stuff (drivers, OS ports to new CPUs, network stack improvements, etc).

[+] giancarlostoro|9 years ago|reply
Anyone know any such resources for the Raspberry Pi 3? Only found some for the first Raspberry Pi
[+] laumars|9 years ago|reply
Writing an OS for the Raspberry Pi is harder work that it should be because of the Broadcom SoC. It's a closed, proprietary chip that does a lot of the heavy lifting (including the initial boot mechanism). My advice to you if you want to write an OS targeting a developer board is to use one of the many open hardware platforms rather than the Raspberry Pi specifically. The Raspberry Pi's are better for tinkering with stuff that runs atop of the OS rather than designing kernels.
[+] Ultimatt|9 years ago|reply
Readers understand this isn't close to being an operating system right? You get the first boot sector of a floppy for free from the BIOS. This isn't even as complex as the most simple boot loader. It doesn't handle loading more sectors of the floppy let alone being like an OS.

It's hello world in assembly, loaded onto the first sector of an emulated floppy. That's neat, but nothing to do with operating systems. Other than you've now learnt the very first stage of bootstrapping from a floppy disk back in the 90s. Which is cool, and good info to know and start out with.

I get the vast majority of people seeing this post have probably only ever experienced nodejs, or Ruby on Rails or something equally high level. But this is trivial with respect to an operating system or even a boot loader.

[+] tbrock|9 years ago|reply
Seems cool, anyone know how this compares to similar projects out there? In thinking of doing an OS course soon as a refresher.
[+] z3t4|9 years ago|reply
I wonder if assembly languages will have a comeback now in the era of virtualization ... ?
[+] fellellor|9 years ago|reply
What kind of hardware would I require to do this project on my own?
[+] Jeaye|9 years ago|reply
That's not an operating system; it's a trivial kernel. Linux, in all its complexity, is still not an operating system; it's a kernel.

For anyone seriously interested in building something less trivial, I recommend starting here: http://wiki.osdev.org/Getting_Started

[+] gumby|9 years ago|reply
I've always thought of the operating system basically being everything in kernel space and as user space being peripheral.

I think we both have our biases.

[+] greenhouse_gas|9 years ago|reply
I think that it's a semantic thing, but most "simple OS in 24 hours" projects only talk about the kernel because the rest is easy/off-topic.

ls? Basic sh (without the scripting part, but there are tutorials on building compilers/interpreters)? Basic init?