The Kernel-Book



a really-quick-





open source and GPL

0.     preface. 3

1.     introduction. 3

2.     first steps to our own OS. 4

2.1.      project tree. 4

2.2.      how to build, how to test 5


0.   preface

Since the 90s of the last century, when the IA32 mircoprocessor 80386 DX/SX was cheap enough to put away all the 16 bit barriers. There was a need for a reliable 32 bit operating system. One half that is Linux. But where is our good old DOS, in which an application can take over the processor-control. We don’t need a new born DOS, but I think it must be possible to get this important advantage. First lets discuss wich way we want to go


1.   introduction

There are many basic ideas about kernel design:


·        It needs to be really fast

·        What ist POSIX?

·        SMP

·        Should boot other OS’es – may be initialize some special hardware

·        It needs to be small (512kByte is almost small – size of a normal Flash-EPROM is 512kByte)

·        I want load/unload device driver without reboot

·        It takes no/less booting time

·        Let us run realtime applications (like old-dos) – cooperative multitasking

·        Special case it can guarantee time for request-response – hard-realtime

·        Multitasking

·        This OS should be monitored by other Computers – so hardware may be shared

·        Stable – protected tasks


If someone has more ideas, we should list them in enumeration.


Unfortunately we cannot make an OS that give us all these opportunities. So my favourite target is a very fast realtime OS that guarantees the lowest possible respones times. Too bad the we must give the greatest advantages of the IA32 away: a stable OS with protected tasks. The virtual memory management unit brings a lot of opportunities like sperate memory space for each tasks but also problems estimate the response-times  - if you answer to a request, the code will be/will be not cached by MMU or not. If not, the MMU must lookup its tables first.


There is a ray of hope. We don’t need these restrictions all the day long. Most time a multitasking OS like Linux is a good choice. Therefore we can create a mix of some features – most time we are working with tasks – protected form each other;  sometimes we can switch to a single-task-mode (that is not interrupted by other tasks); if we need it hard, in that case the OS switches to hard-realtime-environment – with no virtual memory, guaranteed timings , but with less protection.


Together with rapid-booting (I don’t need a tv-set that needs 7 seconds to boot) these are my ideas for a kernel-development.


2.   first steps to our own OS

1.      OK now: Test environment: ref. Cap. 2.2

2.      Protected Mode Examples -

3.      implement a small kernel that represents the basic features that are: switching to protected mode, multitasking, virtual memory. Give the world a working example for protected mode programming.

4.      need a filesystem to boot from

5.      there any problems while booting from harddisk? 512MB, 8GB, next?

6.      a bootsector to boot the kernel (free from 512MB 8GB limitations)

7.      Important!!! At this moment the kernel is written in NASM as plain binary-image. Instead of that we should link several object-files and load this as a kernel. There are several formats e.g. Win P(ortable)E(xecutable) or ELF. Nevertheless we need a real kernel-loader


2.1.      project tree


Linux/Unix is a good environment for developing. But as long as Windows (especially Win9x) exists we want to support it as environment to. Needed tools are available for both systems, so it makes less problem to us.


current project tree

project path


+- quickos

|  + build.bat

|  + bochsrc.txt

|  + makefile.w32

|  +- obj

|  +- src

|     |

|     +- tutorial

|     |  + tutor1.asm

|     |  + tutor2.asm

|     +- boot

|        + bootsec.asm


+- tools

   + gzip386.exe

   + make

   + naswmw.exe

   + tar.exe

   +- bochs

      + bochs.exe

      + BIOS-bochs-latest

      + VGABIOS-elpin-2.40

      + VGABIOS-elpin-LICENSE





Make command for win32

Bochs settings

Makefile for win32

Put all the temoraries in




PM examples



Bootsecor that load a binary


At this moment win32 tools


Currently the project tree is divided into 2 several packages:



Includes all the nessesary Win32 binaries



current released sources


2.2.      how to build, how to test


Under Win32 you should use build-command instead of make. Before you start build you images change the project PATH in line 2 of build.bat (located in quickos-directory)


build [param]<enter> can be use with several parameters:



create all project targets including a file called


Run bochs with created images



Remove all the files, that could be made by rebuild. Its used before making an archive


After clean, a .tgz archive of the project-sources will bee made


Needed Win32 tools will be packed in a .tgz archive


The file can be started directly from plain-dos (no Himem.sys! and no EMM386! should be stay in memory) or its integrated together with a bootsector in a.img; ready to copy to disk.