TKTuna Kılıç
All projects

Tunix

A Unix like operating system for x86_64, written from the bootloader up. It now boots into a desktop, compiles its own software and installs packages.

In progressC · Assembly · Operating System · x86_64

Tunix running an Xfce session

Tunix started in June as a bootloader that printed one line and then hung. Two months later it boots to a graphical login, opens an Xfce session, and lets you compile a C file with GCC inside a terminal that the kernel is drawing itself. I still find that funny.

It is written in C, with assembly only where there is nothing else to reach for, and the whole image is built by a Makefile. No Linux underneath. The boot path, the memory manager, the scheduler, the filesystem layer and the drivers are all in the repo.

Where it is now

The root filesystem is a real ext2 partition on the boot disk, so it survives reboots and you can mount the image on Linux and poke around. The initramfs only seeds it on the first boot. There is a proper mount table behind mount and umount, with tmpfs, bind mounts and a /proc/mounts that reports what actually happened.

The scheduler runs on every processor the firmware reports, not just the boot CPU. Getting the other cores up and then keeping the scheduler honest across them was the single hardest week of the project.

Userland is GNU. Coreutils, grep, sed, gawk, findutils, tar, gzip, make, Bash, binutils and GCC are ported, along with nano and Lua. CPython 3.14 is built shared, so ctypes and C extensions load, and the test script exercises threads, subprocess, signals, sockets, epoll, mmap and sqlite3 to prove the syscall layer is not lying.

Networking does both ends of TCP. bind, listen and accept work, connect works, loopback is real, and the test runs a server and its client on the same machine over 127.0.0.1. On top of that there is a static curl built against mbedTLS, which gives curl https:// and git clone https:// from inside the OS. SSH remotes are not supported yet.

Some other pieces that took longer than expected:

  • Intel HD Audio playback behind ALSA's /dev/snd, with alsa-lib ported on top
  • dinit as PID 1, with services under /etc/dinit.d and dinitctl to poke them
  • Real users: per process credentials, permission checks, setuid binaries, login, su, passwd and sudo
  • Eight virtual terminals on Ctrl+Alt+F1 through F8, each with its own screen and keyboard state
  • LightDM with the GTK greeter, authenticating through Linux PAM
  • xbps as the package manager, installing from Tunix's own binary repository
  • A virtio-gpu driver, so the display is scanned out where it already lives instead of being copied every frame

Running it

git submodule update --init --recursive
make all
make run

make headless if you would rather not have a QEMU window, make run-gpu for the virtio-gpu path. The image ships with root / root and tunix / tunix.

What is next

Better hardware coverage, more of the userland ported, and a lot of cleanup in places where I clearly did not know what I was doing yet. The docs folder in the repo goes deeper on mounting, networking, SMP and the display manager.