Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/bricoler/bricoler.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from .mtree import MtreeFile
from .task import Task, TaskParameter, TaskMeta, TaskSchedule
from .util import chdir, host_machine, info, run_cmd, warn
from .vm import FreeBSDVM, VMImage, VMHypervisor, BhyveRun, QEMURun
from .vm import FreeBSDVM, VMImage, VMHypervisor, BhyveRun, QEMURun, RVVMRun


class FreeBSDSrcRepository(GitRepository):
Expand Down Expand Up @@ -213,6 +213,7 @@ def run(self, ctx):
"MAKEOBJDIRPREFIX": objdir,
"SRCCONF": "/dev/null",
"__MAKE_CONF": "/dev/null",
"WITH_META_MODE": "yes",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, I've never really tried meta-mode. Does it require anything (e.g., filemon)?

}

self.src.repo.make(args, env=env)
Expand Down Expand Up @@ -405,7 +406,7 @@ def add_config_file(

add_config_file("firstboot")

if self.packages is not None:
if self.packages:
major = self.src.FreeBSD_version // 100000
pkgabi = f"FreeBSD:{major}:{machine.split('/')[1]}"

Expand Down Expand Up @@ -622,7 +623,13 @@ class FreeBSDVMBootTask(Task):
}

def run(self, ctx):
cls = QEMURun if self.hypervisor == VMHypervisor.QEMU else BhyveRun
match self.hypervisor:
case VMHypervisor.QEMU:
cls = QEMURun
case VMHypervisor.RVVM:
cls = RVVMRun
case _:
cls = BhyveRun
vmrun = cls(
image=self.vm_image.image,
memory=self.memory,
Expand Down
15 changes: 15 additions & 0 deletions src/bricoler/vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def select(self, d: Dict[str, str], default=None) -> str:
class VMHypervisor(Enum):
BHYVE = 'bhyve'
QEMU = 'qemu'
RVVM = 'rvvm'


class VMRun:
Expand Down Expand Up @@ -136,6 +137,20 @@ def add_device(desc):
return [str(a) for a in bhyve_cmd]


class RVVMRun(VMRun):
def setup(self) -> List[str]:
rvvm_cmd = [
"rvvm",
"/usr/local/share/RVVM/fw_payload.bin",
"-image", f"{self.image.path}",
"-mem", f"{self.memory}M",
"-smp", f"{self.ncpus}",
"-nogui",
]
if self.nic_driver != VMRun.NetworkDriver.VIRTIO:
rvvm_cmd.extend(["-nonet"])
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumably this should raise an exception instead?

return rvvm_cmd

class QEMURun(VMRun):
def bios_path(self) -> Optional[Path]:
return self.image.select({
Expand Down