Skip to content

build: containerised devkit and reproducible RK3588 firmware build - #64

Merged
Rust-KVM merged 3 commits into
devfrom
claude/project-thread-9dvesw
Oct 17, 2026
Merged

Rust-KVM merged 3 commits into
devfrom
claude/project-thread-9dvesw

Conversation

@Rust-KVM

@Rust-KVM Rust-KVM commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

Requested by 4c

Summary

Before: only the reference WSL workbench could build RustKVM. The device binary needed a self-built stage2 rustc and /opt/rk3588-buildkit, and the firmware came from a FriendlyElec SDK checkout whose RustKVM changes were uncommitted local edits in five projects (one of them a local branch).

After: any x86_64 Linux host with Docker builds the application package with scripts/devkit.sh run scripts/build-app.sh and the SD / eMMC-flasher firmware images with scripts/devkit.sh firmware. Every toolchain and SDK commit is pinned in the repository, and every SDK change lives here as a patch.

How

  • ci/devkit/Dockerfile: the RK3588 buildkit image plus nightly-2026-06-14 (device binary, -Z build-std), 1.96.0 (frontend) and Trunk 0.21.14. RUSTUP_TOOLCHAIN overrides the stage2 rust-toolchain.toml, so nobody else has to build rustc. .devcontainer/ uses the same image.
  • ci/firmware/Dockerfile: Ubuntu 22.04 host for the FriendlyElec SDK with a sha256-pinned repo launcher; runs --privileged for loop devices.
  • ci/buildkit/Dockerfile: now takes the Buildroot host dir as the rk3588-buildkit named context, so it can be built from /opt/rk3588-buildkit or a firmware build without copying into the repo. buildkit.yml passes the context.
  • os/rk3588/: manifest.xml pins all 14 SDK projects to upstream commits on github.com/friendlyarm; patches/ holds the buildroot, kernel, sd-fuse, external and device changes exported from the workbench (checked to apply cleanly to the pinned commits); rootfs-overlay/ is the former device/friendlyelec/rustkvm-files.
  • scripts/build-firmware.sh steps sync → patch → build → collect produce out/firmware/rustkvm-rk3588-<app>-<date>-<rev>-{sd,eflasher}.img.gz, /etc/rustkvm-release and SHA256SUMS.
  • S99rustkvm stop/restart used killall -9, which skips the watchdog disarm and reboots the board. It now sends SIGTERM and waits.
  • The vendor root password is no longer written by our defconfig patch. RUSTKVM_ROOT_PASSWORD (a crypt hash, outside the repo) sets it at build time; otherwise root password login is disabled. SSH was already key-only (dropbear -s, devmode only).
  • release.yml pins the same nightly as the devkit.
  • Separate commit: zip 8 → 9 and rustls 0.23.46 in the lockfile, because new RustSec advisories (RUSTSEC-2026-0346..0349, 0367..0369) made cargo deny fail on dev. zip is only used through ZipWriter, whose API did not change.
  • Docs: docs/building.md, docs/firmware-release.md (versions, release checklist, flashing, factory state, acceptance test), os/rk3588/README.md, AGENTS.md and README updated.

Look closely at: the firmware build has not been run end to end from this tree yet (first run is a ~15 GB sync and several hours), and the RUSTKVM_ROOT_PASSWORD default changes serial-console login on newly built images.

Testing

  • scripts/devkit.sh image then scripts/devkit.sh run scripts/build-app.sh on the workbench: Trunk build + aarch64 release binary in 6m19s, rustc 1.98.0-nightly (1f087276b 2026-06-13), output is an aarch64 ELF.

  • scripts/devkit.sh firmware-image builds; repo 2.69 and passwordless sudo verified in the container.

  • Every patch in os/rk3588/patches applies with git apply to its pinned commit (checked against a temporary index of the workbench SDK).

  • repo init --depth=1 + repo sync -c -d against a pinned non-tip commit checks out the exact commit (tested with buildroot_device_friendlyelec).

  • fmt, host clippy -D warnings and cargo test --workspace pass inside the devkit container (so the devkit doubles as the local quality gate); cargo deny check passes.

  • cargo +nightly fmt --all

  • cargo +nightly clippy --workspace --release --all-targets -- -D warnings

  • cargo +nightly test --workspace

  • Frontend touched: trunk build --locked and wasm32 clippy in crates/rkvm-web (not touched; trunk build --release --locked ran in the devkit)

  • Tested on an RK3588 device (describe below), or not applicable — not applicable, nothing was flashed or deployed

Checklist

  • No #[allow(...)] suppressions and no new unwrap() / expect() in production paths
  • Hot paths stay zero-copy; periodic loops use MissedTickBehavior::Delay
  • Shared protocol types live in rkvm-proto
  • RPC method set changed → app/tests/rpc_methods.txt updated
  • Module tree or build invariants changed → AGENTS.md updated

🤖 Generated with Claude Code

@Rust-KVM Rust-KVM self-assigned this Oct 17, 2026
@github-actions github-actions Bot added documentation Improvements or additions to documentation ci CI workflows and checks build Toolchain, cross-compilation and packaging labels Oct 17, 2026
@Rust-KVM
Rust-KVM marked this pull request as ready for review October 17, 2026 14:48
foxxcn and others added 3 commits October 17, 2026 23:39
Building RustKVM needed the reference WSL workbench: a self-built stage2
rustc, /opt/rk3588-buildkit, and a FriendlyElec SDK with uncommitted local
changes in five projects.

- ci/devkit: buildkit image + pinned nightly-2026-06-14 / 1.96.0 + trunk;
  RUSTUP_TOOLCHAIN overrides the stage2 rust-toolchain.toml.
- ci/firmware: Ubuntu 22.04 SDK host with a hash-pinned repo launcher.
- scripts/devkit.sh, build-app.sh, build-firmware.sh: one command each for
  the app package (out/app) and SD/eflasher images (out/firmware), with
  proxy forwarding and download/ccache caches.
- os/rk3588: SDK pinned per project to upstream commits, every local SDK
  change as a patch, the rustkvm rootfs overlay. S99rustkvm now stops the
  app with SIGTERM instead of SIGKILL, which tripped the watchdog.
- Root password is no longer in the defconfig: injected at build time via
  RUSTKVM_ROOT_PASSWORD, otherwise root login is disabled.
- release.yml pins the same nightly; buildkit.yml uses the named context.
- docs/building.md and docs/firmware-release.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RUSTSEC-2026-0346..0349 (rustls) and 0367..0369 (zip) fail cargo deny on
dev. zip is only used for ZipWriter, whose API is unchanged in 9.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- One pinned nightly builds both the device binary and the wasm frontend;
  the separate stable toolchain is gone (devkit 4.0 GB -> 3.2 GB).
- buildkit image drops docs, translations, target executables and the
  sysroot password database before it is published.
- devkit.sh defaults to ghcr.io/rust-kvm/rk3588-buildkit:20250527 and
  rustkvm-devkit:nightly-2026-06-14, pulls before building, and gains
  `push` for maintainers. OCI source labels link the packages to the repo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Rust-KVM
Rust-KVM force-pushed the claude/project-thread-9dvesw branch from b1f2a20 to 731377a Compare October 17, 2026 15:39
@Rust-KVM
Rust-KVM merged commit 14a6754 into dev Oct 17, 2026
8 checks passed
@Rust-KVM
Rust-KVM deleted the claude/project-thread-9dvesw branch October 17, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Toolchain, cross-compilation and packaging ci CI workflows and checks documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants