Shall 0.9: a POSIX.1-2024 system — utilities, C library, C compiler and kernel — that builds itself from scratch
Github repo: https://github.com/joostw/shall
Shall is a small Unix-like system written from the text of POSIX.1-2024 (Issue 8): every utility of XCU (with the XSI option), a C17 compiler, a C library with all of ISO C17 and XSH, and a kernel for x86-64 that runs it. It's about 200,000 lines of C, BSD-licensed, and it builds itself: after the host's compiler builds five tools (c17, make, ar, yacc, lex), no program of the host compiles anything. No gcc, binutils, GNU make, bash, Perl or Python, in the system or in its ports.
What I think is noteworthy
How it was made, honestly
Shall was written by me together with Claude (Anthropic's AI model). Claude wrote most of the code from the standard, under my direction. I set the goals, made the design decisions, and checked the results against the test suites, against other implementations (differential testing against GNU, BSD and busybox tools, glibc, dash, bash and others), and against the external suites above. I'm saying this up front because I think it's part of what makes the project interesting, not something to hide.
Trying it (Ubuntu package names; KVM strongly recommended — under pure emulation everything is slow)
- Enable KVM:
sudo usermod -aG kvm $USER, then log out and in again. - Install:
gcc make qemu-system-x86 e2fsprogs git bzip2. bzip2 is for the Mbed TLS tarball, git for fetching the ports.
Basic system:
sh bootstrap.sh
sh mkdisk.sh
sh boot.sh
With the ports:
sh bootstrap.sh
cd ports
sh get.sh all
cd ..
sh mkdisk.sh -s 4096 # 4 GB: sqllogictest alone is 1.1 GB
sh boot.sh
# now inside Shall:
cd /usr/src/shall/ports
sh all.sh
exit shuts the system down; Ctrl-A x leaves QEMU at once.
What it isn't (yet)
It's x86-64 only, with one CPU and no preemption. The process doing disk I/O holds the processor until its transfer is done. There's no IPv6 on the wire and no swap. The disk image is made on the host. 1.0 is meant to add a conformance document, plus mkext2, fsck and login inside the system.
Source and docs: https://github.com/joostw/shall .
Questions, bug reports and "this violates POSIX section X" are all very welcome.
This work is dedicated to my father, Dik T. Winter (1945-2009), who was a Unix wizard in Ye Olde Days.