churchers / vm-bhyve

Shell based, minimal dependency bhyve manager
BSD 2-Clause "Simplified" License
840 stars 181 forks source link

Specify a custom -l bootrom command for a .fd file? #519

Closed 0w8States closed 1 year ago

0w8States commented 1 year ago

I'm just getting started with vm-bhyve, but I ran into an issue where I need to specify my .fd file. How would you do this inside the .conf file for the vm?

I usually use "-l bootrom,/usr/local/share/uefi-firmware/BHYVE_BHF_UEFI.fd" when launching my vm from bhyve. I noticed these two parameters are listed in the man page, but not quite sure how to use them to specify the .fd file.

bhyveload_loader="" bhyveload_args="-e machdep.hyperthreading_allowed=0"

GogoFC commented 1 year ago

So I'm gonna answer this anyway although it might not be the answer you're looking for. I'm not an expert at bhyve.

I wasn't sure if you ran into an issue where you actually wanted to specify a custom .fd file or you just got an error that it couldn't find that .fd file when trying to boot a guest . I don't have that particular file on version 13.2, there are 4 other files. I don't really know what a custom fd file does.

But in case you're just trying to boot using UEFI with EFI variables and not something else which I didn't understand....

To use uefi bootloader set loader="uefi" and graphics="yes" To use UEFI variables add uefi_vars="yes" to the config file.

loader="uefi"
graphics="yes"
uefi_vars="yes"
xhci_mouse="yes"

Found out about it here:

https://github.com/churchers/vm-bhyve/issues/449

https://github.com/churchers/vm-bhyve/blob/ec0e12e97465822d65ab32e791049d69791d49cb/lib/vm-run#L306

The custom fd is mentioned here: https://github.com/churchers/vm-bhyve/blob/ec0e12e97465822d65ab32e791049d69791d49cb/lib/vm-run#L292

The complete config file I use for Debian 12 is:

loader="uefi"
cpu=4
memory=4096M
network0_type="virtio-net"
network0_switch="public"
graphics="yes"
xhci_mouse="yes"
graphics_res="1600x900"
#zfs_zvol_opts="volblocksize=128k"
disk0_name="disk0"
disk0_dev="sparse-zvol"
disk0_type="virtio-blk"
uefi_vars="yes"
0w8States commented 1 year ago

Thanks for the assist @GogoFC

It led me in the right direction. I noticed in the vm-run a few lines up that there is a loader type of "uefi-custom". I just did a copy of my custom .fd file to the base VM directory and used the flag loader="uefi-custom". It solved all my issues!