Compare commits

...
2 Commits
Author SHA1 Message Date
hulthe 27b18a778e Add --guestfwd arg to boco boot
CI / build (push) Successful in 14s
2026-10-27 12:45:11 +01:00
hulthe 3eb5cd434c Add ability to pass arbitrary args to qemu
CI / build (push) Successful in 14s
2026-10-26 10:30:14 +01:00
+14 -1
View File
@@ -24,6 +24,10 @@ pub struct BootCmd {
#[clap(long)]
forward: Vec<PortForward>,
/// Pass a `guestfwd=...` argument to qemu `-nic` argument.
#[clap(long)]
guestfwd: Vec<String>,
/// Override the command to exec in the VM (base64-encoded on the kernel
/// cmdline as `boco.cmd=<b64>`). Overrides the CMD inferred at build time.
#[clap(long)]
@@ -35,6 +39,9 @@ pub struct BootCmd {
/// relative to the image's WORKINGDIR. Can be repeated.
#[clap(long)]
mount: Vec<String>,
/// Extra arguments to qemu
extra: Vec<String>,
}
/// Invoke `qemu` to boot a boco image. See [`BootCmd`] for options
@@ -46,8 +53,10 @@ pub(crate) fn boot(
name,
memory,
forward,
guestfwd,
cmd,
mount,
extra,
}: BootCmd,
) -> Result<()> {
let reg_dir = registry_dir(&name)?;
@@ -149,6 +158,9 @@ pub(crate) fn boot(
for forward in &forward {
_ = write!(&mut network, ",hostfwd={forward}");
}
for guestfwd in &guestfwd {
_ = write!(&mut network, ",guestfwd={guestfwd}");
}
let mut command = Command::new("qemu-system-x86_64");
@@ -165,7 +177,8 @@ pub(crate) fn boot(
.args(["-no-reboot"])
.args(["-append", &cmdline])
.args(["-nographic"])
.args(["-nic", &network]);
.args(["-nic", &network])
.args(&extra);
println!("{command:?}");