diff options
| author | 2016-11-24 07:58:55 +0000 | |
|---|---|---|
| committer | 2016-11-24 07:58:55 +0000 | |
| commit | 82fb2f0a21ca29e03649333bae22e69c6ea0a08a (patch) | |
| tree | ebfeece80d10b167f346dfac4aaa29aec348950b /usr.sbin/vmd/config.c | |
| parent | reset the io event when data is queued. (diff) | |
| download | wireguard-openbsd-82fb2f0a21ca29e03649333bae22e69c6ea0a08a.tar.xz wireguard-openbsd-82fb2f0a21ca29e03649333bae22e69c6ea0a08a.zip | |
Add support for booting the kernel from the disk image.
This make the kernel/-k argument optional and, if not specified, tries
to find the /bsd kernel in the primary hd0a partition of the first
disk image itself. It doesn't support hd0a:/etc/boot.conf yet, and it
is no BIOS or full boot loader, but it makes booting and handling of
VMs a bit easier - booting an external kernel is still supported.
The UFS file system code ufs.c is directly from libsa which is also
used by the real boot loader. The code compiles with a few signedness
warning which will be fixed separately.
OK mlarkin@
Diffstat (limited to 'usr.sbin/vmd/config.c')
| -rw-r--r-- | usr.sbin/vmd/config.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/usr.sbin/vmd/config.c b/usr.sbin/vmd/config.c index 76f2c8851b7..6f79fa7f212 100644 --- a/usr.sbin/vmd/config.c +++ b/usr.sbin/vmd/config.c @@ -1,4 +1,4 @@ -/* $OpenBSD: config.c,v 1.20 2016/11/22 21:55:54 reyk Exp $ */ +/* $OpenBSD: config.c,v 1.21 2016/11/24 07:58:55 reyk Exp $ */ /* * Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org> @@ -160,8 +160,9 @@ config_setvm(struct privsep *ps, struct vmd_vm *vm, uint32_t peerid) vm->vm_peerid = peerid; - /* Open kernel for child */ - if ((kernfd = open(vcp->vcp_kernel, O_RDONLY)) == -1) { + /* 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); goto fail; @@ -305,12 +306,9 @@ config_getvm(struct privsep *ps, struct imsg *imsg) errno = 0; if (vm_register(ps, &vmc, &vm, imsg->hdr.peerid) == -1) - return (-1); - - if (imsg->fd == -1) { - log_debug("invalid kernel fd"); goto fail; - } + + /* If the fd is -1, the kernel will be searched on the disk */ vm->vm_kernel = imsg->fd; vm->vm_running = 1; |
