# cheesed

`cheesed` is the PID 1 and service supervisor for MOUSE. The repository is
currently implementing milestone C0 from [`PLAN.md`](PLAN.md): a static Linux
init which logs to the console, reaps children, provides an emergency `tcsh`,
and handles reboot and poweroff signals without ever returning from PID 1.

## Development checks

Unit tests and lint checks run on the development host:

```sh
cargo test --locked
cargo clippy --locked --all-targets -- -D warnings
cargo fmt --check
```

PID 1 mode is Linux-only. Build the static release binary with:

```sh
rustup target add x86_64-unknown-linux-musl
scripts/build-static.sh
```

## C0 QEMU boot

The initramfs deliberately takes an explicit static `tcsh`; it does not copy a
host shell with unresolved dynamic-library dependencies.

```sh
scripts/build-initramfs.sh \
    target/x86_64-unknown-linux-musl/release/cheesed \
    /path/to/static/tcsh \
    build/cheesed-initramfs.cpio.gz

scripts/run-qemu.sh /path/to/bzImage build/cheesed-initramfs.cpio.gz
```

Inside the guest, `SIGINT` requests reboot and `SIGTERM` requests poweroff.
Exiting the emergency shell causes `cheesed` to reap and restart it.
