14af18995SSascha Wildner.\" 298b2ba80SSascha Wildner.\" Copyright (c) 2006, 2007 34af18995SSascha Wildner.\" The DragonFly Project. All rights reserved. 44af18995SSascha Wildner.\" 54af18995SSascha Wildner.\" Redistribution and use in source and binary forms, with or without 64af18995SSascha Wildner.\" modification, are permitted provided that the following conditions 74af18995SSascha Wildner.\" are met: 84af18995SSascha Wildner.\" 94af18995SSascha Wildner.\" 1. Redistributions of source code must retain the above copyright 104af18995SSascha Wildner.\" notice, this list of conditions and the following disclaimer. 114af18995SSascha Wildner.\" 2. Redistributions in binary form must reproduce the above copyright 124af18995SSascha Wildner.\" notice, this list of conditions and the following disclaimer in 134af18995SSascha Wildner.\" the documentation and/or other materials provided with the 144af18995SSascha Wildner.\" distribution. 154af18995SSascha Wildner.\" 3. Neither the name of The DragonFly Project nor the names of its 164af18995SSascha Wildner.\" contributors may be used to endorse or promote products derived 174af18995SSascha Wildner.\" from this software without specific, prior written permission. 184af18995SSascha Wildner.\" 194af18995SSascha Wildner.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 204af18995SSascha Wildner.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 214af18995SSascha Wildner.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 224af18995SSascha Wildner.\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 234af18995SSascha Wildner.\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 244af18995SSascha Wildner.\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, 254af18995SSascha Wildner.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 264af18995SSascha Wildner.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 274af18995SSascha Wildner.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 284af18995SSascha Wildner.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 294af18995SSascha Wildner.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 304af18995SSascha Wildner.\" SUCH DAMAGE. 314af18995SSascha Wildner.\" 32b6a66df5SSascha Wildner.Dd March 28, 2010 334af18995SSascha Wildner.Dt VKERNEL 7 344af18995SSascha Wildner.Os 354af18995SSascha Wildner.Sh NAME 360592e24dSSascha Wildner.Nm vkernel , 3798b2ba80SSascha Wildner.Nm vcd , 380592e24dSSascha Wildner.Nm vkd , 390592e24dSSascha Wildner.Nm vke 404af18995SSascha Wildner.Nd virtual kernel architecture 414af18995SSascha Wildner.Sh SYNOPSIS 42b6a66df5SSascha Wildner.Cd "platform vkernel # for 32 bit vkernels" 43b6a66df5SSascha Wildner.Cd "platform vkernel64 # for 64 bit vkernels" 4498b2ba80SSascha Wildner.Cd "device vcd" 45c8e7d028SSascha Wildner.Cd "device vkd" 46c8e7d028SSascha Wildner.Cd "device vke" 47c8e7d028SSascha Wildner.Pp 481a92ebbbSSamuel J. Greear.Pa /var/vkernel/boot/kernel/kernel 49278c4e67SSamuel J. Greear.Op Fl hsUv 50a72d8a9fSMatthew Dillon.Op Fl c Ar file 5109b03fffSSascha Wildner.Op Fl e Ar name Ns = Ns Li value : Ns Ar name Ns = Ns Li value : Ns ... 52dd54cb3aSSascha Wildner.Op Fl i Ar file 5309b03fffSSascha Wildner.Op Fl I Ar interface Ns Op Ar :address1 Ns Oo Ar :address2 Oc Ns Oo Ar /netmask Oc 54702acf06SJoe Talbott.Op Fl l Ar cpulock 554af18995SSascha Wildner.Op Fl m Ar size 56c5b0b0baSMatthew Dillon.Op Fl n Ar numcpus 57*bc3cc25eSMatthew Dillon.Op Fl p Ar pidfile 584af18995SSascha Wildner.Op Fl r Ar file 594af18995SSascha Wildner.Sh DESCRIPTION 604af18995SSascha WildnerThe 614af18995SSascha Wildner.Nm 624af18995SSascha Wildnerarchitecture allows for running 634af18995SSascha Wildner.Dx 644af18995SSascha Wildnerkernels in userland. 654af18995SSascha Wildner.Pp 664af18995SSascha WildnerThe following options are available: 674af18995SSascha Wildner.Bl -tag -width ".Fl m Ar size" 68a72d8a9fSMatthew Dillon.It Fl c Ar file 697834fbccSSascha WildnerSpecify a readonly CD-ROM image 70a72d8a9fSMatthew Dillon.Ar file 71a72d8a9fSMatthew Dillonto be used by the kernel, with the first 72a72d8a9fSMatthew Dillon.Fl c 73a72d8a9fSMatthew Dillonoption defining 74a72d8a9fSMatthew Dillon.Li vcd0 , 75a72d8a9fSMatthew Dillonthe second one 76a72d8a9fSMatthew Dillon.Li vcd1 , 7762aea38eSSascha Wildnerand so on. 7862aea38eSSascha WildnerThe first 79a72d8a9fSMatthew Dillon.Fl r 80a72d8a9fSMatthew Dillonor 81a72d8a9fSMatthew Dillon.Fl c 82a72d8a9fSMatthew Dillonoption specified on the command line will be the boot disk. 837834fbccSSascha WildnerThe CD9660 filesystem is assumed when booting from this media. 8409b03fffSSascha Wildner.It Fl e Ar name Ns = Ns Li value : Ns Ar name Ns = Ns Li value : Ns ... 8509b03fffSSascha WildnerSpecify an environment to be used by the kernel. 86278c4e67SSamuel J. Greear.It Fl h 87278c4e67SSamuel J. GreearShows a list of available options, each with a short description. 88dd54cb3aSSascha Wildner.It Fl i Ar file 89dd54cb3aSSascha WildnerSpecify a memory image 90dd54cb3aSSascha Wildner.Ar file 91dd54cb3aSSascha Wildnerto be used by the virtual kernel. 92dd54cb3aSSascha WildnerIf no 93dd54cb3aSSascha Wildner.Fl i 94dd54cb3aSSascha Wildneroption is given, the kernel will generate a name of the form 95dd54cb3aSSascha Wildner.Pa /var/vkernel/memimg.XXXXXX , 96dd54cb3aSSascha Wildnerwith the trailing 97dd54cb3aSSascha Wildner.Ql X Ns s 98dd54cb3aSSascha Wildnerbeing replaced by a sequential number, e.g.\& 99dd54cb3aSSascha Wildner.Pa memimg.000001 . 10009b03fffSSascha Wildner.It Fl I Ar interface Ns Op Ar :address1 Ns Oo Ar :address2 Oc Ns Oo Ar /netmask Oc 10109b03fffSSascha WildnerCreate a virtual network device, with the first 10209b03fffSSascha Wildner.Fl I 10309b03fffSSascha Wildneroption defining 1040592e24dSSascha Wildner.Li vke0 , 10509b03fffSSascha Wildnerthe second one 1060592e24dSSascha Wildner.Li vke1 , 10709b03fffSSascha Wildnerand so on. 10809b03fffSSascha Wildner.Pp 10909b03fffSSascha WildnerThe 11009b03fffSSascha Wildner.Ar interface 11109b03fffSSascha Wildnerargument is the name of a 11209b03fffSSascha Wildner.Xr tap 4 113*bc3cc25eSMatthew Dillondevice node or the path to a 114*bc3cc25eSMatthew Dillon.Xr vknetd 8 115*bc3cc25eSMatthew Dillonsocket. 11609b03fffSSascha WildnerThe 11709b03fffSSascha Wildner.Pa /dev/ 118*bc3cc25eSMatthew Dillonpath prefix does not have to be specified and will be automatically prepended 119*bc3cc25eSMatthew Dillonfor a device node. 12009b03fffSSascha WildnerSpecifying 12109b03fffSSascha Wildner.Cm auto 12209b03fffSSascha Wildnerwill pick the first unused 12309b03fffSSascha Wildner.Xr tap 4 12409b03fffSSascha Wildnerdevice. 12509b03fffSSascha Wildner.Pp 12609b03fffSSascha WildnerThe 12709b03fffSSascha Wildner.Ar address1 12809b03fffSSascha Wildnerand 12909b03fffSSascha Wildner.Ar address2 13009b03fffSSascha Wildnerarguments are the IP addresses of the 13109b03fffSSascha Wildner.Xr tap 4 13209b03fffSSascha Wildnerand 1330592e24dSSascha Wildner.Nm vke 13409b03fffSSascha Wildnerinterfaces. 13509b03fffSSascha WildnerOptionally, 13609b03fffSSascha Wildner.Ar address1 13709b03fffSSascha Wildnermay be of the form 13809b03fffSSascha Wildner.Li bridge Ns Em X 13909b03fffSSascha Wildnerin which case the 14009b03fffSSascha Wildner.Xr tap 4 14109b03fffSSascha Wildnerinterface is added to the specified 14209b03fffSSascha Wildner.Xr bridge 4 14309b03fffSSascha Wildnerinterface. 144a8cc122dSSascha WildnerThe 145a8cc122dSSascha Wildner.Nm vke 146a8cc122dSSascha Wildneraddress is not assigned until the interface is brought up in the guest. 14709b03fffSSascha Wildner.Pp 14809b03fffSSascha WildnerThe 14909b03fffSSascha Wildner.Ar netmask 15009b03fffSSascha Wildnerargument applies to all interfaces for which an address is specified. 151*bc3cc25eSMatthew Dillon.Pp 152*bc3cc25eSMatthew DillonWhen running multiple vkernels it is often more convenient to simply 153*bc3cc25eSMatthew Dillonconnect to a 154*bc3cc25eSMatthew Dillon.Xr vknetd 8 155*bc3cc25eSMatthew Dillonsocket and let vknetd deal with the tap and/or bridge. An example of 156*bc3cc25eSMatthew Dillonthis would be '/var/run/vknet:0.0.0.0:10.2.0.2/16'. 157702acf06SJoe Talbott.It Fl l Ar cpulock 158702acf06SJoe TalbottSpecify which, if any, real CPUs to lock virtual CPUs to. 159702acf06SJoe Talbott.Ar cpulock 160702acf06SJoe Talbottis one of 161702acf06SJoe Talbott.Cm any , 16226ea2793SSascha Wildner.Cm map Ns Op Ns , Ns Ar startCPU , 16326ea2793SSascha Wildneror 16426ea2793SSascha Wildner.Ar CPU . 165702acf06SJoe Talbott.Pp 166702acf06SJoe Talbott.Cm any 16726ea2793SSascha Wildnerdoes not map virtual CPUs to real CPUs. 16826ea2793SSascha WildnerThis is the default. 169702acf06SJoe Talbott.Pp 170702acf06SJoe Talbott.Cm map Ns Op Ns , Ns Ar startCPU 171702acf06SJoe Talbottmaps each virtual CPU to a real CPU starting with real CPU 0 or 172702acf06SJoe Talbott.Ar startCPU 173702acf06SJoe Talbottif specified. 174702acf06SJoe Talbott.Pp 175702acf06SJoe Talbott.Ar CPU 17626ea2793SSascha Wildnerlocks all virtual CPUs to the real CPU specified by 17726ea2793SSascha Wildner.Ar CPU . 1784af18995SSascha Wildner.It Fl m Ar size 1794af18995SSascha WildnerSpecify the amount of memory to be used by the kernel in bytes, 1804af18995SSascha Wildner.Cm K 1813cea05a4SSascha Wildner.Pq kilobytes , 1824af18995SSascha Wildner.Cm M 1833cea05a4SSascha Wildner.Pq megabytes 1843cea05a4SSascha Wildneror 1854af18995SSascha Wildner.Cm G 1863cea05a4SSascha Wildner.Pq gigabytes . 18709b03fffSSascha WildnerLowercase versions of 1884af18995SSascha Wildner.Cm K , M , 1894af18995SSascha Wildnerand 1904af18995SSascha Wildner.Cm G 1914af18995SSascha Wildnerare allowed. 192c5b0b0baSMatthew Dillon.It Fl n Ar numcpus 1938cf87c92SSascha WildnerSpecify the number of CPUs you wish to emulate. 19443cfb771SSascha WildnerUp to 16 CPUs are supported. 1958cf87c92SSascha WildnerThe virtual kernel must be built with 1968cf87c92SSascha Wildner.Cd options SMP 1978cf87c92SSascha Wildnerto use this option and will default to 2 CPUs unless otherwise specified. 198*bc3cc25eSMatthew Dillon.It Fl p Ar pidfile 199*bc3cc25eSMatthew DillonSpecify a pidfile in which to store the process ID. 200*bc3cc25eSMatthew DillonScripts can use this file to locate the vkernel pid for the purpose of 201*bc3cc25eSMatthew Dillonshutting down or killing it. 202*bc3cc25eSMatthew Dillon.Pp 203*bc3cc25eSMatthew DillonThe vkernel will hold a lock on the pidfile while running. 204*bc3cc25eSMatthew DillonScripts may test for the lock to determine if the pidfile is valid or 205*bc3cc25eSMatthew Dillonstale so as to avoid accidently killing a random process. 206*bc3cc25eSMatthew DillonSomething like '/usr/bin/lockf -ks -t 0 pidfile echo -n' may be used 207*bc3cc25eSMatthew Dillonto test the lock. 208*bc3cc25eSMatthew DillonA non-zero exit code indicates that the pidfile represents a running 209*bc3cc25eSMatthew Dillonvkernel. 210*bc3cc25eSMatthew Dillon.Pp 211*bc3cc25eSMatthew DillonAn error is issued and the vkernel exits if this file cannot be opened for 212*bc3cc25eSMatthew Dillonwriting or if it is already locked by an active vkernel process. 2134af18995SSascha Wildner.It Fl r Ar file 214a72d8a9fSMatthew DillonSpecify a R/W disk image 2154af18995SSascha Wildner.Ar file 216ec1a8a4dSSascha Wildnerto be used by the kernel, with the first 217ec1a8a4dSSascha Wildner.Fl r 218ec1a8a4dSSascha Wildneroption defining 2190592e24dSSascha Wildner.Li vkd0 , 220ec1a8a4dSSascha Wildnerthe second one 2210592e24dSSascha Wildner.Li vkd1 , 22262aea38eSSascha Wildnerand so on. 22362aea38eSSascha WildnerThe first 224a72d8a9fSMatthew Dillon.Fl r 225a72d8a9fSMatthew Dillonor 226a72d8a9fSMatthew Dillon.Fl c 227a72d8a9fSMatthew Dillonoption specified on the command line will be the boot disk. 228c8e7d028SSascha Wildner.It Fl s 229c8e7d028SSascha WildnerBoot into single-user mode. 23003071031SSascha Wildner.It Fl U 23103071031SSascha WildnerEnable writing to kernel memory and module loading. 23203071031SSascha WildnerBy default, those are disabled for security reasons. 2334af18995SSascha Wildner.It Fl v 2344af18995SSascha WildnerTurn on verbose booting. 2354af18995SSascha Wildner.El 2360592e24dSSascha Wildner.Sh DEVICES 2370592e24dSSascha WildnerA number of virtual device drivers exist to supplement the virtual kernel. 2380592e24dSSascha Wildner.Ss Disk device 2390592e24dSSascha WildnerThe 2400592e24dSSascha Wildner.Nm vkd 2410592e24dSSascha Wildnerdriver allows for up to 16 2420592e24dSSascha Wildner.Xr vn 4 2430592e24dSSascha Wildnerbased disk devices. 2440592e24dSSascha WildnerThe root device will be 2450592e24dSSascha Wildner.Li vkd0 2460592e24dSSascha Wildner(see 2470592e24dSSascha Wildner.Sx EXAMPLES 2480592e24dSSascha Wildnerfor further information on how to prepare a root image). 24998b2ba80SSascha Wildner.Ss CD-ROM device 25098b2ba80SSascha WildnerThe 25198b2ba80SSascha Wildner.Nm vcd 25298b2ba80SSascha Wildnerdriver allows for up to 16 virtual CD-ROM devices. 25398b2ba80SSascha WildnerBasically this is a read only 25498b2ba80SSascha Wildner.Nm vkd 25598b2ba80SSascha Wildnerdevice with a block size of 2048. 2560592e24dSSascha Wildner.Ss Network interface 2570592e24dSSascha WildnerThe 2580592e24dSSascha Wildner.Nm vke 2590592e24dSSascha Wildnerdriver supports up to 16 virtual network interfaces which are associated with 2600592e24dSSascha Wildner.Xr tap 4 2610592e24dSSascha Wildnerdevices on the host. 2620592e24dSSascha WildnerFor each 2630592e24dSSascha Wildner.Nm vke 2640592e24dSSascha Wildnerdevice, the per-interface read only 2650592e24dSSascha Wildner.Xr sysctl 3 2660592e24dSSascha Wildnervariable 2670592e24dSSascha Wildner.Va hw.vke Ns Em X Ns Va .tap_unit 2680592e24dSSascha Wildnerholds the unit number of the associated 2690592e24dSSascha Wildner.Xr tap 4 2700592e24dSSascha Wildnerdevice. 2711e4d9fd9SSascha Wildner.Sh SIGNALS 272bb195a01SMatthew DillonThe virtual kernel only enables 273bb195a01SMatthew Dillon.Dv SIGQUIT 274bb195a01SMatthew Dillonand 275bb195a01SMatthew Dillon.Dv SIGTERM 276bb195a01SMatthew Dillonwhile operating in regular console mode. 277bb195a01SMatthew DillonSending 2781e4d9fd9SSascha Wildner.Ql \&^\e 2791e4d9fd9SSascha Wildner.Pq Dv SIGQUIT 280bb195a01SMatthew Dillonto the virtual kernel causes the virtual kernel to enter its internal 2811e4d9fd9SSascha Wildner.Xr ddb 4 282bb195a01SMatthew Dillondebugger and re-enable all other terminal signals. 283bb195a01SMatthew DillonSending 284bb195a01SMatthew Dillon.Dv SIGTERM 285bb195a01SMatthew Dillonto the virtual kernel triggers a clean shutdown by passing a 286bb195a01SMatthew Dillon.Dv SIGUSR2 287bb195a01SMatthew Dillonto the virtual kernel's 288bb195a01SMatthew Dillon.Xr init 8 289bb195a01SMatthew Dillonprocess. 290974b26bfSSascha Wildner.Sh DEBUGGING 291974b26bfSSascha WildnerIt is possible to directly gdb the virtual kernel's process. 292974b26bfSSascha WildnerIt is recommended that you do a 293974b26bfSSascha Wildner.Ql handle SIGSEGV noprint 2944010bf94SNicolas Theryto ignore page faults processed by the virtual kernel itself and 295e7c2f376SNicolas Thery.Ql handle SIGUSR1 noprint 2964010bf94SNicolas Theryto ignore signals used for simulating inter-processor interrupts (SMP build 2974010bf94SNicolas Theryonly). 298a154d422SThomas Nikolajsen.Sh FILES 299a154d422SThomas Nikolajsen.Bl -tag -width ".It Pa /sys/config/VKERNEL" -compact 300a154d422SThomas Nikolajsen.It Pa /sys/config/VKERNEL 301a154d422SThomas Nikolajsendefault 302a154d422SThomas Nikolajsen.Nm 303a154d422SThomas Nikolajsenconfiguration file, for 304a154d422SThomas Nikolajsen.Xr config 8 . 305a154d422SThomas Nikolajsen.El 306a68e0df0SSascha Wildner.Sh CONFIGURATION FILES 307a68e0df0SSascha WildnerYour virtual kernel is a complete 308a68e0df0SSascha Wildner.Dx 309a68e0df0SSascha Wildnersystem, but you might not want to run all the services a normal kernel runs. 310a68e0df0SSascha WildnerHere is what a typical virtual kernel's 311a68e0df0SSascha Wildner.Pa /etc/rc.conf 312a68e0df0SSascha Wildnerfile looks like, with some additional possibilities commented out. 313a68e0df0SSascha Wildner.Bd -literal 314a68e0df0SSascha Wildnerhostname="vkernel" 315a68e0df0SSascha Wildnernetwork_interfaces="lo0 vke0" 316a68e0df0SSascha Wildnerifconfig_vke0="DHCP" 317a68e0df0SSascha Wildnersendmail_enable="NO" 318a68e0df0SSascha Wildner#syslog_enable="NO" 319a68e0df0SSascha Wildnerblanktime="NO" 320a68e0df0SSascha Wildner.Ed 321c8e7d028SSascha Wildner.Sh EXAMPLES 3224af18995SSascha WildnerA couple of steps are necessary in order to prepare the system to build and 3234af18995SSascha Wildnerrun a virtual kernel. 3244af18995SSascha Wildner.Ss Setting up the filesystem 3254af18995SSascha WildnerThe 3264af18995SSascha Wildner.Nm 3274af18995SSascha Wildnerarchitecture needs a number of files which reside in 3284af18995SSascha Wildner.Pa /var/vkernel . 3294af18995SSascha WildnerSince these files tend to get rather big and the 3304af18995SSascha Wildner.Pa /var 3314af18995SSascha Wildnerpartition is usually of limited size, we recommend the directory to be 3324af18995SSascha Wildnercreated in the 3334af18995SSascha Wildner.Pa /home 3344af18995SSascha Wildnerpartition with a link to it in 3354af18995SSascha Wildner.Pa /var : 336c8e7d028SSascha Wildner.Bd -literal 337c009fcfaSThomas Nikolajsenmkdir -p /home/var.vkernel/boot 3384af18995SSascha Wildnerln -s /home/var.vkernel /var/vkernel 3394af18995SSascha Wildner.Ed 3404af18995SSascha Wildner.Pp 3414af18995SSascha WildnerNext, a filesystem image to be used by the virtual kernel has to be 34262aea38eSSascha Wildnercreated and populated (assuming world has been built previously). 34362aea38eSSascha WildnerIf the image is created on a UFS filesystem you might want to pre-zero it. 34449802d4eSMatthew DillonOn a HAMMER filesystem you should just truncate-extend to the image size 34549802d4eSMatthew Dillonas HAMMER does not re-use data blocks already present in the file. 346c8e7d028SSascha Wildner.Bd -literal 347f73862c5SSascha Wildnervnconfig -c -S 2g -T vn0 /var/vkernel/rootimg.01 34858c55700SSascha Wildnerdisklabel -r -w vn0s0 auto 349c009fcfaSThomas Nikolajsendisklabel -e vn0s0 # add `a' partition with fstype `4.2BSD' 35058c55700SSascha Wildnernewfs /dev/vn0s0a 35158c55700SSascha Wildnermount /dev/vn0s0a /mnt 352c8e7d028SSascha Wildnercd /usr/src 353c8e7d028SSascha Wildnermake installworld DESTDIR=/mnt 354c8e7d028SSascha Wildnercd etc 355c8e7d028SSascha Wildnermake distribution DESTDIR=/mnt 3567a3238b8SMatthew Dillonecho '/dev/vkd0s0a / ufs rw 1 1' >/mnt/etc/fstab 3577a3238b8SMatthew Dillonecho 'proc /proc procfs rw 0 0' >>/mnt/etc/fstab 3587834fbccSSascha Wildner.Ed 3597834fbccSSascha Wildner.Pp 3607834fbccSSascha WildnerEdit 3617834fbccSSascha Wildner.Pa /mnt/etc/ttys 3627834fbccSSascha Wildnerand replace the 3637834fbccSSascha Wildner.Li console 3647834fbccSSascha Wildnerentry with the following line and turn off all other gettys. 3657834fbccSSascha Wildner.Bd -literal 3667834fbccSSascha Wildnerconsole "/usr/libexec/getty Pc" cons25 on secure 3677834fbccSSascha Wildner.Ed 3687834fbccSSascha Wildner.Pp 369eed435ddSStathis KamperisReplace 370eed435ddSStathis Kamperis.Li \&Pc 371eed435ddSStathis Kamperiswith 372eed435ddSStathis Kamperis.Li al.Pc 373eed435ddSStathis Kamperisif you would like to automatically log in as root. 374eed435ddSStathis Kamperis.Pp 3757834fbccSSascha WildnerThen, unmount the disk. 3767834fbccSSascha Wildner.Bd -literal 3774af18995SSascha Wildnerumount /mnt 3784af18995SSascha Wildnervnconfig -u vn0 3794af18995SSascha Wildner.Ed 3804af18995SSascha Wildner.Ss Compiling the virtual kernel 3814af18995SSascha WildnerIn order to compile a virtual kernel use the 3824af18995SSascha Wildner.Li VKERNEL 3834af18995SSascha Wildnerkernel configuration file residing in 384a154d422SThomas Nikolajsen.Pa /sys/config 3854af18995SSascha Wildner(or a configuration file derived thereof): 386c8e7d028SSascha Wildner.Bd -literal 3874af18995SSascha Wildnercd /usr/src 38809b03fffSSascha Wildnermake -DNO_MODULES buildkernel KERNCONF=VKERNEL 38979b58aaeSMatthew Dillonmake -DNO_MODULES installkernel KERNCONF=VKERNEL DESTDIR=/var/vkernel 3904af18995SSascha Wildner.Ed 3914af18995SSascha Wildner.Ss Enabling virtual kernel operation 3924af18995SSascha WildnerA special 3934af18995SSascha Wildner.Xr sysctl 8 , 3944af18995SSascha Wildner.Va vm.vkernel_enable , 3954af18995SSascha Wildnermust be set to enable 3964af18995SSascha Wildner.Nm 3974af18995SSascha Wildneroperation: 398c8e7d028SSascha Wildner.Bd -literal 3994af18995SSascha Wildnersysctl vm.vkernel_enable=1 4004af18995SSascha Wildner.Ed 40109b03fffSSascha Wildner.Ss Configuring the network on the host system 40209b03fffSSascha WildnerIn order to access a network interface of the host system from the 40309b03fffSSascha Wildner.Nm , 40409b03fffSSascha Wildneryou must add the interface to a 40509b03fffSSascha Wildner.Xr bridge 4 40609b03fffSSascha Wildnerdevice which will then be passed to the 40709b03fffSSascha Wildner.Fl I 40809b03fffSSascha Wildneroption: 40909b03fffSSascha Wildner.Bd -literal 41009b03fffSSascha Wildnerkldload if_bridge.ko 41109b03fffSSascha Wildnerkldload if_tap.ko 41209b03fffSSascha Wildnerifconfig bridge0 create 41309b03fffSSascha Wildnerifconfig bridge0 addm re0 # assuming re0 is the host's interface 41409b03fffSSascha Wildnerifconfig bridge0 up 41509b03fffSSascha Wildner.Ed 4164af18995SSascha Wildner.Ss Running the kernel 4174af18995SSascha WildnerFinally, the virtual kernel can be run: 418c8e7d028SSascha Wildner.Bd -literal 41979b58aaeSMatthew Dilloncd /var/vkernel 4201a92ebbbSSamuel J. Greear\&./boot/kernel/kernel -m 64m -r rootimg.01 -I auto:bridge0 4214af18995SSascha Wildner.Ed 422c8e7d028SSascha Wildner.Pp 42379b58aaeSMatthew DillonYou can issue the 42479b58aaeSMatthew Dillon.Xr reboot 8 , 42579b58aaeSMatthew Dillon.Xr halt 8 , 42679b58aaeSMatthew Dillonor 42779b58aaeSMatthew Dillon.Xr shutdown 8 42879b58aaeSMatthew Dilloncommands from inside a virtual kernel. 42979b58aaeSMatthew DillonAfter doing a clean shutdown the 430c8e7d028SSascha Wildner.Xr reboot 8 43179b58aaeSMatthew Dilloncommand will re-exec the virtual kernel binary while the other two will 43279b58aaeSMatthew Dilloncause the virtual kernel to exit. 43334caba04SMatthew Dillon.Sh BUILDING THE WORLD UNDER A VKERNEL 43434caba04SMatthew DillonThe virtual kernel platform does not have all the header files expected 43534caba04SMatthew Dillonby a world build, so the easiest thing to do right now is to specify a 436b6a66df5SSascha Wildnerpc32 (in a 32 bit vkernel) or pc64 (in a 64 bit vkernel) target when 437b6a66df5SSascha Wildnerbuilding the world under a virtual kernel, like this: 43834caba04SMatthew Dillon.Bd -literal 43934caba04SMatthew Dillonvkernel# make MACHINE_PLATFORM=pc32 buildworld 44034caba04SMatthew Dillonvkernel# make MACHINE_PLATFORM=pc32 installworld 44134caba04SMatthew Dillon.Ed 4424af18995SSascha Wildner.Sh SEE ALSO 443666855caSSascha Wildner.Xr vknet 1 , 44409b03fffSSascha Wildner.Xr bridge 4 , 44509b03fffSSascha Wildner.Xr tap 4 , 446c8e7d028SSascha Wildner.Xr vn 4 , 447a154d422SThomas Nikolajsen.Xr sysctl.conf 5 , 448c8e7d028SSascha Wildner.Xr build 7 , 449c8e7d028SSascha Wildner.Xr disklabel 8 , 45009b03fffSSascha Wildner.Xr ifconfig 8 , 451dbfd168bSMatthew Dillon.Xr vknetd 8 , 452c8e7d028SSascha Wildner.Xr vnconfig 8 453c203b6f9SSascha Wildner.Rs 454c203b6f9SSascha Wildner.%A Aggelos Economopoulos 455c203b6f9SSascha Wildner.%D March 2007 456c203b6f9SSascha Wildner.%T "A Peek at the DragonFly Virtual Kernel" 457c203b6f9SSascha Wildner.Re 4584af18995SSascha Wildner.Sh HISTORY 4594af18995SSascha WildnerVirtual kernels were introduced in 4604af18995SSascha Wildner.Dx 1.7 . 4614af18995SSascha Wildner.Sh AUTHORS 4624af18995SSascha Wildner.An -nosplit 4634af18995SSascha Wildner.An Matt Dillon 4644af18995SSascha Wildnerthought up and implemented the 4654af18995SSascha Wildner.Nm 4660592e24dSSascha Wildnerarchitecture and wrote the 4670592e24dSSascha Wildner.Nm vkd 4680592e24dSSascha Wildnerdevice driver. 4690592e24dSSascha Wildner.An Sepherosa Ziehau 4700592e24dSSascha Wildnerwrote the 4710592e24dSSascha Wildner.Nm vke 4720592e24dSSascha Wildnerdevice driver. 4734af18995SSascha WildnerThis manual page was written by 4744af18995SSascha Wildner.An Sascha Wildner . 475