The simple OS is written from scratch in Assembly and C for x86 architecture. Project for "Basic of programming 1" course at Budapest University of Technology and Economics (BME).
Based on os-tutorial repo with some parts reworked and new added.
The goal is to learn how operating systems are working by making a simple OS. The development includes using Assembly and C programming languages, and concepts like boot sector, stack, interrupt, kernel, linked lists. No advanced OS development techniques/tools are used, everything is built from scratch. The system is not indented for production use and it does not serve any other goal except educational.
The system is able to run using QEMU (or other virtual machine). The system consist of:
- boot sector (written in Assembly)
- simple kernel, and dynamic memory allocation (written in C)
- IRQs (written in Assembly and C)
- minimal keyboard and VGA screen drivers (written in C)
- simple shell (written in C)
- minimal ATA driver for reading and writing from hard drive (written in C)
Dynamic memory allocation is implemented using linked list of memory sector (MEM_SEC) structs with default page size of 512B. Memory sectors could be reused or added. Two public functions are available in libc/mem.c
: kmalloc
and free
.
As the first part towards filesystem, simple ATA driver was created. All necessary information about ATA interface were taken from OSDev wiki article. Currently, driver is working only with primary drive, it can read and write sectors in PIO mode.
Root files structure:
boot/
- Assembly code related to booting and loading kernel.cpu/
- x86 CPU architecture related code (ports, IRQ, ISR)drivers/
- screen, keyboard and ATA driverskernel/
- kernel codelibc/
- functions to work with strings, memory, etc.Makefile
- file with commands to compile and execute OS image using QEMU
- Install
qemu
(download page). - Download
os-image.bin
file from the release page. - In console, run
qemu-system-i386 -drive if=ide,format=raw,file=os-image.bin,readonly=off
.
Follow this and after this tutorial to install necessary libraries.
Commands:
make run
- to compile and run.make debug
- to compile and run with GDB debugging.