From 0794fafa650ee57195391a1438b9ba412c220412 Mon Sep 17 00:00:00 2001 From: Reyk Floeter Date: Sat, 25 Mar 2017 16:28:26 +0000 Subject: 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@ --- usr.sbin/vmd/config.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'usr.sbin/vmd/config.c') 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 @@ -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; } -- cgit v1.2.3