README: the logo, what works now, and measured numbers

The README led with a wallpaper and described the system of two months
ago: no desktop, no dynamic linking, a handful of drivers. It now leads
with Shift and covers Xorg and Window Maker, apk and Alpine packages,
SCFF, HTTPS, the storage, network and input drivers, and the machines it
has booted on. "Not there yet" lists what is actually missing today:
threads, udev, EHCI, touchpad gestures, an installer.

The numbers -- lines of code and of comments, syscalls, drivers, packages,
commits -- come from tools/python/stats.py, which rewrites them in the
README and on the website between stats markers instead of somebody
typing them once and letting them go stale.

.gitattributes keeps the generated font and logo tables and the vendored
Niveus out of the repository page's language bar.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S1giNvrHTrPMPw7V6x1kQ4
This commit is contained in:
Nexoniarz 2026-10-24 22:02:44 +02:00
commit 4265794437
4 changed files with 358 additions and 47 deletions

136
README.md
View file

@ -1,12 +1,12 @@
<div align="center">
<img src="docs/branding/wallpapers/graphite.jpg" alt="SchOS — Shift, lit, on graphite" width="720">
<img src="docs/branding/shift.svg" alt="Shift, the SchOS mark" width="160">
# SchOS
**A 64-bit operating system, written from the metal up.**
SMP · copy-on-write filesystem · TCP/IP · PCI, USB and virtio drivers · TrueType text · Linux syscall ABI
SMP kernel · copy-on-write filesystem · Linux syscall ABI · Alpine packages · X11 on real hardware
</div>
@ -15,13 +15,46 @@ SMP · copy-on-write filesystem · TCP/IP · PCI, USB and virtio drivers · True
SchOS began as [xv6](https://github.com/mit-pdos/xv6-public) and is now mostly
something else. The scheduler, the memory manager and the trap path have been
rewritten for x86-64 and for more than one processor; the filesystem has been
replaced outright; the syscall table speaks Linux numbering so that real
software — musl, toybox, mksh — runs unmodified.
replaced outright; the syscall table speaks Linux numbering, so real Linux
software runs on it unmodified — statically or dynamically linked, straight
out of Alpine's package repositories.
It is a hobby system built by one person, and it is honest about that: what
works below has been *run*, not inferred, and the gaps are listed as plainly as
the features.
## In numbers
<!-- stats:begin -->
| | |
|---|---|
| **First-party code** | 61,367 lines, plus 21,128 lines of comments (26%) in 272 files |
| **Kernel** (`kernel/`, `include/`) | 45,207 lines of code, 16,111 of comments |
| **Syscalls** | 208, of which 184 on Linux numbering |
| **Drivers** | 15 in the kernel |
| **First-party programs** | 29 in `cmd/` |
| **Alpine packages in the root** | 88, from 11 asked for in `ports/alpine/world` |
| **History** | 253 commits since 2026-08-09 (76 days) |
<details>
<summary>Lines by language</summary>
| Language | Code | Comments |
|---|--:|--:|
| C | 56,580 | 19,427 |
| Assembly | 1,750 | 336 |
| PowerShell | 1,362 | 638 |
| Python | 759 | 147 |
| Shell | 716 | 469 |
| Perl | 129 | 45 |
| Linker script | 71 | 66 |
</details>
<sub>Measured by <code>tools/python/stats.py</code>; first-party code only, so
<code>ports/</code> and generated tables are not counted.</sub>
<!-- stats:end -->
## The pieces
| Layer | Name | What it is |
@ -29,6 +62,7 @@ the features.
| 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 |
| Image format | **SCFF** | The SchOS Compressed File Format the live root ships in |
| API | **SchAPI** | System programming interface — the stable surface |
| Compositor | **SchCom** | Display compositor *(planned)* |
| Window manager | **SchWM** | *(planned)* |
@ -39,45 +73,61 @@ its distribution.
## What works
**Kernel** — Long mode, 4-level paging, preemptive multitasking. **SMP**: one,
two and four processors all boot, with CPU enumeration from the ACPI MADT rather
than the 1994 MP table. Memory sized from the E820 map, so it runs in tens of
megabytes rather than demanding hundreds.
**Kernel** — Long mode, 4-level paging, preemptive multitasking. **SMP** up to
64 processors, enumerated from the ACPI MADT. ACPI through
[uACPI](https://github.com/uACPI/uACPI): interrupt routing from `_PRT`, the
power button, clean power-off and reset. Memory sized from the E820/UEFI map.
**Filesystem** — **SchFS** is the root: a copy-on-write B-tree with a
uberblock ring, so a crash leaves either the old tree or the new one and there
is nothing to repair. Free space is derived from the tree rather than stored
beside it, which removes a whole class of disagreement. `/proc/schfs` shows the
generation counter advancing as writes commit.
is nothing to repair. The live image ships as **[SCFF](docs/architecture/scff.md)**:
the 358 MB root compresses to 102 MB with zstd and is unpacked a chunk at a
time, the first time something reads it. `/proc` has `/proc/<pid>/fd`,
`/proc/self` and the rest that `ps`, `top` and Xorg read.
**Processes** — fork, exec, wait, pipes, signals, sessions and process groups,
`mmap` (anonymous and file-backed), POSIX shared memory, Unix domain sockets,
`poll`.
**Processes** — fork, exec, wait, pipes, signals, sessions and job control,
`mmap` (anonymous and file-backed), POSIX shared memory, `memfd`, Unix domain
sockets with descriptor passing (`SCM_RIGHTS`), `poll`, `epoll`, `eventfd`,
`timerfd`, `signalfd`. **Dynamic linking**: `exec` loads `ld-musl`, so
binaries come from Alpine as they are.
**Devices** — PCI enumeration with a bus-agnostic device model at
`/proc/devices`. Drivers for **e1000** networking, **virtio-gpu** and stdvga
displays, **xHCI** USB with HID, hub and mass-storage class drivers, IDE, PS/2,
serial. `/dev/fb0` speaks the Linux fbdev interface.
**Packages** — the root is managed by Alpine's **apk**. `ports/alpine/world`
says what is installed; the build resolves it once into `world.lock` and every
image after that is reproducible. SchOS itself is one more package in it.
**Networking** — ARP, IPv4, ICMP, UDP, TCP and DHCP, on lwIP behind a
driver-agnostic interface class. Verified end to end from the host, both
directions, rather than by inspection. Names resolve, so `wget http://host/`
works; `httpd` serves a directory back the other way.
**Graphics** — **Xorg with Window Maker**, preinstalled, on the framebuffer
(`/dev/fb0`, Linux fbdev). Six virtual terminals, switched with
Ctrl+Alt+F1–F6 or Alt+F1–F6, with X on a terminal of its own; Ctrl+Alt+Backspace
ends the session. Input as Linux evdev on `/dev/input/event*`.
**Userland** — musl, toybox, mksh and zsh, built from source. 268 applets:
`ls`, `cat`, `ps`, `top`, `wc`, `cp`, `mount`, `awk`, `bc`, `diff` and the rest
behave the way you expect, because they are the real programs. `edit` is
[kilo](https://github.com/antirez/kilo) — arrow keys, Ctrl-S, Ctrl-Q, nothing
to learn.
**Devices** — PCI with a bus-agnostic device model at `/proc/devices`.
| | |
|---|---|
| Storage | AHCI (SATA), NVMe, IDE, USB mass storage |
| Network | Intel e1000, Realtek r8169 and RTL8139 |
| USB | xHCI, hubs, HID keyboards and mice |
| Input | PS/2, I2C-HID laptop touchpads (DesignWare I2C, found through ACPI) |
| Display | UEFI GOP framebuffer, virtio-gpu, Bochs/stdvga |
| Audio | AC'97 |
**Networking** — ARP, IPv4, ICMP, UDP, TCP and DHCP on lwIP. DNS, `wget`
over **HTTPS**, `ping`, and an `httpd` serving a directory back.
**Userland** — musl, toybox, mksh and zsh, plus whatever Alpine has: `ls`,
`ps`, `top`, `awk`, `diff`, `xterm`, `fastfetch` behave the way you expect,
because they are the real programs.
**Text** — a TrueType rasteriser (`glyf` outlines, composite glyphs, cmap
format 4) replacing the 8×16 cell grid. JetBrains Mono for the terminal, Roboto
for the desktop layer to come.
format 4). JetBrains Mono for the terminal, Roboto for the desktop to come.
**When it dies** — PSOGM, the Purple Screen of Guru Meditation: stop code,
fault address, call chain, and a QR code containing a text copy of the whole
report.
**On real hardware** — booted on an AMD B550 desktop (Ryzen 5 4600G), an ASUS
TUF A15 laptop and an Ivy Bridge HP all-in-one, from a USB stick.
## Quick start
```sh
@ -86,6 +136,10 @@ make qemu # build it and boot it
make iso # a bootable ISO for VMware or real hardware
```
The ISO is a hybrid image: write it to a USB stick with
`dd if=schos.iso of=/dev/sdX bs=4M` (or Rufus/Etcher in DD mode) and boot it
on any UEFI machine.
Builds on **Linux, macOS, FreeBSD/OpenBSD/NetBSD and Windows** (Git Bash). The
toolchain is clang + lld everywhere — it is a cross-compiler by construction, so
one LLVM install targets the bare-metal kernel, the 16-bit boot code and musl
@ -108,6 +162,9 @@ make schfs-check # SchFS B-tree, object and image suites
`bootcheck` is PowerShell because `pwsh` runs on every supported host.
The numbers at the top are measured, not typed: `python3 tools/python/stats.py`
rewrites them here and on the website.
## Layout
```
@ -136,16 +193,19 @@ Another: **syscalls are declared in exactly one place**,
## Not there yet
- **No desktop.** Schcom composites and routes input; the plan is now to put it
on Wayland and delete the homegrown protocol. See
[docs/plan/wayland.md](docs/plan/wayland.md).
- **No descriptor passing.** No `sendmsg`/`recvmsg`, so no `SCM_RIGHTS` — which
is what the GUI work stops at. [docs/plan/foundations.md](docs/plan/foundations.md).
- **No dynamic linking.** `exec` handles static `ET_EXEC` only.
- **No threads.** `clone` makes processes, not threads (`CLONE_VM` is
refused), so multi-threaded programs run on one thread or not at all. Xorg
runs with `-dumbSched` for this reason.
- **No udev.** Xorg is told its input devices by a config file instead of
finding them; `/sys` and the device-event socket are what is missing.
- **USB 2.0 controllers (EHCI)** have no driver. On older machines the ports
wired only to EHCI do nothing; xHCI ports work.
- **Touchpads run in mouse mode**: pointer, click and tap, but no two-finger
scroll yet.
- **No page cache**, so writable `MAP_SHARED` of a file is refused rather than
faked.
- **A USB disk cannot be booted from** — the root device is compiled in rather
than selectable.
faked. SysV shared memory is missing too.
- **No installer.** SchOS runs live from the USB stick; nothing is written to
the machine's disks.
- SchFS has no Linux driver yet; the plan is on-disk format version first, then
FUSE, then a kernel module.
- CFF/OpenType outlines and TrueType hinting are deliberately out of scope.