DIOS stands for Desktop-oriented Independent Operating System. It is a minimalistic multi-tasking x86_64 OS written in D language with some small parts in NASM assembly. It is tested on a real hardware and emulators like VirtualBox and QEMU.
DIOS does not replicate either Unix or Windows. While some parts of the system are modeled after Unix and others are inspired by Windows, this is only to keep a degree of familiarity with existing systems for better user experience. The goal is not to create a complete clone of any OS. The purpose of DIOS is experimenting with system APIs and desktop environment design.
You can use DIOS as a basis for creating your own operating system! PRs implementing new features are welcome. The code is a bit messy but readable.
- DIOS is a monolithic kernel that contains all the device drivers in itself. It is mostly designed for modern computers and doesn't support legacy hardware
- DIOS is now 64-bit only, x86 support was dropped
- DIOS is planned as a graphical OS, but there's no built-in GUI toolkit yet. Graphical features are work-in-progress
- DIOS is an ELF kernel that requires a bootloader to run. Currently only Limine bootloader is supported
- Default workflow in this repo assumes booting from a GPT-partitioned USB mass storage device on UEFI systems. CD images are not generated anymore. Simply copy the contents of the
bootmediafolder to your FAT32 USB stick and make it the first boot device in UEFI settings - It is theoretically possible to install DIOS on a SATA disk, but this wasn't tested on hardware and the process is not streamlined; DIOS doesn't have a user-friendly graphical installer yet. As a practical matter, there is currently no reason for you to install the system permanently, but if you really want to, see installation.md for details.
Kernel:
- DIOS + Limine are compatible with both UEFI and BIOS (but the current build workflow supports only UEFI)
- UEFI GOP (or VESA) framebuffer
- SSE2, AVX
- IDT, GDT
- Bitmap page-frame allocator
- Low-latency HPET-based timer with legacy PIT fallback. Configurable system tick frequency (250 Hz by default)
- Minimal ACPI table reader
- I/O APIC, Local APIC
- CMOS date-time
- PCI enumeration
- Block device interface
- FAT32 (read-write) and exFAT (read-only)
- AHCI driver
- xHCI driver. USB keyboard and mouse; mass storage devices; USB hot-plug support; USB hubs support
- PS/2 keyboard and mouse
- A shell with built-in kernel commands; shell scripts
- Basic multi-tasking userspace in Ring 3; system calls; a simple standard library for applications
- Spawning processes from other processes
- Virtual filesystem; multiple mount points; any detected volume can be mounted as the filesystem root
- RAM filesystem image loaded from a TAR archive (
rootfs.tar) provided by the bootloader - SATA disk partitioning and FAT32 formatting
- Standard output channels
Userspace:
- Work-in-progress runtime library (ulib)
- Work-in-progress libc
- Graphics server (GFXD), windowed applications
- Work-in-progress desktop manager with a taskbar
- TTF font rasterization (with subpixel rendering support) based on stb_truetype
- A number of basic built-in applications.
After successful initialization, the kernel immediately starts the graphics server and runs its own shell at the background. You can always switch to the shell with Ctrl+F1 and back to graphics with Ctrl+F2. Available shell commands are listed here.
In the graphics mode, you can open a terminal window by pressing a launcher button. Terminal's possibilities are quite limited at the moment, but you already can run built-in programs. For example:
about- prints the information about the systemtime- prints current date and timefile /home/hello.txt- prints a text fileimage /home/lake.tga &- displays a TGA imageblackboard &- a simple sketching appclock- a digital clocktruetype /etc/fonts/LiberationSans-Regular.ttf &- TTF font rasterization demo.
Full list of built-in programs is here.
The repo also contains a number of simple examples of what can be done in DIOS userspace. They are included in the prebuilt ISO image:
hello- "Hello, World!" program that prints its argumentsmemtest- dynamic memory allocation testmath- floating-point math functions testrandom- random number generator test.
Applications are also written in D, but they actually can be written in any language that can make platform-independent ELF64 binaries.
DIOS project consists of a several structural layers, each with its own workflow.
src/kernelcontains the kernel codesrc/ulibcontains the ulib runtime library codesrc/usercontains built-in programssrc/demoscontains sample applications.
ulib stands for "user library". It is a low-level runtime for DIOS applications written in D.
Most of its functions are libc-like and self-explanatory. Full list of them can be found here.
GFXD is a graphics server and a window manager that allows other applications to create windows and draw graphics. It is a userspace program that must be present as /bin/gfxd.elf in the root filesystem.
When the kernel is started with gfx argument (first boot option in the list), GFXD is launched automatically. If you accidently booted the system in shell mode, you can start GFXD by running gfx start command. Ctrl+F1 switches back to the shell, Ctrl+F2 shows the server, Ctrl+F3 stops it.
import ulib.dios;
void main(string[] args)
{
uprintf("Hello, World!\n");
}ulib is currently statically linked; DIOS doesn't support dynamic linking yet.
DIOS uses its own build system written in Python that compiles the entire system. It does the following:
- Compiles the kernel (by default
bootmedia/kernel64.bin) - Compiles ulib (
bootmedia/lib/libulib.a) - Compiles userspace programs (
bootmedia/bin/*.elf) - Builds the root filesystem image (
bootmedia/boot/rootfs.tar).
Prerequisites:
Run python build.py to build everything.
Run python build.py kernel to build only the kernel.
Run python build.py ulib to build only ulib.
Run python build.py user to build only the userspace.
Userspace and sample programs (src/demos) can be built individually with DUB:
dub build
All *.elf binaries of the demos are automatically copied to bootmedia/bin.
Tianocore's Open Virtual Machine Firmware is required (OVMF.fd).
Create a USB stick image from the contents of bootmedia:
python build.py usb
Then run
qemu-system-x86_64 -cpu max,+rdrand -m 512M -bios OVMF.fd -vga std -device qemu-xhci,id=xhci -device usb-mouse,bus=xhci.0,port=1 -drive if=none,id=usbstick,file=usbstick.img,format=raw -device usb-storage,bus=xhci.0,port=2,drive=usbstick -display sdl,gl=on -d guest_errors
To test the installation, create a disk image:
qemu-img create -f raw disk.img 256M
Then run
qemu-system-x86_64 -cpu max,+rdrand -m 512M -bios OVMF.fd -vga std -device qemu-xhci,id=xhci -device usb-mouse,bus=xhci.0,port=1 -drive if=none,id=usbstick,file=usbstick.img,format=raw -device usb-storage,bus=xhci.0,port=2,drive=usbstick -drive if=none,id=hd0,file=disk.img,format=raw -device ich9-ahci,id=ahci -device ide-hd,drive=hd0,bus=ahci.0 -display sdl,gl=on -d guest_errors
This disk will be seen by the system as sata0.
VirtualBox requires images in VDI format, so you still need QEMU to convert raw *.img to *.vdi:
qemu-img convert -f raw -O vdi usbstick.img usbstick.vdi
Create a new virtual machine named "DIOS". Choose type "Other", version "Other/Unknown (64-bit)". It is recommended to set at least 512M of RAM.
In system settings, enable EFI. Add a USB controller and add a storage device to it. Use usbstick.vdi image.

