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>
---
src/bhyve/bhyve_command.c | 25 ++++++++++++-------
src/bhyve/bhyve_firmware.c | 3 +++
.../aarch64/bhyvexml2argv-bootloader.args | 9 +++++++
.../aarch64/bhyvexml2argv-bootloader.ldargs | 1 +
.../aarch64/bhyvexml2argv-bootloader.xml | 24 ++++++++++++++++++
tests/bhyvexml2argvtest.c | 1 +
6 files changed, 54 insertions(+), 9 deletions(-)
create mode 100644 tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-bootloader.args
create mode 100644 tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-bootloader.ldargs
create mode 100644 tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-bootloader.xml
diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c
index 8c1e06b736..e767afd18a 100644
--- a/src/bhyve/bhyve_command.c
+++ b/src/bhyve/bhyve_command.c
@@ -940,17 +940,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);
}
}
diff --git a/src/bhyve/bhyve_firmware.c b/src/bhyve/bhyve_firmware.c
index 57ad0031b0..54e3ce296a 100644
--- a/src/bhyve/bhyve_firmware.c
+++ b/src/bhyve/bhyve_firmware.c
@@ -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;
diff --git a/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-bootloader.args b/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-bootloader.args
new file mode 100644
index 0000000000..a07e70d7d4
--- /dev/null
+++ b/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-bootloader.args
@@ -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
diff --git a/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-bootloader.ldargs b/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-bootloader.ldargs
new file mode 100644
index 0000000000..421376db9e
--- /dev/null
+++ b/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-bootloader.ldargs
@@ -0,0 +1 @@
+dummy
diff --git a/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-bootloader.xml b/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-bootloader.xml
new file mode 100644
index 0000000000..6e1123e4e0
--- /dev/null
+++ b/tests/bhyvexml2argvdata/aarch64/bhyvexml2argv-bootloader.xml
@@ -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>
diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c
index 564f3fb433..26619a22b9 100644
--- a/tests/bhyvexml2argvtest.c
+++ b/tests/bhyvexml2argvtest.c
@@ -335,6 +335,7 @@ mymain(void)
DO_TEST("base");
DO_TEST("console");
+ DO_TEST("bootloader");
virObjectUnref(driver.caps);
virObjectUnref(driver.xmlopt);
--
2.51.2