/[gentoo]/xml/htdocs/doc/en/uml.xml
Gentoo

Diff of /xml/htdocs/doc/en/uml.xml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.22 Revision 1.24
1<?xml version='1.0' encoding="UTF-8"?> 1<?xml version='1.0' encoding="UTF-8"?>
2<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/uml.xml,v 1.22 2005/02/05 16:52:57 swift Exp $ --> 2<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/uml.xml,v 1.24 2005/11/17 17:19:55 swift Exp $ -->
3 3
4<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> 4<!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
5 5
6<guide link="/doc/en/uml.xml"> 6<guide link="/doc/en/uml.xml">
7<title>Gentoo Linux Developer's guide to system testing with User-Mode Linux</title> 7<title>Gentoo Linux Developer's guide to system testing with User-Mode Linux</title>
8
8<author title="Editor"> 9<author title="Editor">
9 <mail link="g2boojum@gentoo.org">Grant Goodyear</mail> 10 <mail link="g2boojum@gentoo.org">Grant Goodyear</mail>
10</author> 11</author>
11<author title="Editor"><!-- zhen@gentoo.org --> 12<author title="Editor"><!-- zhen@gentoo.org -->
12 John Davis 13 John Davis
21<abstract> 22<abstract>
22This guide shows Gentoo Linux developers how to set up and use 23This guide shows Gentoo Linux developers how to set up and use
23user-mode linux for testing potentially system-breaking changes. 24user-mode linux for testing potentially system-breaking changes.
24</abstract> 25</abstract>
25 26
27<!-- The content of this document is licensed under the CC-BY-SA license -->
28<!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
26<license/> 29<license/>
27 30
28<version>0.10</version> 31<version>0.12</version>
29<date>2005-02-05</date> 32<date>2005-11-17</date>
30 33
31<chapter> 34<chapter>
32<title>Obtaining User-Mode Linux</title> 35<title>Obtaining User-Mode Linux</title>
33<section> 36<section>
34<body> 37<body>
45unbootable; with user-mode linux we can test these changes without having to 48unbootable; with user-mode linux we can test these changes without having to
46worry about breaking the live system. 49worry about breaking the live system.
47</p> 50</p>
48 51
49<p> 52<p>
50Installing user-mode linux is essentially identical to a normal kernel 53Most 2.6 kernels have UML support. Although you can use your current kernel
51install. First install the kernel sources (appropriately patched for 54sources, it might be wiser to keep the UML kernel tree(s) separate. After all,
52user-mode linux), and then configure the user-mode linux kernel in the 55you'll be building a new kernel with a different configuration and you might
53usual fashion. Since kernel 2.6.9, UML has been integrated in the vanilla 56want to have heterogenous systems on your main Linux system (several different
54kernel. 57UML kernels).
58</p>
59
55</p> 60<p>
61So download a nice kernel tree (like the vanilla one from <uri
62link="http://www.kernel.org">kernel.org</uri>) and extract it to some local
63development location.
64</p>
56 65
57<pre caption="Installing UML kernel sources"> 66<p>
58<comment>(We'll install the vanilla 2.6 kernel, you can also use the usermode-sources)</comment> 67Next, configure this UML kernel as you would do for any other system, but append
59# <i>emerge sys-kernel/development-sources</i> 68<e>ARCH=um</e> so that the kernel build software knows that the kernel
69is meant to run as a guest process on the main system.
70</p>
71
72<pre caption="Building the UML kernel">
60# <i>cd /usr/src/linux</i> 73# <i>cd /srv/aegis/src/uml-linux</i>
61# <i>make menuconfig <comment>ARCH=um</comment></i> 74# <i>make menuconfig <comment>ARCH=um</comment></i>
62# <i>make linux <comment>ARCH=um</comment></i> 75# <i>make linux <comment>ARCH=um</comment></i>
63# <i>cp linux /usr/local/bin/linux</i> 76# <i>cp linux /usr/local/bin/linux</i>
64</pre> 77</pre>
65 78
131 144
132<p> 145<p>
133Generating the <path>root_fs</path> file itself will be 146Generating the <path>root_fs</path> file itself will be
134our last step. First we will generate a Gentoo filesystem in 147our last step. First we will generate a Gentoo filesystem in
135an ordinary chroot. We need the stage tarball available, which 148an ordinary chroot. We need the stage tarball available, which
136could be downloaded separately, extracted from a liveCD, or 149could be downloaded separately, extracted from an Installation CD, or
137extracted from a liveCD .iso. 150extracted from an Installation CD .iso.
138</p> 151</p>
139 152
140<pre caption="Mounting a liveCD .iso"> 153<pre caption="Mounting an Installation CD .iso">
141# <i>mkdir /mnt/loop</i> 154# <i>mkdir /mnt/loop</i>
142# <i>mount -o loop /path/to/install-&lt;TAB&gt;.iso /mnt/loop</i> 155# <i>mount -o loop /path/to/install-&lt;TAB&gt;.iso /mnt/loop</i>
143</pre> 156</pre>
144 157
145<p> 158<p>
163</p> 176</p>
164 177
165<p> 178<p>
166Add any additional packages you desire. Feel free to give your virtual 179Add any additional packages you desire. Feel free to give your virtual
167Gentoo system a hostname, if you so desire. In <path>/etc/fstab</path> 180Gentoo system a hostname, if you so desire. In <path>/etc/fstab</path>
168you will want <path>/dev/ROOT</path> to be <path>/dev/ubd/0</path>, with 181you will want <path>/dev/ROOT</path> to be <path>/dev/ubda</path>, with
169a fs type of either ext2, ext3, or reiserfs. Set <path>/dev/SWAP</path> 182a fs type of either ext2, ext3, or reiserfs. Set <path>/dev/SWAP</path>
170to be <path>/dev/ubd/1</path>, and comment out <path>/dev/BOOT</path>. 183to be <path>/dev/ubdb</path>, and comment out <path>/dev/BOOT</path>.
171</p> 184</p>
172 185
173<p> 186<p>
174At this point, remember to set your root password. 187At this point, remember to set your root password.
175</p> 188</p>
256</chapter> 269</chapter>
257 270
258<chapter> 271<chapter>
259<title>Networking</title> 272<title>Networking</title>
260<section> 273<section>
274<title>Using an Existing Network</title>
261<body> 275<body>
262 276
263<p> 277<p>
264Make sure that the host kernel has the following settings compiled as modules: 278Make sure that the host kernel has the following settings compiled as modules:
265</p> 279</p>
337gateway, namely our host, we use scp to retrieve a working 351gateway, namely our host, we use scp to retrieve a working
338<path>/etc/resolv.conf</path> (if necessary), and we ping www.gentoo.org 352<path>/etc/resolv.conf</path> (if necessary), and we ping www.gentoo.org
339to make sure that name resolution (and general access to the internet) 353to make sure that name resolution (and general access to the internet)
340is working from our user-mode system. Now the user-mode system can 354is working from our user-mode system. Now the user-mode system can
341<c>emerge</c> at will! 355<c>emerge</c> at will!
356</p>
357
358</body>
359</section>
360<section>
361<title>Using a Virtual Network</title>
362<body>
363
364<p>
365Before you get all too excited, this is not a virtual private network. It is a
366network that is only accessible by the UML instances. The
367<c>usermode-utilities</c> package provides a tool called <c>uml_switch</c> which
368defines the end points of the switch.
369</p>
370
371<pre caption="Activating end points of a UML switch">
372<comment>(If the switch information should stay in the foreground:)</comment>
373$ <i>uml_switch -unix ~/tmp/switch.sock</i>
374
375<comment>(If it should be backgrounded:)</comment>
376$ <i>uml_switch -unix ~/tmp/switch.sock &amp;&gt; ~/tmp/switch.log &amp;</i>
377</pre>
378
379<p>
380To start the UML instances on the switch, run the next command. Your
381(virtual) network interface will be connected to the <c>uml_switch</c> process
382and will be using the given MAC address.
383</p>
384
385<pre caption="Running first UML instance">
386$ <i>linux ubd0=first_rootfs ubd1=first_swapfs eth0=daemon,10:00:01:02:00:00,,~/tmp/switch.sock</i>
387</pre>
388
389<p>
390You can still connect the system to the existing network, or have a second
391process attached to both the virtual one and the existing one:
392</p>
393
394<pre caption="Running second UML instance">
395$ <i>linux ubd0=second_rootfs ubd1=second_swapfs eth0=daemon,10:00:01:02:00:01,,~/tmp/switch.sock \
396 eth1=tuntap,,,192.168.1.43</i>
397</pre>
398
399<p>
400More information about the tuntap setting can be found in the previous section.
342</p> 401</p>
343 402
344</body> 403</body>
345</section> 404</section>
346</chapter> 405</chapter>

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.24

  ViewVC Help
Powered by ViewVC 1.1.20