On 06/09/2016 08:46 AM, Jim Fehlig wrote:
Prefer firmwares specified via --with-loader-nvram configure
option. If none are specified, use the Xen-provided default
firmwares found in LIBXL_FIRMWARE_DIR.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
src/libxl/libxl_conf.c | 21 +++++++++++++++++++++
src/libxl/libxl_conf.h | 4 ++++
2 files changed, 25 insertions(+)
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index a64b4c1..b347b8c 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -104,6 +104,7 @@ libxlDriverConfigDispose(void *obj)
VIR_FREE(cfg->saveDir);
VIR_FREE(cfg->autoDumpDir);
VIR_FREE(cfg->lockManagerName);
+ virFirmwareFreeList(cfg->firmwares, cfg->nfirmwares);
}
@@ -1777,6 +1778,26 @@ libxlDriverConfigNew(void)
goto error;
}
+#ifdef DEFAULT_LOADER_NVRAM
+ if (virFirmwareParseList(DEFAULT_LOADER_NVRAM,
+ &cfg->firmwares,
+ &cfg->nfirmwares) < 0)
+ goto error;
+
+#else
+ if (VIR_ALLOC_N(cfg->firmwares, 2) < 0)
+ goto error;
+ cfg->nfirmwares = 2;
+ if (VIR_ALLOC(cfg->firmwares[0]) < 0 || VIR_ALLOC(cfg->firmwares[1]) <
0)
+ goto error;
+
+ if (VIR_STRDUP(cfg->firmwares[0]->name,
+ LIBXL_FIRMWARE_DIR "/hvmloader") < 0 ||
+ VIR_STRDUP(cfg->firmwares[1]->name,
+ LIBXL_FIRMWARE_DIR "/ovmf.bin") < 0)
+ goto error;
+#endif
+
I'm going to rework this hunk a bit in V3 since hvmloader should always be
present in cfg->firmwares.
Regards,
Jim