Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Aug 2015 22:29:31 +0000 (UTC)
From:      Devin Teske <dteske@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r393501 - in head/emulators/xen-kernel: . files
Message-ID:  <201508032229.t73MTVEE043296@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dteske (src committer)
Date: Mon Aug  3 22:29:30 2015
New Revision: 393501
URL: https://svnweb.freebsd.org/changeset/ports/393501

Log:
  Move Xen Kernel menuitem to Boot Options submenu. Prevent conflict with
  upcoming Boot Environment menu. The Xen Kernel is dynamically appended
  after the last menuitem in the Boot Options submenu. If xen_kernel is not
  defined in loader.conf(5) the Xen Kernel menuitem displays "N/A" versus
  "On"/"off". While here, fix-up the pkg-message (make capitalization of
  "in" vs. "In" consistent; make use of trailing ":" consistent; move a
  comment out of the way of file contents, etc.).
  
  Differential Revision:	https://reviews.freebsd.org/D2717
  Reviewed by:	allanjude, bapt
  Approved by:	bapt

Modified:
  head/emulators/xen-kernel/Makefile
  head/emulators/xen-kernel/files/xen.4th
  head/emulators/xen-kernel/pkg-message

Modified: head/emulators/xen-kernel/Makefile
==============================================================================
--- head/emulators/xen-kernel/Makefile	Mon Aug  3 22:18:28 2015	(r393500)
+++ head/emulators/xen-kernel/Makefile	Mon Aug  3 22:29:30 2015	(r393501)
@@ -3,7 +3,7 @@
 PORTNAME=	xen
 PKGNAMESUFFIX=	-kernel
 PORTVERSION=	4.5.0
-PORTREVISION=	4
+PORTREVISION=	5
 CATEGORIES=	emulators
 MASTER_SITES=	http://bits.xensource.com/oss-xen/release/${PORTVERSION}/
 

Modified: head/emulators/xen-kernel/files/xen.4th
==============================================================================
--- head/emulators/xen-kernel/files/xen.4th	Mon Aug  3 22:18:28 2015	(r393500)
+++ head/emulators/xen-kernel/files/xen.4th	Mon Aug  3 22:29:30 2015	(r393501)
@@ -1,24 +1,99 @@
+\ Copyright (c) 2015 Devin Teske <dteske@FreeBSD.org>
+\ All rights reserved.
+\ 
+\ Redistribution and use in source and binary forms, with or without
+\ modification, are permitted provided that the following conditions
+\ are met:
+\ 1. Redistributions of source code must retain the above copyright
+\    notice, this list of conditions and the following disclaimer.
+\ 2. Redistributions in binary form must reproduce the above copyright
+\    notice, this list of conditions and the following disclaimer in the
+\    documentation and/or other materials provided with the distribution.
+\ 
+\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+\ ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+\ SUCH DAMAGE.
+\ 
+\ $FreeBSD$
+
+create xenkerndefault 64 allot
+0 xenkerndefault c!
+
 also menu-command-helpers
+also menu-namespace
+
+: init_xen_active ( N -- N )
+	s" [X]en Kernel.. off"                2 pick menu_caption[x] setenv
+	s" [X]en Kernel.. On"                 2 pick toggled_text[x] setenv
+	s" toggle_xen"                        2 pick menu_command[x] setenv
+	s" 120"                               2 pick menu_keycode[x] setenv
+	s" ^[1mX^[men Kernel.. ^[34;1mOff^[m" 2 pick ansi_caption[x] setenv
+	s" ^[1mX^[men Kernel.. ^[32;7mOn^[m"  2 pick toggled_ansi[x] setenv
+;
+
+: init_xen_inactive ( N -- N )
+	s" Xen Kernel.. N/A" 2dup
+	4 pick menu_caption[x] setenv
+	2 pick ansi_caption[x] setenv
+	s" true" 2 pick menu_command[x] setenv
+;
+
+: init_xen ( -- )
+	s" optionsmenu_options" getenv 0> if
+		c@ dup [char] 0 > over [char] 9 < and false = if
+			drop [char] 0
+		then
+		1+
+	else
+		[char] 1
+	then
+	begin
+		dup [char] 8 > if
+			false ( break )
+		else
+			dup s" optionsmenu_caption[x]" 20 +c! getenv -1 = if
+				false ( break )
+			else
+				drop true
+			then
+		then
+	while
+		1+
+	repeat
+
+	s" xen_kernel" getenv dup -1 <> over 0> and if
+		xenkerndefault 1+ 0 2swap strcat swap 1- c!
+		init_xen_active ( n -- n )
+		toggle_menuitem ( n -- n )
+	else
+		drop
+		xenkerndefault c@ 0<> if
+			init_xen_active ( n -- n )
+		else
+			init_xen_inactive ( n -- n )
+		then
+	then
+;
 
-: boot_xen_disabled ( N -- NOTREACHED )
+: toggle_xen ( N -- N TRUE )
         toggle_menuitem ( n -- n )
         menu-redraw
-        500 ms
-        0 25 at-xy
-        s" xen_kernel" getenv dup -1 <> if
-	  1 1 unload
-          s" xen_kernel" unsetenv
+
+	dup toggle_stateN @ 0= if
+		s" xen_kernel" unsetenv
 	else
-	  drop
-	  0  
+		xenkerndefault count s" xen_kernel" setenv
 	then
-        0 boot ( state -- )
-;
 
-set mainmenu_caption[7]="Disable [X]en"
-set maintoggled_text[7]="Disabling [X]en..."
-set mainansi_caption[7]="Disable ^[1mX^[men"
-set maintoggled_ansi[7]="Disabling ^[1mX^[men..."
-set mainmenu_keycode[7]=120
-set mainmenu_command[7]="boot_xen_disabled"
+	TRUE \ loop menu again
+;
 
+set optionsmenu_init="$optionsmenu_init init_xen"

Modified: head/emulators/xen-kernel/pkg-message
==============================================================================
--- head/emulators/xen-kernel/pkg-message	Mon Aug  3 22:18:28 2015	(r393500)
+++ head/emulators/xen-kernel/pkg-message	Mon Aug  3 22:29:30 2015	(r393501)
@@ -1,17 +1,17 @@
 Please add the following entries in order to boot the xen kernel
 
-in /etc/sysctl.conf:
+In /etc/sysctl.conf:
 	vm.max_wired=-1
 
-in /etc/ttys
+In /etc/ttys:
 	xc0 	"/usr/libexec/getty Pc"         xterm   on  secure
 
-In /boot/loader.conf for a dom0 with 2G memory and 4 vcpus
+In /boot/loader.conf for a dom0 with 2G memory and 4 vcpus:
 	xen_kernel="/boot/xen"
 	xen_cmdline="dom0_mem=2048M dom0_max_vcpus=4 dom0pvh=1 com1=115200,8n1 guest_loglvl=all loglvl=all"
 
-Add
-	console=com1 to the above xen_cmdline in order to activate the serial console
+Add to the above xen_cmdline in order to activate the serial console:
+	console=com1
 
-In /boot/menu.rc.local
+In /boot/menu.rc.local:
 	try-include /boot/xen.4th



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201508032229.t73MTVEE043296>