Bootstrap::SysrootBuilder
Inherits Bootstrap::CLI < Reference < Object
SysrootBuilder prepares a chroot-able environment that can rebuild a complete sysroot using source tarballs cached on the host. The default seed uses Alpineās minirootfs, but the seed rootfs, architecture, and package set are intended to be swappable once self-hosted variants exist.
Key expectations:
- No shell-based downloads: HTTP/Digest from Crystal stdlib only.
- Deterministic source handling: every tarball is cached locally with CRC32 + SHA256 bookkeeping for reuse and verification.
- bootstrap-qcow2 source is fetched as a tarball and staged into the inner rootfs workspace (/workspace inside the inner rootfs).
Usage references:
- CLI entrypoints:
bq2 sysroot-builderandbq2 sysroot-plan-write, (seeself.run,help_entries, and README). - Workspace layout: host workspace is data/sysroot. The inner workspace is /workspace inside the inner rootfs and /workspace/rootfs/workspace from the outer rootfs.
- Build plan contract:
write_planpersists the plan consumed bySysrootRunnerunder the inner rootfs var/lib directory.
Constants
Source: https://curl.se/ca/cacert.pem (Mozilla CA certificate bundle).
Source: https://dl.beagle.cc/images/bq2-rootfs-0.3.3.tar.gz
Constructors
Class methods
Dispatch sysroot builder subcommands by command name.
Instance methods
Construct a phased build plan. The plan is serialized into the chroot so it can be replayed by the coordinator runner.
Declarative list of upstream sources that should populate the sysroot. Each PackageSpec can carry optional configure flags or a custom build directory name when upstream archives use non-standard layouts.
Define the multi-phase build in an LFS-inspired style:
- build a complete sysroot from sources using the selected seed environment
- validate the sysroot by using it as the toolchain when assembling a rootfs
Phases:
- host-setup: populate sources and seed the rootfs from the host.
- sysroot-from-seed: build the sysroot using tools available in the seed rootfs.
- rootfs-from-sysroot: build the minimal rootfs using the new sysroot toolchain.
- system-from-sysroot: build core system packages inside the new rootfs.
- tools-from-system: build developer tools inside the new rootfs.
- finalize-rootfs: strip /opt/sysroot and emit the tarball.
Phase namespaces:
- host: runs on the host before entering any namespace.
- seed: runs in the seed rootfs (host tools).
- bq2: runs inside the bq2 rootfs, prefers /usr/bin, and relies on musl's /etc/ld-musl-<arch>.path for runtime lookup.
Build a PackageSpec pointing at the base rootfs tarball for the configured architecture. The checksum URL is derived from the upstream naming convention when available.
Return the workspace directory that should be used for building package.