SchOS/.claude/memory/schunix-layout-migration.md
Nexoniarz 57aff40228 docs: four directories, and a rule for when a thing leaves the roadmap
docs/ was ten files where a plan, a description, a guide and a bug report all
sat next to each other. It is now architecture/ (what SchOS is), plan/ (what it
will be), guides/ (how to work on it) and history/ (why it is like this), with
an index that states the one rule holding it together: when something is
finished it moves from plan/ to architecture/ and is rewritten as a description
of the thing rather than a record of building it.

A ticked checkbox says the work happened. It does not say what the work
*produced*, and six months later the checkbox is all that is left. The network
stack proved the point: finished, verified end to end, and for a month the only
description of it anywhere was a checkbox four levels of indentation deep.

So roadmap.md went from 534 lines to 181 -- nothing deleted, the done work
graduated. Seven subsystems that were finished and undescribed now have
descriptions: boot, kernel, syscalls, filesystem, networking, graphics, usb,
init. Every one ends with "What it does not do", which is the section that pays;
a document listing only strengths is marketing, and the reader who needs it most
is the one about to trip over a limitation nobody wrote down.

schfs.md still opened with "phases 1 through 3 1/2 are done, phase 4 is next"
long after all five had landed. It is a description now, with the phase record
and the hard-won bugs moved to history/.

Three corrections found on the way, all load-bearing:

  * projects/schcom/README.md claimed SCM_RIGHTS was done. There is no
    sendmsg/recvmsg in the kernel at all, and an entire GUI plan rested on it.
  * The root README said "No TCP/IP" months after the stack landed.
  * history/kernel.md sec.7 was marked "in progress" on a problem that process
    groups solved.

Also adds plan/1.0.md, which draws a finish line so the open list stops being
infinite, and marks schwm/ and schde/ superseded: in Wayland the compositor is
the window manager, so that split dissolves rather than being abandoned.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VQ7Qx8E1q1M1bbCq8QLHS2
2026-09-12 17:13:35 +02:00

44 lines
2.1 KiB
Markdown

---
name: schunix-layout-migration
description: "The bt/ -> ports/ + lib/ + cmd/ restructure done 2026-08-01, and the two build traps it exposed"
metadata:
node_type: memory
type: project
originSessionId: d1a1ea76-f919-411c-b0ef-0e1bc5064563
modified: 2026-08-01T17:17:12.984Z
---
Restructured Schunix's tree on 2026-08-01. `bt/` became `ports/` (third-party
only, Makefile + patches, nothing else), first-party userland split into `lib/`
(runtime glue) and `cmd/<name>/main.c` (programs), tarballs to `dist/`, and all
generated output to `build/`. Documented in `docs/guides/layout.md`. Verified: full
build passes and the image boots to `init: ready (pid 1)`.
**Two traps that bit during this and will bite again:**
1. `ld -r -b binary` derives symbol names from the input file's **path**. The
kernel embeds `initcode` and `entryother` this way, and the root Makefile
has `--redefine-sym _binary_build_lib_initcode_start=...` lines. Move either
blob's build location and the link breaks.
2. **A stamp file inside the directory it guards is always out of date.**
`ports/musl`'s `$(SRCDIR)/.patched` rule depended on `$(SRCDIR)`, but
creating the stamp bumps that directory's mtime, so the rule re-ran on every
build and failed (a patch does not apply twice). Same class of bug in
toybox and mksh. Fixed by making `$(SRCDIR)` an order-only prerequisite
(`| $(SRCDIR)`) in all three ports.
**A real thing that was silently lost-in-waiting:** musl's patch file claimed
two modified files; the build tree actually had five. The three undocumented
ones were in mallocng — two are inert debug tracing under
`#ifdef SCHUNIX_MALLOC_DEBUG`, but `glue.h` had a **required** build fix
(forward declarations for `__mmap`/`__madvise`/`__mremap`) that existed only as
a hand-edit in the build tree. Any `make distclean` would have silently lost
it. The patch was regenerated from a real diff against pristine musl 1.2.5 and
dry-run verified.
Backups from that session (delete when confident): the pre-migration tarball
`~/schunix-backup-20260801-1856.tar.gz` and `~/toybox-known-good`, both inside
WSL.
See [[schunix-build-environment]], [[schunix-rewrite-priorities]].