COSCUP 2026 - Conference for Open Source Coders, Users, and Promoters

crossdev-stages, painless tool for building cross-compiler environment and board images for RISC-V and other architectures
2026-08-08 , TR512

Bringing Linux up on a new RISC-V board usually means assembling a vendor BSP and chasing toolchain mismatches by hand.

crossdev-stages is a Rust CLI (and also a library) that wraps the whole flow in one declarative pipeline.

Each board is a small set of config files in boards/<name>/ (arch, CFLAGS, kernel / OpenSBI / U-Boot / firmware repos & tags, services), with optional pre/post/override shell hooks per build step.
The tool drives Gentoo's crossdev to build a cross-toolchain, fetches pinned sources, cross-emerges the rootfs with whatever Portage packages and USE flags the board declares, and assembles a bootable image.

It runs inside hakoniwa (箱庭): an unprivileged user-namespace sandbox, so no sudo or Docker daemon.

Cross-toolchains and binary packages are keyed by (CHOST, canonical CFLAGS); CFLAGS go through sokgi first, which normalizes semantically equivalent flag strings (token order, last-wins overrides) to the same hash.

So one toolchain build per hardware profile, shared across compatible boards. Each image build also writes a build.lock.toml pinning stage3, source commits, kernel/U-Boot config sha256, and CFLAGS. crossdev-stages update diffs it against upstream HEAD when you want to refresh.


Difficulty: Advanced

Free and Open Source Software contributor
Co-founder and Director of FOSS for All

Interested in RISC-V, wayland, CJK.