Introduction

There seems to be quite a few people out there who want to create their own Operating System (OS), and more power to them!! ^_^ The aim of this Frequently Asked Questions (FAQ) is to hopefully provide enough information to point people off in the right direction.

This FAQ does not aim to teach you how to program a multitasking, multithreaded, distributed micro kernel OS, nor how to use C, C++ or any other programming language.

*SOME* knowledge of protected mode (for i386 machines) is assumed. Sorry.

This FAQ does concentrate on using GCC compiler however.

This FAQ is aimed at hobbyist programmers who just want to play around at creating an OS, actual theory on operating systems design and implementation is ignored ^_^. If you know it, good for you, if you don't, don't worry.

This FAQ is mostly a response to all the questions that appeared on the Operating System message board run by Josh McDonald.

 

Getting Started

First things first, Its best to have a good setup of GCC on your system. Linux automatically has all the utilities you could want but for a MS-DOS DJGPP installation, you may need to download some extra files.

Most of these files are secondary and may only be used once or twice but they come in very handy.

  • SED
  • GNU binutils
  • GNU File Utils
  • Grep
  • Patch / Diff
  • RCS / CVS
  • SH Utils / bash
  • Perl

This assumes you already have GCC, GPP, LD, etc.

It is highly recommended you get NASM assembler too.

 

What bits can't I make in C?

Depending on how you go about building your OS, you can't build your bootsector (bootloader) code in C, you have to resort to using someone else's code, or write your own code in assembler, be that in x86 Intel style or AT&T GNU style assembly language.

There is also a few CPU specific operations you cannot write in C, those being Interrupt Service Routines that return with IRET (on i386 machines) opcodes and other functions such as commands to load the GDT (i386) can be inlined but still require using assembly.

 

What order should I make things in?

This is a style question. You can start at the start and dig straight in by writing a bootsector then write a minimal kernel and build from there. Or you can write bits and pieces in no specific order and just put them together at the very end. There is probably no right or wrong way to go about doing it.

Myself, I started at the start and did the boot sector, wrote a tiny micro kernel loader, etc. I like to test and play with it as I develop it, I like to see it working.