# MOUSE source tree
This repository builds the MOUSE C3 boot image: Linux 6.18.35 from pinned
kernel.org source using MOUSE's own x86_64 configuration, a MOUSE-owned mini
rootfs with ChimeraUtils and static OpenRC 0.63.3, and `cheesed` from the
sibling repository as `/sbin/cheesed`.
The mini rootfs is assembled from an explicit file list rather than inheriting
another distribution's filesystem. The kernel, musl, NetBSD curses, `tcsh`, and
the selected ChimeraUtils base commands are compiled locally from pinned source
archives. C3 adds a static util-linux `agetty` and non-PAM Shadow `login`, with
libxcrypt supplying the static password-hashing interface. No shipped runtime
artifact comes from Alpine.
## Build and boot
The canonical build is the multi-stage `Containerfile`. It uses a
digest-pinned Alpine build environment, builds both sibling repositories, and
exports only the kernel and initramfs. Alpine supplies build tools only; both
runtime artifacts are assembled entirely from MOUSE's pinned sources and
checked-in configuration.
`make image` uses Apple Container, Docker, or Podman and exports the results
into `build/`. The builder runs natively as arm64 and cross-compiles the base
system and `cheesed` for static x86_64 musl. Set `CONTAINER_CLI` to select a
specific implementation. The wrapper creates a clean temporary context
containing both sibling repositories, excluding Git metadata and prior build
outputs. `make image-linux` runs the inner build directly on an equivalent
Linux host. Homebrew and the macOS SDK are not used.
`make run` prefers a repository-local QEMU at
`build/tools/qemu/bin/qemu-system-x86_64`, then falls back to
`qemu-system-x86_64` on `PATH`.
```sh
make image
make run
make check
```
Generated and downloaded files live under `build/` and `sources/`, both of
which are ignored by Git. Every downloaded input is versioned and SHA-256
verified through `sources.lock`. Before writing the initramfs, the build rejects
any base ELF executable with an interpreter or dynamic `NEEDED` entry.
`make check` requires `expect`. It boots five policy and failure variants under
QEMU. The suite verifies the supervised serial login, root's `tcsh` login
environment, strict `/etc/rc.conf` translation into disposable runlevels,
enabled and disabled ports-service policy, missing dependencies and dependency
cycles without partial starts, required-service recovery, restart exhaustion,
forced termination, runtime-only `service` operations, and reverse-order
shutdown.
To select a container frontend explicitly:
```sh
CONTAINER_CLI=container make image
CONTAINER_CLI=docker make image
CONTAINER_CLI=podman make image
```
The wrapper selects `linux/arm64` or `linux/amd64` from the host architecture.
`MOUSE_BUILDER_PLATFORM` can override that choice when the frontend provides
cross-architecture emulation.
The serial console should include:
```text
Cheesed to meet you! v0.1.0
cheesed: C3 bootstrap complete; cheesed is PID 1
cheesed: enabled optional services: mouse_echo
cheesed: OpenRC default transition complete
mouse login: root (automatic login)
MOUSE 0.1.0 (x86_64)
mouse:~#
```
The checked-in development image uses `agetty --autologin root` so the QEMU
acceptance suite is deterministic. It still enters the conventional
`agetty` → `login` → `tcsh` chain; the root password remains locked in
`/etc/shadow`.