Skip to content

A write-up of making a simple OS kernel. (A bit more advanced than bare bones, but simpler than meaty skeleton)

Notifications You must be signed in to change notification settings

pauljoohyunkim/prototype-os-1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

prototype-os-1

A write-up of making a simple OS kernel. (A bit more advanced than bare bones, but simpler than meaty skeleton)

It was inspired as Meaty Skeleton tutorial already had too much implemented for demonstration, and I wanted something that can be studied more easily.

So hopefully, it is easier to follow compared to Meaty Skeleton.

Description

This is an operating system kernel that is written based on Meaty Skeleton tutorial, but shaved down so that it implements barely enough features so that you can expand its functionality.

In fact, it does not feature libc functions like printf. Instead it offers functions like protoprintf where you need to supply both the pointer to the string array, and the length, and it does not allow any other data types.

I would say it is somewhere between Bare Bones and Meaty Skeleton level of complexity.

Building the Kernel

Before building this project, I highly recommend you read through the Bare Bones and possibly the Meaty Skeleton, as this project is somewhat in between.

However, you can follow along without having read, as the build system is made to be very simple.

Step 1: Build a cross-compiler

To build this project, you need a cross-compiler. (If you've done this before, skip to source environment.)

You could follow GCC Cross-Compiler, which is highly recommended for first-timers, or use my "experimental" and demonstrative build-cc-toolchain.sh.

# This downloads the most recent version of GCC and binutils, and compiles it.

./build-cc-toolchain.sh

This will build a GCC cross-compiler at this project directory at opt/cross.

Then you can activate this cross-compiler by

source environment

where environment defines PREFIX, TARGET, and PATH so that you can use the cross-compiler more easily.

Step 2: Build Kernel

To actually build the kernel, navigate to the os-src directory, and run make.

cd os-src
make

Then you should see myos.kernel.

Step 3: Testing out the Kernel

To boot it using qemu, run the following command

qemu-system-i386 -kernel myos.kernel

Depending on your QEMU setting, it may run the kernel immediately, or it spawns a VNC instance, where you will have to use VNC client to view.

Screenshot of QEMU running Kernel

Note

The goal of this repo is not to "build" on this. The point is that this serves as a learning path of OS development.

If you are thinking of creating an operating system kernel, I would suggest you actually read through many resources and structure it more cleanly before starting.

About

A write-up of making a simple OS kernel. (A bit more advanced than bare bones, but simpler than meaty skeleton)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published