Add initial virtiofs support
CI / build (push) Failing after 14s

This commit is contained in:
hulthe committed 2026-09-26 13:23:21 +02:00
1 parent bfda3e626a
commit 8ad6754328
6 files changed
+301 -47

No files matched your search

+10 -10
View File
@@ -1,9 +1,9 @@
//! boco universal init.
//!
//! Injected by `boco build` at /boco/init and invoked via init=/boco/init.
//! Sets up devices, filesystems, networking, and 9p shares, then execs the
//! container's CMD/ENTRYPOINT (or a runtime override) with execvp so the
//! command becomes PID 1 directly.
//! Sets up devices, filesystems, networking, and virtio-fs shares, then
//! execs the container's CMD/ENTRYPOINT (or a runtime override) with
//! execvp so the command becomes PID 1 directly.
use base64::Engine;
use nix::mount::{MsFlags, mount};
@@ -208,7 +208,7 @@ fn setup_networking() {
});
}
fn setup_9p_shares(workdir: &str) {
fn setup_virtiofs_shares(workdir: &str) {
let cmdline = match fs::read_to_string("/proc/cmdline") {
Ok(c) => c,
Err(e) => {
@@ -227,12 +227,12 @@ fn setup_9p_shares(workdir: &str) {
Ok(bytes) => match String::from_utf8(bytes) {
Ok(s) => s,
Err(e) => {
warn(&format!("9p: invalid UTF-8 in guest path: {e}"));
warn(&format!("virtiofs: invalid UTF-8 in guest path: {e}"));
continue;
}
},
Err(e) => {
warn(&format!("9p: base64 decode failed: {e}"));
warn(&format!("virtiofs: base64 decode failed: {e}"));
continue;
}
};
@@ -248,9 +248,9 @@ fn setup_9p_shares(workdir: &str) {
try_mount(
Some(tag),
&dest,
Some("9p"),
Some("virtiofs"),
MsFlags::empty(),
Some("trans=virtio,version=9p2000.L"),
None,
);
}
}
@@ -412,9 +412,9 @@ fn main() {
// === Networking ===
setup_networking();
// === 9p shares ===
// === virtio-fs shares ===
let workdir = read_file_opt("/boco/workdir").unwrap_or_default();
setup_9p_shares(&workdir);
setup_virtiofs_shares(&workdir);
// === Environment & working directory ===
apply_env();