A simple 32 bit graphical OS written in C++.
- Install python3, make
- You will need to build a i686-elf-gcc cross compiler. There are not fixed requirements for it, so long as the commands
i686-elf-gcc
,i686-elf-ar
,qemu-system-i386
are in thePATH
. See this page on how to do that. - To start the kernel, run
make build && ./cmds/run.sh
The system is by no means well tested, it works on my machine and that's about as much as I can guarantee :) It also comes originally from here, which may be of interest if something does not make perfect sense, as I may not have written it.
(this is out of date)
src - The root of all source code
kernel
arch/i386 - Mostly boot code for the kernel.
include/kernel - Mapped into sysroot/usr/include/kernel on build
kernel - Kernel C++ source
hardware - Code relating specifically to interacting with hardware devices, whether that is the CPU, keyboard, mouse, monitor or something lower level
libc
arch/i386 - At the time of writing contains only the crt0
include - Mapped into sysroot/usr/include on build
user - All userspace code goes in here
windowserver
server - The server process
client - The client windowserver library
utils - Code accessible by both the server and the client
calc.c - A simple GUI calculator
dock.c - An application started by the windowserver which opens other apps
font.c - Font viewer
guiapp.c - A demonstration of windowserver code
hello.c - Probably won't work any more, was made for the command line interface which no longer exists
ps.c - Lists all running processes
shell.c - A shell for the command line interface
buildtar.py - Creates the .tar file which acts as the file system (for now)
(this is out of date)
- After building, you should see a folder (in the src directory) called sysroot, and a file named sysroot.img. Sysroot is effectively the root filesystem - it was populated by various programs, headers and any other files by the build process (
make install*
). buildtar.py then created a tar file of this (and removes thesysroot
root directory name). - QEMU will start the kernel in sysroot/boot/quarkos.kernel
- The very first line of kernel code is in kernel/arch/i386/boot.S, which pretty much immediately calls
kernel_main
, defined in kernel/kernel/kernel.cpp. This is the kernel entry point. - Ignoring logging, the first things we do are set up interrupts.
- First we PIC::remap in kernel/kernel/hardware/pic.cpp, pushing hardware interrupts into the range 0x20-0x30
- We then create the GDT
- Now we can create the interrupt handlers, most of them are defaults, with a few exceptions for specfic actions, which we send to be loaded into the CPU kernel/kernel/hardware/interrupts.cpp
- After this we can create the syscall_table, where the syscall implementations can be seen in kernel/kernel/syscalls
- Moving onto the initialisation of other things:
- PCI is a means of communication between hardware devices and the OS - kernel/kernel/hardware/pci.cpp
- BXVGA will provide the monitor support - kernel/kernel/hardware/BXVGA.cpp
- The disk - kernel/kernel/hardware/disk.cpp (although the filesystem itself is handled by kernel/kernel/ustar.cpp)
- The PS2 mouse and keyboard (though the keyboard doesn't really need to do anything)
- Initialise memory paging - kernel/kernel/paging.cpp
- Set up Multiprocessing - kernel/kernel/multiprocess.cpp
- Setup the terminal (only exists until the windowserver process has started, and not even before in this case) - kernel/kernel/tty.cpp
- We can finally read the windowserver from disk, decode it as an elf process, setup it's memory and schedule it as the first process
- Now we start the PIT, and the kernel has finished it's initialisation