EDOS

EDOSx86_64

An operating system in Rust.

EDOS boots on UEFI, brings up every core on the machine, and drops you into a compositing desktop: a browser, an editor, a file manager and a package manager, over its own scheduler, filesystem, network stack, USB stack and window system.

/dev/ttyS0
  1. [0.000000] <cpu-0:kernel> Booting...
  2. [0.000000] <cpu-0:kernel> cmdline: "root=UUID=87654321-4321-8765-cba9-987654321fed rootfstype=efs"
  3. [0.000000] <cpu-0:kernel> Initializing frame allocator
  4. [0.000000] <cpu-0:kernel> Mapped kernel heap at 0xffffc00000000000-0xffffc00000100000
  5. [0.000000] <cpu-0:kernel> Initializing acpi tables
  6. [0.000000] <cpu-0:kernel> Initializing apic
  7. [0.000000] <cpu-0:kernel> Initializing hpet
  8. [0.000000] <cpu-0:kernel> APIC frequency: 999971485 Hz (999) MHz
  9. [0.000000] <cpu-0:kernel> TSC frequency: 3493742000 Hz (3.49) GHz
  10. [0.003893] <cpu-2:kernel> SYSCALL/SYSRET enabled
  11. [0.015329] <cpu-2:kernel> Initializing scheduler
  12. [0.022432] <cpu-2:kernel> [smp] AP online: LAPIC id 2
  13. [0.023745] <cpu-1:kernel> [smp] AP online: LAPIC id 1
  14. [0.027687] <cpu-3:kernel> [smp] AP online: LAPIC id 3
  15. [0.110638] <cpu-0:kernel> Reaper thread started (tid=1)
  16. [0.112039] <cpu-0:kernel> Evict kthread started (tid=2)
  17. [0.216985] <cpu-0:kernel> Scanning PCI devices...
  18. [0.219784] <cpu-0:kernel> Found 8 PCI devices
  19. [0.243031] <cpu-2:kernel> xhci: version 0.0, 64 slots, 8 ports
  20. [0.244978] <cpu-0:kernel> virtio-gpu: initialised, control=64, cursor=16, blob=false, irq=true
  21. [0.250968] <cpu-0:kernel> virtio-gpu: 1280x800 @ 74Hz
  22. [0.253084] <cpu-1:e1000e:k:6> e1000e: initialized, MAC 52:54:00:12:34:56
  23. [0.253110] <cpu-1:e1000e:k:6> net: dhcp: sending DISCOVER
  24. [0.253360] <cpu-1:e1000e:k:6> net: dhcp: received ACK, IP 10.0.2.15
  25. [0.285375] <cpu-1:hda:k:7> hda: /dev/dsp registered
  26. [0.285422] <cpu-1:ahci:k:4> AHCI CAP: SNCQ=true, NCS=31 (32 command slots)
  27. [0.285834] <cpu-1:ahci:k:4> Found SATA drive on port 1
  28. [0.287168] <cpu-2:kernel> xhci: initial enumeration complete
  29. [0.343483] <cpu-0:kernel> verify_kernel_no_phys_aliasing: 2737 kernel-half mappings, no aliases
  30. [0.353264] <cpu-1:window-input:k:14> Window input routing thread started
  31. [0.760503] <cpu-0:system-mount:k:15> Root partition: UUID=87654321-4321-8765-cba9-987654321fed on device 0
  32. [0.761005] <cpu-0:fs:k:13> efs journal: replay scan start tail_seq=1 tail_block=0
  33. [0.761138] <cpu-0:fs:k:13> efs journal: scanned, nothing to replay
  34. [0.761163] <cpu-0:system-mount:k:15> Root filesystem mounted
  35. [0.764001] <cpu-1:system-mount:k:15> Spawned bin/edos-init tid=18 cpu=3
  36. [Terminal] Spawned /bin/sh (PID: 29)

Verbatim serial output from a four-core boot, replayed at its own timestamps. The long pause is the PCI scan; the second one is mounting the root filesystem.

The EDOS desktop with the applications menu open, listing Terminal, Files, Editor, Web, Images, Play a sound, Snake, Packages and Widgets, over the file manager and the browser.
The applications menu over a file manager and a browser. Every window is a separate userspace process talking to the window manager over shared memory, and the menu is the panel's own, not the compositor's.

The applications menu

A browser, an editor, a file manager, a package manager.

Four graphical programs. Each is an ordinary std Rust binary with a main(), and each draws through the same toolkit. None of them lives in the compositor: kill one and the desktop stays up.

The EDOS browser filling the screen, showing this site’s syscalls page: a heading, a two-column table of registers, and a syntax-coloured Rust listing of the syscall2 wrapper.

Browser edos-web

Type a URL, get the page. Links, history, images, tables and CSS, over HTTPS to the real internet; the page here is this site, fetched by the guest that drew it.

More

The EDOS graphical editor showing a Rust file: a file tree on the left, a tab strip, syntax-coloured code with line numbers, and two edited lines marked in the accent colour down the gutter.

Editor edos-edit

Open a file, change it, save it. A tree of the folder down one side, a tab per open file, and the code coloured by language.

More

The EDOS file manager showing /share/wallpapers, with a thumbnail of the selected image, its size in bytes, its modification time and the volume it lives on in the details pane.

File manager edos-files

Move around the disk without typing a path. Every mounted volume down one side, and a pane that previews the selected image and says how big it is and where it lives.

More

The edos-grab window: a search field and an Update button above a list showing edos-edit with its icon, version and summary, and a detail pane on the right giving the version, category, size, the paths the package installs, and Install and Remove buttons.

Packages edos-grab

Search for a program and install it. Removing one takes back exactly the files it wrote, and nothing installs unless its checksum matches the signed index it came from.

More

The shell is a scripting language: functions, arithmetic, globbing, heredocs and job control, with every block closed by end rather than fi and done.The language reference.

ps, on an idle desktop

The kernel's own thread table is the feature list.

Nothing below is a wrapper around someone else's driver. Each of these threads is spawned by name at boot, and each one is a subsystem written for this kernel.

PIDNameWhat it does
1reaperTears down dead threads and releases their file descriptors and mappings.
2evict-inodeDoes the blocking half of inode eviction, so no drop path ever waits on disk.
3kloggerDrains the kernel log ring into /dev/klog, which is what dmesg reads.
4ahciSubmits and completes NCQ commands, up to 32 tags in flight at once.
5xhciRuns USB transfers: HID keyboard and mouse, and mass storage.
6e1000eMoves Ethernet frames and drives DHCP and DNS.
7hdaIntel HDA playback, exposed as /dev/dsp.
8vgavirtio-gpu scanout and the hardware cursor.
9tcp-retransmitTCP timers: retransmission, delayed ACK, and TIME-WAIT expiry.
10keyboardDecodes scancodes into key events.
11mouseReads HID boot-protocol reports and moves the pointer.
12block_writebackFlushes dirty pages, gated on the journal having committed.
13journal_committerCommits EFS metadata transactions.
14fsVFS work that cannot run inline: mounts, evictions, async page fill.
15window-inputRoutes keyboard and pointer events to the focused window.
17ahci_watchdogCatches NCQ commands that never complete.

A filesystem, not a port

EFS is an extent-based filesystem with a metadata journal, written for this kernel and formatted by efs-mkfs, which runs on the host and inside EDOS. Mounting replays the journal when the last shutdown was unclean. Above it sit a page cache, a block cache, write-back gated on journal commits, and read-ahead; below it, AHCI with native command queuing.

How EFS works

A terminal showing df, mount and stat output in EDOS.

A network stack that talks to the internet

Ethernet, ARP, IPv4 with fragment reassembly, ICMP, UDP and a TCP state machine, plus DHCP and DNS clients. The guest takes its address from DHCP within a millisecond of the NIC coming up. The same driver runs on real Intel I219 and I218 hardware.

Inside the network stack

A terminal in EDOS running ping, dns and wget against the internet.

The desktop is userspace

The kernel owns a window registry and routes input to whichever window has focus. Everything you can see is an ordinary process: edos-wm composites and draws decorations, edos-taskbar and edos-terminal are separate programs, and they share pixel buffers with the compositor through shared memory.

How the window system fits together

The EDOS widget toolkit demo window with buttons, a text input, checkboxes and sliders.

50 seconds, no cuts

Driven from outside the guest

A shell, the file manager over /bin, the package manager fetching the editor off this site, and the browser reading the page that lists it. Recorded straight off the framebuffer over QEMU's monitor socket: keystrokes and pointer events go in, frames come out. It is how the OS gets tested.

The tree

What is actually in here

Rust
115,794 lines across 479 files
Kernel
53,634 lines, no_std, one binary
Userspace
132 programs on a forked Rust std
Syscalls
124, through SYSCALL/SYSRET
Targets
x86_64-unknown-none, x86_64-unknown-edos
History
1,660 commits

Get it running

Build it, then boot it

git clone https://github.com/edg-l/edos-v2
cd edos-v2
make all      # userspace, kernel, bootable ISO
make run      # QEMU: q35, UEFI, KVM, 4 cores

The kernel builds on plain nightly. Userspace links a real std, so it needs a custom toolchain built from a Rust fork; the build guide walks through it. Prefer a prebuilt image? Downloads.