diff --git a/stand/lua/config.lua b/stand/lua/config.lua --- a/stand/lua/config.lua +++ b/stand/lua/config.lua @@ -513,6 +513,22 @@ end end +-- Auto-load modules required for explicit vfs paths +-- this allows bhyveload to pass just the env var in +-- and required modules can be autoloaded, allowing +-- bhyve to boot from a default FreeBSD install. +local function enableOptionalRootFSModules() + local mountfrom = loader.getenv("vfs.root.mountfrom") + if mountfrom == nil then + return + end + + -- Check for p9fs root and enable virtio_p9fs module + if mountfrom:match('^p9fs:') then + config.enableModule("virtio_p9fs") + end +end + -- Module exports config.verbose = false @@ -858,6 +874,7 @@ hook.runAll("kernel.loaded") print(MSG_MODLOADING) + enableOptionalRootFSModules() status = loadModule(modules, not config.verbose) hook.runAll("modules.loaded") return status