/[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.23 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.23 2005/10/03 22:53:50 rane 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>
26 26
27<!-- The content of this document is licensed under the CC-BY-SA license --> 27<!-- The content of this document is licensed under the CC-BY-SA license -->
28<!-- See http://creativecommons.org/licenses/by-sa/2.5 --> 28<!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
29<license/> 29<license/>
30 30
31<version>0.11</version> 31<version>0.12</version>
32<date>2005-02-05</date> 32<date>2005-11-17</date>
33 33
34<chapter> 34<chapter>
35<title>Obtaining User-Mode Linux</title> 35<title>Obtaining User-Mode Linux</title>
36<section> 36<section>
37<body> 37<body>
48unbootable; 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
49worry about breaking the live system. 49worry about breaking the live system.
50</p> 50</p>
51 51
52<p> 52<p>
53Installing user-mode linux is essentially identical to a normal kernel 53Most 2.6 kernels have UML support. Although you can use your current kernel
54install. First install the kernel sources (appropriately patched for 54sources, it might be wiser to keep the UML kernel tree(s) separate. After all,
55user-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
56usual 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
57kernel. 57UML kernels).
58</p>
59
58</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>
59 65
60<pre caption="Installing UML kernel sources"> 66<p>
61<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
62# <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">
63# <i>cd /usr/src/linux</i> 73# <i>cd /srv/aegis/src/uml-linux</i>
64# <i>make menuconfig <comment>ARCH=um</comment></i> 74# <i>make menuconfig <comment>ARCH=um</comment></i>
65# <i>make linux <comment>ARCH=um</comment></i> 75# <i>make linux <comment>ARCH=um</comment></i>
66# <i>cp linux /usr/local/bin/linux</i> 76# <i>cp linux /usr/local/bin/linux</i>
67</pre> 77</pre>
68 78
166</p> 176</p>
167 177
168<p> 178<p>
169Add any additional packages you desire. Feel free to give your virtual 179Add any additional packages you desire. Feel free to give your virtual
170Gentoo 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>
171you 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
172a 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>
173to 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>.
174</p> 184</p>
175 185
176<p> 186<p>
177At this point, remember to set your root password. 187At this point, remember to set your root password.
178</p> 188</p>
259</chapter> 269</chapter>
260 270
261<chapter> 271<chapter>
262<title>Networking</title> 272<title>Networking</title>
263<section> 273<section>
274<title>Using an Existing Network</title>
264<body> 275<body>
265 276
266<p> 277<p>
267Make 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:
268</p> 279</p>
340gateway, namely our host, we use scp to retrieve a working 351gateway, namely our host, we use scp to retrieve a working
341<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
342to make sure that name resolution (and general access to the internet) 353to make sure that name resolution (and general access to the internet)
343is 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
344<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.
345</p> 401</p>
346 402
347</body> 403</body>
348</section> 404</section>
349</chapter> 405</chapter>

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

  ViewVC Help
Powered by ViewVC 1.1.20