A 64-bit operating system written from the metal up: SMP kernel, copy-on-write filesystem, Linux syscall ABI, Alpine packages, X11 on real hardware.
  • C 90.2%
  • Makefile 3.2%
  • PowerShell 2.3%
  • Shell 1.7%
  • Python 1.3%
  • Other 1.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Nexoniarz 66152ad2f2 Give userspace a raw disk: /dev/hda and /dev/hdb
Nothing outside the kernel could touch a disk. sys_mount does not even
look at the device it is handed -- it mounts the one SchFS volume found
at boot and ignores `source` -- so a program had no way to read a
partition table, format a volume or write a boot sector. An installer is
a program that needs all three, so this is the first piece of it.

A character device in devsw rather than a separate block layer, because
that is where the offset already lives: fileread/filewrite pass f->off
and advance it by what comes back, which is everything a seekable device
needs. The minor is the IDE device number, the same numbering iderw()
uses; two schemes for the same disks would be a bug waiting to happen.

Writes bypass every filesystem above them, which is inherent to a raw
device and why an installer must target a disk it has not mounted.

The nodes are created unconditionally, like every other entry in /dev.
That matters more than it looks: with no node, `echo x > /dev/hdb`
silently creates an ordinary file of that name and appears to work. It
did, and it agreed with itself on read-back; only the host's copy of the
disk showed nothing had been written.

st_rdev was never filled, so every node in /dev reported "0, 0" under
ls -l. Harmless while nothing read it, wrong as soon as something has to
tell two disks apart. Filled with the full Linux dev_t encoding rather
than (major << 8 | minor), which only works while both stay small.

Verified against the host as an independent oracle, both directions: the
guest wrote to /dev/hdb and the host saw those bytes at offset 0; the
host wrote at offset 4096 and the guest read them back with dd skip=.
ls -l now shows 1,1 for console, 2,0 for fb0 and 8,1 for hdb.

Known limit, commented in disk.c: devsw passes the offset as a 32-bit
uint, so a raw disk is addressable to 4 GB. That must be widened before
anyone installs onto a real disk.

bootcheck 108 [ok] with -Fb -Tty -Usb -Sock -Evdev -Ps.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-09 22:19:40 +02:00
.claude/memory memory: UEFI reaches userspace, and the ISO grows a hierarchy 2026-08-09 22:04:12 +02:00
Assets Rename Schunix to SchOS; the kernel becomes SchIFT 2026-08-09 14:09:59 +02:00
boot acpi: take the RSDP from the loader when firmware gives it to us 2026-08-09 22:02:57 +02:00
cmd Give userspace a raw disk: /dev/hda and /dev/hdb 2026-08-09 22:19:40 +02:00
docs docs: fold a duplicated paragraph in the move guide 2026-08-09 17:26:01 +02:00
etc Fix the boot logo source, and put /etc under version control 2026-08-09 16:51:04 +02:00
include Give userspace a raw disk: /dev/hda and /dev/hdb 2026-08-09 22:19:40 +02:00
kernel Give userspace a raw disk: /dev/hda and /dev/hdb 2026-08-09 22:19:40 +02:00
lib schinit: a launchd-shaped process 1 2026-08-09 16:36:13 +02:00
ports tools: group scripts by what runs them 2026-08-09 14:38:02 +02:00
projects Rename Schunix to SchOS; the kernel becomes SchIFT 2026-08-09 14:09:59 +02:00
tools iso: boot both firmwares, from a disc with a real hierarchy 2026-08-09 21:51:35 +02:00
.gitattributes Initial commit: Schunix as it stands before the SchOS rename 2026-08-09 13:47:01 +02:00
.gitignore Drop a committed Emacs lock file, and ignore them 2026-08-09 14:41:51 +02:00
LICENSE Rename Schunix to SchOS; the kernel becomes SchIFT 2026-08-09 14:09:59 +02:00
LICENSE.MIT Rename Schunix to SchOS; the kernel becomes SchIFT 2026-08-09 14:09:59 +02:00
Makefile Give userspace a raw disk: /dev/hda and /dev/hdb 2026-08-09 22:19:40 +02:00
NOTICE Rename Schunix to SchOS; the kernel becomes SchIFT 2026-08-09 14:09:59 +02:00
README.md docs: correct the layout block, and note what a copy leaves behind 2026-08-09 17:25:42 +02:00
run.ps1 Rewrite run.ps1; it was five kinds of stale 2026-08-09 14:49:47 +02:00

SchOS

A 64-bit operating system, written from the metal up.

SMP · copy-on-write filesystem · PCI, USB and virtio drivers · TrueType text · Linux syscall ABI


SchOS began as xv6 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.

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.

The pieces

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 System programming interface — the stable surface
Compositor SchCom Display compositor (planned)
Window manager SchWM (planned)
Desktop SchDE (planned)

uname -s reports SchIFT, the way every Unix reports its kernel rather than 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.

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.

Processes — fork, exec, wait, pipes, signals, sessions and process groups, mmap (anonymous and file-backed), POSIX shared memory, Unix domain sockets, poll.

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.

Userland — musl, toybox and mksh, built from source. ls, cat, ps, top, wc, cp, mount and the rest 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.

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.

Quick start

make          # kernel + bootloader + root filesystem -> schos.img
make qemu     # build it and boot it
make iso      # a bootable ISO for VMware or real hardware

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 userland from any host. See docs/building.md for prerequisites per platform, and docs/moving-to-linux.md for moving a checkout between machines.

Testing

Booting to a prompt proves nothing: a filesystem can mount and still fail the first real command, and that has happened here. So the test harness drives the serial console and asserts on what comes back.

tools/windows/bootcheck.ps1            # boot, run real commands, check the answers
tools/windows/bootcheck.ps1 -Tty -Ps   # terminal behaviour, process enumeration
make schfs-check                       # SchFS B-tree, object and image suites

bootcheck is PowerShell because pwsh runs on every supported host.

Layout

kernel/     arch/ core/ dev/ drivers/ fs/ net/ proc/ sys/
  fs/schfs/     the filesystem -- same source the host tools compile
include/    kernel and userland headers
boot/       bios/ (MBR, stage 2, VBE splash)  uefi/ (PE loader)
lib/ cmd/   first-party userland runtime and programs
ports/      third-party software built from source
tools/      windows/ (.ps1)  posix/ (.sh)  python/ (.py)  and .c/.pl
docs/       architecture, roadmap, licensing, building

One rule worth knowing: 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 — found and fixed on the host, where a test takes a second instead of a boot.

Another: syscalls are declared in exactly one place, kernel/sys/table.inc. Everything else is generated from it.

Not there yet

  • No TCP/IP. The decision is made — port lwIP rather than write one — but it is not done. The e1000 driver works; nothing speaks to it yet.
  • No compositor, window manager or desktop. That is the next large piece.
  • 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.

Licensing

Apache-2.0, copyright Nexoniarz. See LICENSE.

The kernel derives from xv6, which is MIT — see LICENSE.MIT. Third-party code redistributed in a built image (musl, toybox, mksh, the fonts) keeps its own licence; NOTICE carries the attributions.

Drivers may be adapted from BSD sources, which are compatible. Linux drivers are not: GPL-2.0-only and Apache-2.0 cannot be combined and redistributed. Reading Linux to understand hardware is fine; translating a driver is not. Best of all is the public specification — xHCI, virtio, AHCI, e1000 — which carries no licence on what you write from it.


Built with stubbornness and a serial console.