KVM-based microVMM for the Volt platform: - Sub-second VM boot times - Minimal memory footprint - Landlock LSM + seccomp security - Virtio device support - Custom kernel management Copyright (c) Armored Gates LLC. All rights reserved. Licensed under AGPSL v5.0
169 lines
4.3 KiB
Makefile
169 lines
4.3 KiB
Makefile
# Volt Build System
|
|
# Usage: just <recipe>
|
|
|
|
# Default recipe - show help
|
|
default:
|
|
@just --list
|
|
|
|
# ============================================================================
|
|
# BUILD TARGETS
|
|
# ============================================================================
|
|
|
|
# Build all components (debug)
|
|
build:
|
|
cargo build --workspace
|
|
|
|
# Build all components (release, optimized)
|
|
release:
|
|
cargo build --workspace --release
|
|
|
|
# Build only the VMM
|
|
build-vmm:
|
|
cargo build -p volt-vmm
|
|
|
|
# Build only Stellarium
|
|
build-stellarium:
|
|
cargo build -p stellarium
|
|
|
|
# ============================================================================
|
|
# TESTING
|
|
# ============================================================================
|
|
|
|
# Run all unit tests
|
|
test:
|
|
cargo test --workspace
|
|
|
|
# Run tests with verbose output
|
|
test-verbose:
|
|
cargo test --workspace -- --nocapture
|
|
|
|
# Run integration tests (requires KVM)
|
|
test-integration:
|
|
cargo test --workspace --test '*' -- --ignored
|
|
|
|
# Run a specific test
|
|
test-one name:
|
|
cargo test --workspace {{name}} -- --nocapture
|
|
|
|
# ============================================================================
|
|
# CODE QUALITY
|
|
# ============================================================================
|
|
|
|
# Run clippy linter
|
|
lint:
|
|
cargo clippy --workspace --all-targets -- -D warnings
|
|
|
|
# Run rustfmt
|
|
fmt:
|
|
cargo fmt --all
|
|
|
|
# Check formatting without modifying
|
|
fmt-check:
|
|
cargo fmt --all -- --check
|
|
|
|
# Run all checks (fmt + lint + test)
|
|
check: fmt-check lint test
|
|
|
|
# ============================================================================
|
|
# DOCUMENTATION
|
|
# ============================================================================
|
|
|
|
# Build documentation
|
|
doc:
|
|
cargo doc --workspace --no-deps
|
|
|
|
# Build and open documentation
|
|
doc-open:
|
|
cargo doc --workspace --no-deps --open
|
|
|
|
# ============================================================================
|
|
# KERNEL & ROOTFS
|
|
# ============================================================================
|
|
|
|
# Build microVM kernel
|
|
build-kernel:
|
|
./scripts/build-kernel.sh
|
|
|
|
# Build test rootfs
|
|
build-rootfs:
|
|
./scripts/build-rootfs.sh
|
|
|
|
# Build all VM assets (kernel + rootfs)
|
|
build-assets: build-kernel build-rootfs
|
|
|
|
# ============================================================================
|
|
# RUNNING
|
|
# ============================================================================
|
|
|
|
# Run a test VM
|
|
run-vm:
|
|
./scripts/run-vm.sh
|
|
|
|
# Run VMM in debug mode
|
|
run-debug kernel rootfs:
|
|
RUST_LOG=debug cargo run -- \
|
|
--kernel {{kernel}} \
|
|
--rootfs {{rootfs}} \
|
|
--memory 128 \
|
|
--cpus 1
|
|
|
|
# ============================================================================
|
|
# DEVELOPMENT
|
|
# ============================================================================
|
|
|
|
# Watch for changes and rebuild
|
|
watch:
|
|
cargo watch -x 'build --workspace'
|
|
|
|
# Watch and run tests
|
|
watch-test:
|
|
cargo watch -x 'test --workspace'
|
|
|
|
# Clean build artifacts
|
|
clean:
|
|
cargo clean
|
|
rm -rf kernels/*.vmlinux
|
|
rm -rf images/*.img
|
|
|
|
# Show dependency tree
|
|
deps:
|
|
cargo tree --workspace
|
|
|
|
# Update dependencies
|
|
update:
|
|
cargo update
|
|
|
|
# ============================================================================
|
|
# CI/CD
|
|
# ============================================================================
|
|
|
|
# Full CI check (what CI runs)
|
|
ci: fmt-check lint test
|
|
@echo "✓ All CI checks passed"
|
|
|
|
# Build release artifacts
|
|
dist: release
|
|
mkdir -p dist
|
|
cp target/release/volt-vmm dist/
|
|
cp target/release/stellarium dist/
|
|
@echo "Release artifacts in dist/"
|
|
|
|
# ============================================================================
|
|
# UTILITIES
|
|
# ============================================================================
|
|
|
|
# Show project stats
|
|
stats:
|
|
@echo "Lines of Rust code:"
|
|
@find . -name "*.rs" -not -path "./target/*" | xargs wc -l | tail -1
|
|
@echo ""
|
|
@echo "Crate sizes:"
|
|
@du -sh target/release/volt-vmm 2>/dev/null || echo " (not built)"
|
|
@du -sh target/release/stellarium 2>/dev/null || echo " (not built)"
|
|
|
|
# Check if KVM is available
|
|
check-kvm:
|
|
@test -e /dev/kvm && echo "✓ KVM available" || echo "✗ KVM not available"
|
|
@test -r /dev/kvm && echo "✓ KVM readable" || echo "✗ KVM not readable"
|
|
@test -w /dev/kvm && echo "✓ KVM writable" || echo "✗ KVM not writable"
|