svn commit: r242676 - projects/bhyve/usr.sbin/bhyveload
Neel Natu
neel at FreeBSD.org
Tue Nov 6 21:48:46 UTC 2012
Author: neel
Date: Tue Nov 6 21:48:45 2012
New Revision: 242676
URL: http://svnweb.freebsd.org/changeset/base/242676
Log:
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
Modified:
projects/bhyve/usr.sbin/bhyveload/bhyveload.c
Modified: projects/bhyve/usr.sbin/bhyveload/bhyveload.c
==============================================================================
--- projects/bhyve/usr.sbin/bhyveload/bhyveload.c Tue Nov 6 21:36:37 2012 (r242675)
+++ projects/bhyve/usr.sbin/bhyveload/bhyveload.c Tue Nov 6 21:48:45 2012 (r242676)
@@ -471,6 +471,25 @@ cb_getmem(void *arg, uint64_t *ret_lowme
*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);
}
More information about the svn-src-projects
mailing list