Index: head/emulators/xen-kernel/files/xen.4th =================================================================== --- head/emulators/xen-kernel/files/xen.4th +++ head/emulators/xen-kernel/files/xen.4th @@ -1,24 +1,99 @@ +\ Copyright (c) 2015 Devin Teske +\ 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" Index: head/emulators/xen-kernel/pkg-message =================================================================== --- head/emulators/xen-kernel/pkg-message +++ head/emulators/xen-kernel/pkg-message @@ -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