summaryrefslogtreecommitdiff
path: root/usr.sbin/vmd/vmm.c
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2016-11-26 20:03:43 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2016-11-26 20:03:43 +0000
commitad7fd0a6998e319d102963734595c29a6515c62a (patch)
tree248eb0804fb2c2652d1c50a9dcc958ca0773c35c /usr.sbin/vmd/vmm.c
parent61ff2306bc056ac447e38f4ab358282107d9a4a5 (diff)
Implement basic support for boot.conf(8) on the disk image.
Like the real boot loader, load and parse hd0a:/etc/boot.conf from the first disk and fall back to /bsd. Not all boot loader options are supported, but it at least does set device, set image, and boot -acds (eg. for booting single-user). For example, it can now boot install60.fs that includes a boot.conf with "set image /6.0/amd64/bsd.rd": vmctl start install -c -d install60.fs -d OpenBSD.img This pseudo-bootloader is only needed without BIOS and could potentially be replaced in the future. OK mlarkin@
Diffstat (limited to 'usr.sbin/vmd/vmm.c')
-rw-r--r--usr.sbin/vmd/vmm.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.sbin/vmd/vmm.c b/usr.sbin/vmd/vmm.c
index f9d9a23d026..3168243ed87 100644
--- a/usr.sbin/vmd/vmm.c
+++ b/usr.sbin/vmd/vmm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmm.c,v 1.57 2016/11/26 15:29:33 martijn Exp $ */
+/* $OpenBSD: vmm.c,v 1.58 2016/11/26 20:03:42 reyk Exp $ */
/*
* Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
@@ -460,13 +460,13 @@ int
start_vm(struct imsg *imsg, uint32_t *id)
{
struct vm_create_params *vcp;
+ struct vmboot_params vmboot;
struct vmd_vm *vm;
size_t i;
int ret = EINVAL;
int fds[2], nicfds[VMM_MAX_NICS_PER_VM];
struct vcpu_reg_state vrs;
FILE *kernfp;
- void *boot;
if ((vm = vm_getbyvmid(imsg->hdr.peerid)) == NULL) {
log_warnx("%s: can't find vm", __func__);
@@ -569,17 +569,18 @@ start_vm(struct imsg *imsg, uint32_t *id)
/* Find and open kernel image */
if ((kernfp = vmboot_open(vm->vm_kernel,
- vm->vm_disks[0], &boot)) == NULL)
+ vm->vm_disks[0], &vmboot)) == NULL)
fatalx("failed to open kernel - exiting");
/* Load kernel image */
- ret = loadelf_main(kernfp, vcp, &vrs);
+ ret = loadelf_main(kernfp, vcp, &vrs,
+ vmboot.vbp_bootdev, vmboot.vbp_howto);
if (ret) {
errno = ret;
fatal("failed to load kernel - exiting");
}
- vmboot_close(kernfp, boot);
+ vmboot_close(kernfp, &vmboot);
if (vm->vm_kernel != -1)
close(vm->vm_kernel);