SchOS/docs/architecture
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Nexoniarz 2aef583aad Twelve login terminals, root only, console fixes, a faster build, a Niveus splash, and X back on evdev
- tty1-tty12 all run login; the image has only root. /dev/tty7..12 could not
  be written (cdev.c knew minors 10-16 only), which sent their jobs into a
  restart storm that took the supervisor down; fixed, and stat reports them as
  Linux's tty7..12.
- Erasing text at a prompt did nothing: erase_one sent a bare backspace, which
  only moves; it and the echo path now send back-blank-back through vt_feed.
- A white cursor block was left at the end of every line of a verbose boot:
  a line feed at the bottom scrolls the pixels, cursor included, and the
  cursor was erased after the scroll. It comes off first now. A blank cell is
  also marked dirty, which it was not.
- ldlsd died with a general protection fault on real hardware in its variadic
  log function: Linux module code calls with an 8-byte-aligned stack and an
  unset %al, and the prologue's movaps faults. LDLS guest code is built with
  -mstackrealign.
- make iso took over a minute for any change, because staging r8169 rewrote
  the same files and every mtime moved; it now replaces files only if their
  contents differ (about 10 s).
- The loader's splash is redrawn in the boot manager's style, and the boot
  manager shows its cursor whenever a pointer device exists.
- xf86-input-libinput is out of the image again: with it Xorg took both
  keyboard and pointer from libinput and, on the user's laptop, neither worked.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EVRhxi9zpdW2uDUN4FVcao
2026-10-26 17:43:44 +01:00
..
audio.md docs: architecture describes what is built now 2026-10-26 07:57:25 +01:00
boot.md Boot manager: drop the window lights, keep the title bar 2026-10-26 16:54:39 +01:00
debugging.md Boot manager: Niveus window, keys and wells, Instrument Sans, pointer, other systems, working power entries 2026-10-26 15:31:39 +01:00
desktop.md Twelve login terminals, root only, console fixes, a faster build, a Niveus splash, and X back on evdev 2026-10-26 17:43:44 +01:00
devices.md config/drivers.conf: which drivers are compiled in 2026-10-26 08:59:55 +01:00
fat.md vfs: names up to 255 bytes and paths up to 4096, like Linux 2026-10-23 11:17:28 +02:00
filesystem.md PCI and USB devices in the /sys/devices tree, with uevents and USB hot-plug 2026-10-26 15:51:28 +01:00
graphics.md Schcom is gone; the desktop path is Xorg now, Wayland groundwork next 2026-10-26 09:35:54 +01:00
init.md include: one folder per subsystem, and includes that name it 2026-10-23 15:05:12 +02:00
kernel.md Users and permissions: accounts, login, enforced file permissions, setuid, su, passwd, doas 2026-10-26 13:16:07 +01:00
ldls.md docs: 1.0 is reached; Schcom stays; Linux's r8169 set ships 2026-10-26 08:23:20 +01:00
networking.md eudev starts at boot; Xorg finds its input devices through it 2026-10-26 11:44:21 +01:00
packages.md docs: packages.md counts what world.lock actually holds 2026-10-26 08:08:25 +01:00
README.md Users and permissions: accounts, login, enforced file permissions, setuid, su, passwd, doas 2026-10-26 13:16:07 +01:00
scff.md SCFF: the live root ships compressed, with Xorg and Window Maker 2026-10-24 21:17:31 +02:00
scheduler.md Users and permissions: accounts, login, enforced file permissions, setuid, su, passwd, doas 2026-10-26 13:16:07 +01:00
schfs.md include: one folder per subsystem, and includes that name it 2026-10-23 15:05:12 +02:00
syscalls.md docs: architecture describes what is built now 2026-10-26 07:57:25 +01:00
terminals.md docs: README, plan, guides and the site describe what is built now 2026-10-26 08:08:05 +01:00
udev.md libinput, seatd and libseat; sockets from accept() can pass descriptors 2026-10-26 16:51:39 +01:00
usb.md docs: README, plan, guides and the site describe what is built now 2026-10-26 08:08:05 +01:00
users.md Twelve login terminals, root only, console fixes, a faster build, a Niveus splash, and X back on evdev 2026-10-26 17:43:44 +01:00

The system, layer by layer

What SchOS is today. Everything in this directory is built and running; what is merely intended lives in ../plan/.


The names, and what each one covers

uname -s reports SchIFT, the way every Unix reports its kernel rather than its distribution.

Layer Name What it is
System SchOS The distribution — kernel, userland, tooling
Kernel SchIFT Multi-core x86-64 kernel with a modular VFS
Filesystem SchFS Transactional, copy-on-write, the root filesystem
API SchAPI The native programming interface — designed, not built
Packages apk Alpine's package manager manages the root; SchOS itself is the package schos-base

Twelve virtual terminals sit under all of it -- /dev/tty1..tty12, Ctrl+Alt+F1..F12 or chvt N -- each with its own screen, line discipline and foreground process group. See terminals.md.


The stack, bottom to top

      ┌─────────────────────────────────────────────────┐
      │ Xorg + Window Maker · Alpine's packages (apk)   │   desktop, userland
      │ toybox  mksh  musl  first-party cmd/            │
      ├─────────────────────────────────────────────────┤
      │ vgpud, ldlsd — drivers that are ordinary        │
      │ processes (and Linux's r8169 inside ldlsd)      │
      ├─────────────────────────────────────────────────┤
      │  schinit — PID 1, job manifests, supervision    │
      ├─────────────────────────────────────────────────┤
      │  syscall table — Linux numbering, one .inc file │   ← the ABI seam
      ╞═════════════════════════════════════════════════╡
      │  VFS │ sockets │ signals │ mmap │ poll │ procfs │
      ├──────┴─────────┴─────────┴──────┴──────┴────────┤
      │  SchFS  │  lwIP  │  vt/gfx  │  buffer cache     │
      ├─────────┴────────┴──────────┴───────────────────┤
      │  device model — class vtables, bus binding      │   ← the driver seam
      ├─────────────────────────────────────────────────┤
      │  /dev/pci — MMIO, DMA and IRQs to a process     │   ← the eviction seam
      ├─────────────────────────────────────────────────┤
      │ drivers: xHCI AHCI NVMe e1000 8139 r8169 AC97   │
      │          virtio-gpu VBE IDE PS/2 I2C-HID        │
      ├─────────────────────────────────────────────────┤
      │  scheduler │ paging │ traps │ IRQ │ SMP │ DMA   │   SchIFT core
      └─────────────────────────────────────────────────┘
                            ▲
                   UEFI loader (boot/uefi)

Three seams matter. Above the syscall table, software is ordinary and portable — musl and toybox are unmodified. Below the device model, a driver never names its consumer and a consumer never names a driver. And at /dev/pci, a driver stops having to be in the kernel at all: a process is handed a device's registers, DMA memory and interrupts, and the in-kernel driver that held it releases it cleanly. vgpud is the virtio-gpu driver living out there today, and ldlsd runs Linux's own drivers the same way. See devices.md and ldls.md.


Where it came from

SchOS began as xv6 and is now mostly something else. What survives from xv6 is the shape of the process table, the sleep/wakeup discipline, and the buffer cache. What has been replaced: the scheduler and trap path (rewritten for x86-64 and for more than one processor), the memory manager, the entire filesystem, the syscall layer, and every driver.

That inheritance is worth knowing when reading the code, because the parts that still look like xv6 follow xv6's conventions and the parts that do not, do not.


The documents

Read in this order if you are new:

boot.md Firmware to the first userspace process. The shortest path through the whole system.
kernel.md Memory, processes, scheduling, traps, signals, SMP.
syscalls.md The one table everything is generated from, and how a musl binary runs unmodified.
scheduler.md Fair share by virtual runtime, slices, and nice.
filesystem.md The VFS, the buffer cache, mounts, procfs.
schfs.md The copy-on-write root filesystem.
fat.md FAT12/16/32 with long names: USB sticks, SD cards, the ESP.
devices.md Buses, classes, binding, and the vtables consumers talk to.
usb.md xHCI, the USB core, and the three class drivers.
users.md Accounts, login, and the permissions the kernel enforces.
udev.md eudev on SchOS: the device table, the /sys tree, uevents, datagram sockets.
graphics.md Framebuffer, /dev/fb0, text rendering, the console, PSOGM and GMMOS.
desktop.md Xorg on the framebuffer, Window Maker, and what they stand on.
packages.md The apk root: Alpine's packages, and SchOS as one of them.
scff.md The compressed image the live root ships as.
terminals.md The twelve virtual terminals, ptys, and handing one to a display server.
networking.md NIC drivers, lwIP, and the socket families.
audio.md /dev/dsp, AudioEngine, and the AC'97 driver under it.
init.md schinit, PID 1 as a role, and the job manifests.
debugging.md Symbols, a log that outlives the kernel, and asking the kernel a question.
ldls.md Running somebody else's drivers: a Linux .ko, in a process, reaching hardware through /dev/pci.

Three rules that hold across all of it

The kernel and the host tools compile the same SchFS source. mkschfs cannot disagree with the kernel about the on-disk format, because there is only one implementation. Format bugs are found on the host, where a test takes a second instead of a boot.

Syscalls are declared in exactly one place. kernel/sys/table.inc. The constants, the dispatch table and the Linux translation map are all generated from it, so a syscall cannot be half-registered.

A list you can read beats a list assembled by side effects. Drivers are written out by hand in kernel/drivers/registry.c rather than collected by a linker section, and platform devices are registered in one function rather than inside each driver's init. The tradeoff is deliberate: self-registration is nicer to write, and it means the list of what is in your kernel is not written down anywhere you can read.