Move vmlinuz out of registry dir.
CI / build (push) Failing after 22s

This commit is contained in:
hulthe committed 2026-10-20 14:45:14 +02:00
1 parent 8ad6754328
commit aa4bc0401b
2 files changed
+14 -13

No files matched your search

+8 -13
View File
@@ -1,13 +1,4 @@
//! QEMU: boot a registry entry with qemu-system-x86_64 using direct kernel //! See [`boot`]
//! boot (-kernel/-initrd or -drive). The kernel is shared across all VMs
//! 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. Host directories are shared into the guest via
//! virtio-fs: one virtiofsd daemon (under `podman unshare` for rootless
//! UID mapping) per `--mount`, plus a `-chardev socket` + `-device
//! vhost-user-fs-pci` pair on the QEMU side. The guest mounts each share
//! with `mount -t virtiofs <tag> <dest>` (see `boco.mount=` cmdline).
use anyhow::{Context, Result, bail}; use anyhow::{Context, Result, bail};
use base64::Engine; use base64::Engine;
@@ -16,7 +7,7 @@ use std::{fmt::Write as _, process::Command};
use crate::{ use crate::{
forward::PortForward, forward::PortForward,
registry::{registry_base_dir, registry_dir}, registry::{registry_dir, vmlinuz_path},
virtiofs::{self, VirtiofsShare}, virtiofs::{self, VirtiofsShare},
}; };
@@ -46,6 +37,10 @@ pub struct BootCmd {
mount: Vec<String>, mount: Vec<String>,
} }
/// Invoke `qemu` to boot a boco image. See [`BootCmd`] for options
///
/// This uses qemu's direct-kernel-boot with `-kernel`, so it does not require a bootloader.
/// The boco image is just an ext4 rootfs.
pub(crate) fn boot( pub(crate) fn boot(
BootCmd { BootCmd {
name, name,
@@ -56,13 +51,13 @@ pub(crate) fn boot(
}: BootCmd, }: BootCmd,
) -> Result<()> { ) -> Result<()> {
let reg_dir = registry_dir(&name)?; let reg_dir = registry_dir(&name)?;
let vmlinuz_path = registry_base_dir()?.join("vmlinuz"); let vmlinuz_path = vmlinuz_path()?;
let initrd_path = reg_dir.join("initrd"); let initrd_path = reg_dir.join("initrd");
let qcow2_path = reg_dir.join("image.qcow2"); let qcow2_path = reg_dir.join("image.qcow2");
if !vmlinuz_path.exists() { if !vmlinuz_path.exists() {
// TODO: guide user in how to set up a kernel // TODO: guide user in how to set up a kernel
bail!( bail!(
"No kernel available. Place a vmlinuz at {}", "No kernel available. Expected vmlinuz at {}",
vmlinuz_path.display() vmlinuz_path.display()
); );
} }
+6
View File
@@ -26,6 +26,12 @@ pub(crate) fn validate_image_name(name: &str) -> Result<()> {
Ok(()) Ok(())
} }
pub(crate) fn vmlinuz_path() -> Result<PathBuf> {
let base = xdg::BaseDirectories::with_prefix("boco");
base.place_data_file("vmlinuz")
.context("Failed to create XDG_DATA_HOME subdirectory")
}
pub(crate) fn registry_base_dir() -> Result<PathBuf> { pub(crate) fn registry_base_dir() -> Result<PathBuf> {
let base = xdg::BaseDirectories::with_prefix("boco"); let base = xdg::BaseDirectories::with_prefix("boco");
base.create_data_directory("registry") base.create_data_directory("registry")