From owner-svn-src-projects@FreeBSD.ORG Tue Nov 6 21:48:46 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3FC83567; Tue, 6 Nov 2012 21:48:46 +0000 (UTC) (envelope-from neel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 08C898FC0C; Tue, 6 Nov 2012 21:48:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qA6LmjEw060105; Tue, 6 Nov 2012 21:48:45 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qA6Lmjic060103; Tue, 6 Nov 2012 21:48:45 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201211062148.qA6Lmjic060103@svn.freebsd.org> From: Neel Natu Date: Tue, 6 Nov 2012 21:48:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r242676 - projects/bhyve/usr.sbin/bhyveload X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Nov 2012 21:48:46 -0000 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); }