Files
everest-qemu/README.md
T
lw-everestlinuxandClaude Opus 5.5 f687558b66 Initial import: build and boot Everest Linux in QEMU
everest.sh builds Everest's signed packages in an Alpine container,
publishes the base, extra and extra-src repositories, installs the
system with glacier-bootstrap into an initramfs and boots it in QEMU.
The image carries glacier, a toolchain and the repositories, and builds
packages from source inside the VM.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 09:33:38 -04:00

137 lines
5.7 KiB
Markdown

# everest-qemu
Builds a minimal, bootable Everest Linux system from glacier packages and
boots it in QEMU. The system is installed by glacier itself, carries
glacier, a toolchain and Everest's signed repositories, and can build
packages from source inside the VM.
Needs Docker, QEMU (KVM), `openssl` and `socat`, plus sibling checkouts of
`glacier-ng` and `libglacier-ng` (or set `GLACIER_NG` / `LIBGLACIER_NG`).
```sh
./everest.sh keygen # once: the signing key, in ~/.config/everest/keys
./everest.sh build all # every package -> pkgs/, signed
./everest.sh publish # signed repositories base, extra, extra-src -> repo/
./everest.sh initramfs # -> boot/vmlinuz, boot/initramfs.gz
./everest.sh boot # QEMU on this terminal; Enter for a root shell,
# `poweroff -f` (or Ctrl-A X) to leave
```
`./everest.sh build PKG` rebuilds a single package (linux and gcc take a
while; most take under a minute). `./everest.sh adopt DIR` takes packages
built from recipes into `pkgs/`. `EVEREST_MEM` (MB, default 6144) and
`EVEREST_CPUS` (default 2) size the VM.
`pkgs/`, `repo/`, `boot/`, `sources/` and `testca/` are build outputs and
are not tracked.
## Booting a released image
Only `vmlinuz` and `initramfs.gz` are needed:
```sh
qemu-system-x86_64 -enable-kvm -m 6144 -smp 2 -nographic \
-nic user,model=virtio-net-pci \
-kernel vmlinuz -initrd initramfs.gz -append "console=ttyS0 rdinit=/init"
```
The image carries a copy of the repositories at `/srv/everest`, so
`syspkg -y` and binary installs (`syspkg -f gcc`) work offline. Building
from source downloads the sources, so bring the network up first:
```sh
ip link set eth0 up
ip addr add 10.0.2.15/24 dev eth0
ip route add default via 10.0.2.2
echo "nameserver 10.0.2.3" >> /etc/resolv.conf
```
## Signing
Every package's sidecar is signed (`NAME-VER.gpkg.sha256.sig`): glacier
installs a base package only with a signature by a key its
`/etc/glacier/repos.conf` trusts for base. The secret key,
`everest-2026.sec`, stays outside this tree, in `~/.config/everest/keys`
(or `$EVEREST_KEYS`), mounted read-only into the build container; `build`
refuses without it. The public key and `repos.conf` ship in
`everest-repos` (`pkgsrc/everest-repos/etc/glacier/`).
## Repositories
`repos.conf` lists `https://pkg.everestlinux.org/{base,extra,extra-src}`.
Until that server exists, `initramfs` rewrites the image's copy to
`file:///srv/everest/REPO`, and `boot` serves `repo/` locally:
- over https, as `10.0.2.100:443` in the guest, with a throwaway test CA
(`testca/`, made by `initramfs`; never shipped);
- read-only over 9p (`mount_tag=everest-repo`), so `./everest.sh publish`
reaches a running VM without a new initramfs.
In the VM, `sh /sys/firmware/qemu_fw_cfg/by_name/opt/everest/testnet/raw`
(`scripts/vm-testnet.sh`) brings up the network, mounts the 9p share over
`/srv/everest` and trusts the test CA.
## Building from source in the VM
```sh
syspkg -y
syspkg -f vim # asks which repository: pick extra-src
syspkg -f less zstd lua bash
```
Builds run in glacier's sandbox (user namespaces, overlayfs) as the
`_gbuild` user, over the layers `BUILD_ROOT` in `/etc/glacier/glacier.conf`
names (musl, busybox, linux-headers, binutils, gcc, make). `JOBS = N;` in
glacier.conf sets the parallelism. Per-package switches go in
`/etc/glacier/config/NAME.conf` (`TRAITS = [ "-huge" ];`), and `syspkg -u`
rebuilds what they change.
`scripts/vm-drive.py LOG CMDS` boots the VM on a pty and runs a command
list non-interactively (`scripts/vmtests/builds.txt`).
## Layout
| Path | What |
|---|---|
| `everest.sh` | Entry point, runs on the host |
| `Dockerfile.build` | Alpine build image: the native compiler targets musl |
| `scripts/container.sh` | Runs inside that image: the build of each package (sources pinned by SHA256), publish, initramfs assembly |
| `scripts/live-init.sh` | The image's `/init`: copies the system onto a tmpfs and switches root to it |
| `scripts/vm-testnet.sh` | Network, local repositories and test CA inside the VM |
| `templates/minimal.template` | The package list `glacier-bootstrap` installs into the image |
| `pkgsrc/` | Sources of `everest-bootscripts`, `everest-repos` and Everest's `glacier.conf` |
| `recipes/extra-src/` | Source recipes, published as the `extra-src` repository |
## The system
| Package | Version | Repo | Provides |
|---|---|---|---|
| musl | 1.2.5 | base | C library and dynamic loader |
| busybox | 1.37.0 | base | init, sh, mount and core utilities |
| linux | 6.12.112 | base | kernel (namespaces, overlayfs) |
| everest-bootscripts | 1.4.0 | base | `/etc`: inittab, rc scripts, accounts (root locked, `_gbuild`), profile, doas.conf |
| everest-repos | 1.1.0 | base | `/etc/glacier`: `repos.conf` and `keys/everest-2026.pub` |
| zlib, libarchive, libconfig, luajit | | base | glacier's dependencies |
| libglacier-ng, glacier-ng | 4.0.0 | base | the package manager |
| libressl, ca-certificates, curl | 4.3.3, 2026.9.25, 8.23.0 | base | https for repositories |
| gcc-libs | 16.2.0 | base | libstdc++, libgcc_s |
| doas | 6.8.2 | extra | privilege escalation |
| linux-headers, binutils, make, gcc | 6.12.112, 2.47.0, 4.4.1, 16.2.0 | extra | the toolchain |
The image is a system installed by glacier: `scripts/container.sh` runs
`glacier-bootstrap -t -d pkgs templates/minimal.template /target`, which
verifies the packages and has `syspkg -R /target` install them in one
transaction, then packs `/target`.
## Not yet
- No bootloader: the kernel is started by QEMU's `-kernel`.
- No installer: installing to disk is manual.
- `pkg.everestlinux.org` is not live.
## License
GPLv3 (`LICENSE`). Packages built here contain third-party software under
its own licenses; `scripts/container.sh` pins every upstream source by URL
and SHA256.