Rolling your own OS

Posted by Astryl on Aug. 16, 2012, 11:09 a.m.

I mentioned in my last blog that I was coding my own OS from scratch; so I decided I'd create a running series on the progress made with it.

First things first: One person creating an actually useful OS is very rare; I'm just doing this as a hobby-project.

Secondly, I'll explain bits of what I'm doing, so if you are an Assembly-phobe, run for dear life.

Let me introduce you to Alix

Fault page. I firmly believe that an OS must make sure to make the programmer feel like as much of a douchebag as possible for making stupid mistakes, not the Win8 'Something broke ;(' message.

Yes, that's the name of the kernel.

Why Alix? Because something in the back of my mind tells me that Unix->Alix makes logical progressive sense; and yes, I'm basing some of my design off the OpenBSD systems.

Anyway, here are the tools I'm using to do this:

> Any OS will do (Windows, Linux, DOS)

> DJGPP/GCC

> LD.EXE (Old 32-bit from the DJGPP package, or it's equivalent)

> Winimage (To easily create floppy images)

> VirtualBox

> Notepad++

> A ton of offline references for the x86 architecture and the standard BIOS calls.

The languages used are, by choice, Assembly (AT&T syntax, NASM), and C/C++ (C++ support will only exist when I feel like writing the new and delete operators).

Basic knowledge required for this exercise includes a deep understanding of the languages you're working with (Want printf()? Write it yourself. Need malloc()? Well if you can't write your own, give up now.), at least some knowledge of the basic layout of the Von Neumann architecture, the way the CPU communicates with the hardware, and of course reference guides for any hardware you wish to access, as drivers need to be made for each thing you want to support.

What I've done so far

Very little visibly. I've essentially got the PC into 32-bit protected mode, but I can't take credit for that. GRUB takes care of that minor annoyance.

Otherwise, I have my GDT (Global Descriptor Table, used for setting up Code and Data memory segments), and my IDT/IVT (Interrupt Descriptor/Vector Table).

I also have a nifty Blue Screen fault handler.

Otherwise, my focus tonight involves creating an easy to use interface to the System Clock, and a Keyboard driver.

Oh yes, I have the foundations for my memory management scheme layed out already; I'm using paged memory, because segmentation is a waste of time these days.

Some interesting links

If you're interested in these sorts of things yourself, take a look at these links.

Assembly is a must when it comes to OS development, but other languages can be anything that produces intermediate Object files; thus, D, Pascal and Basic are legitimate choices.

http://wiki.osdev.org/Main_Page

http://www.osdever.net/

http://en.wikipedia.org/wiki/Hobbyist_operating_system_development

Free E-Book

http://www.scribd.com/doc/15200312/MMURTL-V10

Comments

poultry 12 years, 3 months ago

Quote:
VirtualBox

Annndd I lost all of my ability to take you serious.

http://bochs.sourceforge.net/

Astryl 12 years, 3 months ago

Forgot to mention Bochs. I use VirtualBox for tests after the debug run in Bochs.

Bochs is definitely better when you're adding new code. Especially when that new code crashes, and I'd like to see the registers.

I'm using partedit/copy to create VHD images, which I use for HDD IO testing.

@Stevenup7002

I've been doing this on and off for the past few years, just as practice. But I decided last week to spend a bit of dedicated time on OS development, just as a way to sharpen my skills and to perhaps wind up with a Modular Kernel capable of executing ELF executables.

Astryl 12 years, 3 months ago

Added an interesting looking e-book I had forgotten about to the links. One day, we shall have OS/64…

svf 12 years, 3 months ago

You should do a stream. I'd definitely watch it.

Astryl 12 years, 3 months ago

Quote:
You should do a stream. I'd definitely watch it.
For one, there's not much to stream, and won't be for a long time.

Secondly, even though my internet connection speed is being upgraded and I'm running a cable to my PC directly next week, I still don't have the time to stream :P

I will post code-snippets though.

JuurianChi 12 years, 3 months ago

Josea 12 years, 3 months ago

Cool, I've always wanted to do this myself, but always thought it would be too time consuming to actually get into it.

Astryl 12 years, 3 months ago

Nice. :3

The overall design of my system is supposed to resemble a BSD style architecture, with the kernel using user-space programs to get things done driver-wise.

I fully intend to give each user an OS decided user-rating. Because I can.

Rob 12 years, 3 months ago

Quote: Stevenup7002
I made an OS called "Sendla" when I was around 12 years old.

I didn't even know what programming was when I was 12…

Nor did I have internet then either

sirxemic 12 years, 3 months ago

Why do the screens of death use the same font? (Stevenup's and Mega's)

How does that work?