---
src/bhyve/bhyve_command.c | 6 ++++++
src/bhyve/bhyve_driver.c | 27 +++++++++++++++++++++++----
2 files changed, 29 insertions(+), 4 deletions(-)
diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c
index 9ad3f9b..a504788 100644
--- a/src/bhyve/bhyve_command.c
+++ b/src/bhyve/bhyve_command.c
@@ -281,6 +281,12 @@ virBhyveProcessBuildBhyveCmd(virConnectPtr conn,
virCommandAddArg(cmd, "-P"); /* vmexit from guest on pause */
virCommandAddArgList(cmd, "-s", "0:0,hostbridge", NULL);
+ if (def->os.bootloader == NULL &&
+ def->os.loader &&
+ (bhyveDriverGetCaps(conn) & BHYVE_CAP_LPC_BOOTROM) != 0) {
+ virCommandAddArg(cmd, "-s");
+ virCommandAddArgFormat(cmd, "0:1,bootrom,%s",
def->os.loader->path);
+ }
/* Devices */
for (i = 0; i < def->nnets; i++) {
virDomainNetDefPtr net = def->nets[i];
diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index 8036661..cd56a89 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -729,15 +729,34 @@ bhyveConnectDomainXMLToNative(virConnectPtr conn,
if (bhyveDomainAssignAddresses(def, NULL) < 0)
goto cleanup;
- if (!(loadcmd = virBhyveProcessBuildLoadCmd(conn, def,
"<device.map>",
+ if (def->os.bootloader == NULL &&
+ def->os.loader) {
+
+ if ((def->os.loader->readonly != VIR_TRISTATE_BOOL_YES)
+ || (def->os.loader->type != VIR_DOMAIN_LOADER_TYPE_PFLASH)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Only read-only pflash is supported."));
+ goto cleanup;
+ }
+
+ if ((bhyveDriverGetCaps(conn) & BHYVE_CAP_LPC_BOOTROM) == 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Installed bhyve binary does not support "
+ "bootrom"));
+ goto cleanup;
+ }
+ } else {
+ if (!(loadcmd = virBhyveProcessBuildLoadCmd(conn, def,
"<device.map>",
NULL)))
- goto cleanup;
+ goto cleanup;
+
+ virBufferAdd(&buf, virCommandToString(loadcmd), -1);
+ virBufferAddChar(&buf, '\n');
+ }
if (!(cmd = virBhyveProcessBuildBhyveCmd(conn, def, true)))
goto cleanup;
- virBufferAdd(&buf, virCommandToString(loadcmd), -1);
- virBufferAddChar(&buf, '\n');
virBufferAdd(&buf, virCommandToString(cmd), -1);
if (virBufferCheckError(&buf) < 0)
--
2.7.0