supermachine 0.7.71

Run any OCI/Docker image as a hardware-isolated microVM on macOS HVF (Linux KVM and Windows WHP in progress). Single library API, zero flags for the common case, sub-100 ms cold-restore from snapshot.
Documentation
//! Assemble a KVM agent initramfs (newc cpio) in-process via the public
//! `Image::build_kvm_initramfs` — no external `cpio` tool. The output is a
//! drop-in `agent_initrd` for `kvm_bake` / `Image::bake_kvm{,_from_ref}`.
//!
//! Usage:
//!   kvm_initramfs <agent_bin> <busybox_bin> <out.cpio> <module.ko[.zst]>...
//!
//! Modules are insmod'd by the guest init in the order given.

#[cfg(all(target_os = "linux", target_arch = "x86_64"))]
fn main() {
    use std::path::PathBuf;
    let args: Vec<String> = std::env::args().collect();
    let agent =
        PathBuf::from(args.get(1).expect(
            "usage: kvm_initramfs <agent_bin> <busybox_bin> <out.cpio> <module.ko[.zst]>...",
        ));
    let busybox = PathBuf::from(args.get(2).expect("busybox_bin"));
    let out = PathBuf::from(args.get(3).expect("out.cpio"));
    let modules: Vec<PathBuf> = args[4..].iter().map(PathBuf::from).collect();

    supermachine::Image::build_kvm_initramfs(&agent, &busybox, &modules, &out)
        .expect("build_kvm_initramfs");
    let sz = std::fs::metadata(&out).map(|m| m.len()).unwrap_or(0);
    eprintln!(
        "=== wrote {} ({} bytes, {} modules) ===",
        out.display(),
        sz,
        modules.len()
    );
}

#[cfg(not(all(target_os = "linux", target_arch = "x86_64")))]
fn main() {
    eprintln!("kvm_initramfs is Linux/x86_64 only");
}