Rebrand to boco
CI / build (push) Successful in 13s

This commit is contained in:
hulthe committed 2026-09-11 17:56:38 +02:00
1 parent 8782baa705
commit a24e1efe31
12 files changed
+142 -142

No files matched your search

+15 -15
View File
@@ -1,8 +1,8 @@
//! QEMU: boot a registry entry with qemu-system-x86_64 using direct kernel
//! boot (-kernel/-initrd or -drive). The kernel is shared across all VMs
//! at $XDG_DATA_HOME/slim-rs/registry/vmlinuz. A universal /slim/init script (injected
//! at build time) handles VM bootstrap; /slim/exec runs the container's
//! CMD/ENTRYPOINT. Runtime overrides are delivered as `slim.cmd=<base64>`
//! at $XDG_DATA_HOME/boco/registry/vmlinuz. A universal /boco/init script (injected
//! at build time) handles VM bootstrap; /boco/exec runs the container's
//! CMD/ENTRYPOINT. Runtime overrides are delivered as `boco.cmd=<base64>`
//! on the kernel cmdline.
use anyhow::{Context, Result, bail};
@@ -16,7 +16,7 @@ use crate::{
};
#[derive(Args, Debug)]
pub struct RunCmd {
pub struct BootCmd {
/// Image tag / registry subdir name
name: String,
@@ -29,7 +29,7 @@ pub struct RunCmd {
forward: Vec<PortForward>,
/// Override the command to exec in the VM (base64-encoded on the kernel
/// cmdline as slim.cmd=<b64>). Overrides the CMD inferred at build time.
/// cmdline as boco.cmd=<b64>). Overrides the CMD inferred at build time.
#[clap(long)]
cmd: Option<String>,
@@ -41,14 +41,14 @@ pub struct RunCmd {
mount: Vec<String>,
}
pub(crate) fn run(
RunCmd {
pub(crate) fn boot(
BootCmd {
name,
memory,
forward,
cmd,
mount,
}: RunCmd,
}: BootCmd,
) -> Result<()> {
let reg_dir = registry_dir(&name)?;
let vmlinuz_path = registry_base_dir()?.join("vmlinuz");
@@ -67,7 +67,7 @@ pub(crate) fn run(
"rw".into(),
"earlyprintk=serial".into(),
"nokaslr".into(),
"init=/slim/init".into(),
"init=/boco/init".into(),
"devtmpfs.mount=1".into(), // Automatically mount /dev at boot
];
@@ -81,19 +81,19 @@ pub(crate) fn run(
fs_args = vec!["-initrd".to_string(), initrd_str];
cmdline.push("root=/dev/ram0".into());
} else {
bail!("Registry missing rootfs/initrd for '{name}'. Run `slim build` first.");
bail!("Registry missing rootfs/initrd for '{name}'. Run `boco build` first.");
}
if let Some(cmd) = &cmd {
let argv = ["/bin/sh".to_string(), "-c".to_string(), cmd.clone()];
let data: Vec<u8> = argv.join("\0").into_bytes();
let encoded = base64::engine::general_purpose::STANDARD.encode(&data);
cmdline.push(format!("slim.cmd={encoded}"));
cmdline.push(format!("boco.cmd={encoded}"));
}
// Build 9p shares for each --mount. Tags are short (slim0, slim1, …)
// Build 9p shares for each --mount. Tags are short (boco0, boco1, …)
// because 9p mount_tag has a ~31-byte limit. The guest destination path
// is passed on the kernel cmdline as slim.mount=<tag>:<base64(guest_path)>.
// is passed on the kernel cmdline as boco.mount=<tag>:<base64(guest_path)>.
// If no guest path is specified, the host path is used as the guest path.
let mut virtfs_args: Vec<String> = Vec::new();
for (i, spec) in mount.iter().enumerate() {
@@ -107,7 +107,7 @@ pub(crate) fn run(
let host_str = canonical
.to_str()
.context("Mount path is not valid UTF-8")?;
let tag = format!("slim{i}");
let tag = format!("boco{i}");
let dest_b64 = base64::engine::general_purpose::STANDARD.encode(guest_path.as_bytes());
// QEMU's QemuOpts splits on commas — escape literal commas in the
@@ -117,7 +117,7 @@ pub(crate) fn run(
virtfs_args.push(format!(
"local,path={host_escaped},mount_tag={tag},security_model=mapped-xattr"
));
cmdline.push(format!("slim.mount={tag}:{dest_b64}"));
cmdline.push(format!("boco.mount={tag}:{dest_b64}"));
}
println!("Booting {name} from registry: {}", reg_dir.display());