This is my 5th term coursework on the "Operating Systems" subject at the Department of Computer Science and Technologies, Bauman Moscow State Technical University.
The main aim is to get acquainted with principle of OS kernel operation at low level.
As a sequence, develop minimal C libraries for I/O tasks (e.g., functions like putchat, printf, gets, scanf) and memory management (malloc, free, and so on).
Finally, write an app demonstrating their efficiency. The coursework was evaluated in mark 5/5.
Project building with Make tool. Makefile contains all the logic. Here are main steps:
- Kernel compilation from C source (32 bit);
- Disk image creation and partitioning (using ext2 filesystem);
- Installing grub into image via grub-install tool;
- Embedding kernel into image.
- A minimal OS kernel supporting Multiboot specification;
- Embedding grub2 bootloader;
- Input functions: getchar, gets;
- Output functions: putchar, puts; also printf function taken from other source;
- Cursor functions: disable_cursor, enable_cursor, move_cursor, update_cursor;
- Time functions: delay, sleeps;
- Memory functions: malloc, free;
- Random functions: rand, srand, rtc_seed;
- Example application: the Tetris game.
Get image file (disk.img) from latest release, then just write it to a USB or run with x86 emulator. For QEMU it is the following command:
spam@eggs:~$ sudo qemu-system-i386 -hda disk.img
Guide
- make
- gcc
- as
- ld
- grub2
- qemu
Linux. Currently developing and testing on Ubuntu 18.04 LTS minimal.
First make sure you have all tools listed in Dependencies block installed. Then do the following:
spam@eggs:~$ git clone https://github.com/nexterot/develop-os-free
spam@eggs:~$ cd develop-os-free
spam@eggs:~$ make
In case of errors, or just to clean the directory:
spam@eggs:~$ make clean
Also, the following command is an alias for make clean && make
:
spam@eggs:~$ make rebuild
To test it with QEMU emulator, run:
spam@eggs:~$ make run
losetup: bin/disk.img: failed to set up loop device: Device or resource busy
Find busy loop devices:
spam@eggs:~$ losetup -a
Then edit next lines in Makefile, changing '/dev/loop2' or\and '/dev/loop3' to any free loop device:
loop_first = /dev/loop2
loop_second = /dev/loop3
Finally do:
spam@eggs:~$ make rebuild