A tiny 32-bit x86 PC operating system based on a monolithic kernel with some Unix-like features, written in a subset of C++.
Please note: This meta-documentation is still a work in progress :-)
A tiny desktop operating system, with Unix-like features, that is written in a C++ subset understandable for first-year TI students at Hogeschool Utrecht, such that it might be used in an educational context.
Where possible, performance and features are sacrificed to reduce complexity and increase readability. This should help the software be more understandable for use in an educational context. Nevertheless, important subjects from OS-courses at the Hogeschool Utrecht should be implemented.
Though it should boot fine on real hardware, RikaiOS is developed with an emulator or virtual machine in mind - the supported hardware is intentionally limited for the sake of simplicity.
An obligatory disclaimer: the OS may melt your motherboard and eat your pet mouse when run on real hardware, no warranties, yada yada, please read the disclaimer in the LICENSE file before running this on your family computer.
See the ./aux directory. Do not expect anything flashy though - it’s currently all serial terminal captures!
The OS with its current feature set was developed in a roughly 6-month period from february to july 2019.
RikaiOS is not yet a full Linux substitute ;-)
There are some features that need work or are currently being worked on (see also the Contributing section):
grep -ERn 'TODO|FIXME|XXX' src/kernel/src src/kernel/include src/user/Note that the goal of RikaiOS is to remain small: A network stack or USB driver for example will probably not be considered for implementation.
You need this software installed (on a Linux-ish host) to build and run RikaiOS:
Version numbers should be recent, especially for clang, llvm and lld. An Arch Linux Dockerfile is provided (thanks to @Peikos) that includes compatible versions of the above dependencies.
You may use GCC instead of Clang/llvm if you so desire, provided that you have
a GCC cross-toolchain for i686-elf. See src/kernel/Makefile for details on
how to switch toolchains.
| Directory | Description |
|---|---|
/src/boot | Bootloader (bootsector and stage2) |
/src/boot/utils | Bootloader installer |
/src/kernel | Kernel code |
/src/kernel/include | Kernel headers exposed to userland |
/src/kernel/include/os-std | OS standard library (math, containers, etc.) |
/src/user | Userland software |
/src/user/libsys | Userland C++ system library |
/src/disk | (FAT32) Filesystem available to the OS |
| Makefile | Description |
/src/Makefile | Builds everything, creates boot disks and runs emulators |
/src/boot/Makefile | Builds bootloader and installer |
/src/kernel/Makefile | Builds kernel |
/src/user/Makefile | Builds userland |
Every Makefile above includes (if available) a Makefile.local file in the
same directory. This allows you to override any toolchain executable names and
paths, and to optionally add additional targets.
Do not forget to pass -j 4 (or higher) to make to increase build performance
on multicore systems.
This builds the kernel and bootloader and creates a boot disk that is run with the QEMU virtualizer / emulator. A serial connection to the OS is opened in the terminal from which you run the make command.
make disk && make run
Currently, the OS shell and TTY driver do not have sophisticated line-editing
capabilities and command-line history support. For convenience, you can wrap
QEMU with rlwrap to make use of line-editing facilities on the host side of
things (strongly recommended):
make disk && rlwrap -a make run
In order to run in Virtualbox, do the following:
vdi target:make vdi
Then:
disk.vdi file as an IDE diskNow you should be able to start the VM through virtualbox.
Note that serial I/O may be difficult to get to work. The current OS version does not interact much with the screen and keyboard/mice by default.
Once you have the system up and running, you should see a prompt in the serial
terminal (if you have connected a monitor, a splash screen may appear as well).
You can interact with the OS using the serial terminal. To start, try the
help command.
A number of utility programs is provided on disk. View installed programs by
typing ls bin (assuming you are still in the /disk0p1 directory). All ELF
programs in /disk0p1/bin can be executed as commands without typing the full
path (think of it as an implicit $PATH directory). Similarly, any ELF files
in the working directory, such as forth.elf, can be run just by typing their
name.
To see how the utilities work, or to add your own, see the README file in the
src/user directory of this repository.
Pressing ESC on the keyboard (in the video window, not the serial terminal)
will enable the kernel shell, a built-in debugging utility. This can be used to
print various statistics and information on running processes and memory (see
the help help command when in kshell).
You can debug the kernel with either QEMU or Bochs:
See ./src/gdbrc for startup options (you may override this file path in a Makefile.local).
make disk && make debug
See ./src/bochsrc for configuration options (you may override this file path in a Makefile.local).
make disk && make bochs
ld.lld: error: unable to find library -lclang_rt.builtins-i386
locate clang_rt.builtins)kernel/Makefile.local, with contents:
LD_BUILTIN_DIR += /the/directory/containing/the/clang/libI understand that the publicly available documentation is currently limited, so please don’t hesitate to open an issue or to send me an e-mail.
Please open a Github / GitLab issue so we can make sure no effort is duplicated :-)
A process for this should be formalized in the coming weeks - there are some open issues/features that can definitely be worked on, with varying degrees of difficulty / size. I will document this soon™.
This project is licensed under the Apache license 2.0. Please see ./LICENSE for more information.
This operating system was written from scratch, with only the following exception: