diff options
author | neel <neel@FreeBSD.org> | 2012-11-06 21:48:45 +0000 |
---|---|---|
committer | neel <neel@FreeBSD.org> | 2012-11-06 21:48:45 +0000 |
commit | 263c4acf84c3be71025f3484c0378a83cd668e15 (patch) | |
tree | 793144308bc0e2fea6257a7e5fccdad9f90d4d73 /usr.sbin | |
parent | 9aedd7f40e1c87465278d0d58352d48b5b420aa4 (diff) | |
download | FreeBSD-src-263c4acf84c3be71025f3484c0378a83cd668e15.zip FreeBSD-src-263c4acf84c3be71025f3484c0378a83cd668e15.tar.gz |
Use the new userboot 'getenv' callback to set a couple of environment variables
in the guest.
The variables are: smbios.bios.vendor=BHYVE and boot_serial=1
The FreeBSD guest uses the "smbios.bios.vendor" environment variable to
detect whether or not it is running as a guest inside a hypervisor.
The "boot_serial=1" is temporary and will be dropped when bhyve can do VGA
emulation.
Obtained from: NetApp
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/bhyveload/bhyveload.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/usr.sbin/bhyveload/bhyveload.c b/usr.sbin/bhyveload/bhyveload.c index b8be5e3..3b7fad4 100644 --- a/usr.sbin/bhyveload/bhyveload.c +++ b/usr.sbin/bhyveload/bhyveload.c @@ -471,6 +471,25 @@ cb_getmem(void *arg, uint64_t *ret_lowmem, uint64_t *ret_highmem) *ret_highmem = highmem; } +static const char * +cb_getenv(void *arg, int num) +{ + int max; + + static const char * var[] = { + "smbios.bios.vendor=BHYVE", + "boot_serial=1", + NULL + }; + + max = sizeof(var) / sizeof(var[0]); + + if (num < max) + return (var[num]); + else + return (NULL); +} + static struct loader_callbacks_v1 cb = { .getc = cb_getc, .putc = cb_putc, @@ -497,6 +516,8 @@ static struct loader_callbacks_v1 cb = { .delay = cb_delay, .exit = cb_exit, .getmem = cb_getmem, + + .getenv = cb_getenv, }; static void @@ -600,5 +621,5 @@ main(int argc, char** argv) if (disk_image) { disk_fd = open(disk_image, O_RDONLY); } - func(&cb, NULL, USERBOOT_VERSION_1, disk_fd >= 0); + func(&cb, NULL, USERBOOT_VERSION_3, disk_fd >= 0); } |