# MOUSE source tree
This repository builds the MOUSE C2 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. 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 enabled and disabled policy variants
under QEMU, verifies strict `/etc/rc.conf` translation into disposable
runlevels, required-service ordering, `supervise-daemon` restart exhaustion and
administrative recovery, forced termination on the declared stop schedule,
runtime-only `service` operations, the absence of `rc-update`, and orderly
OpenRC shutdown before poweroff and reboot.
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: C1 bootstrap complete; cheesed is PID 1
cheesed: enabled optional services: mouse_optional
cheesed: OpenRC default transition complete
```