summaryrefslogtreecommitdiff
path: root/usr.sbin/vmd/config.c
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2017-03-25 16:28:26 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2017-03-25 16:28:26 +0000
commit0794fafa650ee57195391a1438b9ba412c220412 (patch)
treeee6417921af6ed135f0b0b30b9220aa9eff841a6 /usr.sbin/vmd/config.c
parent7fd154d0570bf797098441e117e6bf1aab4af5cc (diff)
Boot using BIOS from /etc/firmware/vmm-bios by default.
Instead of using the internal "vmboot", VMs will now be booted using the external BIOS firmware in /etc/firmware/vmm-bios (which is subject to a LGPLv3 license). Direct booting of OpenBSD kernels or non-default BIOS images is still supported for now using the -b/boot option that is replacing the -k/kernel option. As requested by Theo, vmd(8) fails if neither the default BIOS is found nor a kernel has been specified in the VM configuration. The "vmm" BIOS has to be installed using fw_update(1), which will be done automatically in most cases where the OpenBSD can fetch it after install/upgrade. OK mlarkin@
Diffstat (limited to 'usr.sbin/vmd/config.c')
-rw-r--r--usr.sbin/vmd/config.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/usr.sbin/vmd/config.c b/usr.sbin/vmd/config.c
index b0abf53b773..f0c94744b85 100644
--- a/usr.sbin/vmd/config.c
+++ b/usr.sbin/vmd/config.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: config.c,v 1.26 2017/03/02 07:33:37 reyk Exp $ */
+/* $OpenBSD: config.c,v 1.27 2017/03/25 16:28:25 reyk Exp $ */
/*
* Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
@@ -163,8 +163,19 @@ config_setvm(struct privsep *ps, struct vmd_vm *vm, uint32_t peerid, uid_t uid)
/* Open external kernel for child */
if (strlen(vcp->vcp_kernel) &&
(kernfd = open(vcp->vcp_kernel, O_RDONLY)) == -1) {
- log_warn("%s: can't open kernel %s", __func__,
- vcp->vcp_kernel);
+ log_warn("%s: can't open kernel/BIOS boot image %s",
+ __func__, vcp->vcp_kernel);
+ goto fail;
+ }
+
+ /*
+ * Try to open the default BIOS image if no kernel/BIOS has
+ * been specified. The BIOS is an external firmware file that is
+ * typically distributed separately due to an incompatible license.
+ */
+ if (kernfd == -1 &&
+ (kernfd = open(VM_DEFAULT_BIOS, O_RDONLY)) == -1) {
+ log_warn("%s: can't open %s", __func__, VM_DEFAULT_BIOS);
goto fail;
}