bhyve: command: handle arm64 bootloader

Just like consoles, bootloader is handled differently on arm64.
It also does not used the LPC bus, and is configured with:

 -o bootrom=/usr/local/share/u-boot/u-boot-bhyve-arm64/u-boot.bin

Additionally, fill firmware inforamtion only for amd64.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Roman Bogorodskiy committed 2026-01-07 21:00:44 +01:00
1 parent 24be4b8c0c
commit 8c971cdce1
6 files changed
+54 -9

No files matched your search

+16 -9
View File
@@ -1002,17 +1002,24 @@ virBhyveProcessBuildBhyveCmd(struct _bhyveConn *driver, virDomainDef *def,
if (def->os.bootloader == NULL &&
def->os.loader) {
if ((bhyveDriverGetBhyveCaps(driver) & BHYVE_CAP_LPC_BOOTROM)) {
virArch arch = def->os.arch;
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virBufferAsprintf(&buf, "bootrom,%s", def->os.loader->path);
if (def->os.loader->nvram && def->os.loader->nvram->path)
virBufferAsprintf(&buf, ",%s", def->os.loader->nvram->path);
virCommandAddArgList(cmd, "-l", virBufferContentAndReset(&buf), NULL);
} else {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Installed bhyve binary does not support UEFI loader"));
return NULL;
if (ARCH_IS_X86(arch)) {
if ((bhyveDriverGetBhyveCaps(driver) & BHYVE_CAP_LPC_BOOTROM)) {
virBufferAsprintf(&buf, "bootrom,%s", def->os.loader->path);
if (def->os.loader->nvram && def->os.loader->nvram->path)
virBufferAsprintf(&buf, ",%s", def->os.loader->nvram->path);
virCommandAddArgList(cmd, "-l", virBufferContentAndReset(&buf), NULL);
} else {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Installed bhyve binary does not support UEFI loader"));
return NULL;
}
} else if (ARCH_IS_ARM(arch)) {
virBufferAsprintf(&buf, "bootrom=%s", def->os.loader->path);
virCommandAddArgList(cmd, "-o", virBufferContentAndReset(&buf), NULL);
}
}
+3
View File
@@ -125,6 +125,9 @@ bhyveFirmwareFillDomain(bhyveConn *driver,
virCheckFlags(0, -1);
if (!ARCH_IS_X86(def->os.arch))
return 0;
if (def->os.firmware == VIR_DOMAIN_OS_DEF_FIRMWARE_NONE)
goto out;
@@ -0,0 +1,9 @@
bhyve \
-c 1 \
-m 214 \
-u \
-s 0:0,hostbridge \
-o bootrom=/usr/local/share/u-boot/u-boot-bhyve-arm64/u-boot.bin \
-s 3:0,virtio-net,faketapdev,mac=52:54:00:b9:94:02 \
-s 2:0,virtio-blk,/tmp/freebsd.img \
bhyve
@@ -0,0 +1 @@
dummy
@@ -0,0 +1,24 @@
<domain type='bhyve'>
<name>bhyve</name>
<uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid>
<memory>219136</memory>
<vcpu>1</vcpu>
<os>
<type>hvm</type>
<loader readonly='yes'>/usr/local/share/u-boot/u-boot-bhyve-arm64/u-boot.bin</loader>
</os>
<devices>
<disk type='file'>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd.img'/>
<target dev='vda' bus='virtio'/>
<address type='drive' controller='0' bus='0' target='2' unit='0'/>
</disk>
<interface type='bridge'>
<mac address='52:54:00:b9:94:02'/>
<model type='virtio'/>
<source bridge="virbr0"/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
</devices>
</domain>
+1
View File
@@ -336,6 +336,7 @@ mymain(void)
DO_TEST("base");
DO_TEST("console");
DO_TEST("bootloader");
virObjectUnref(driver.caps);
virObjectUnref(driver.xmlopt);