/[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.11 Revision 1.26
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.11 2003/11/15 00:35:19 neysx Exp $ --> 2<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/uml.xml,v 1.26 2006/06/26 16:16:58 nightmorph 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
9<author title="Editor">
8<author title="Editor"><mail link="g2boojum@gentoo.org">Grant Goodyear</mail></author> 10 <mail link="g2boojum@gentoo.org">Grant Goodyear</mail>
11</author>
9<author title="Editor"><!-- zhen@gentoo.org --> 12<author title="Editor"><!-- zhen@gentoo.org -->
10 John Davis 13 John Davis
11</author> 14</author>
12
13<author title="Editor"> 15<author title="Editor">
14 <mail link="swift@gentoo.org">Sven Vermeulen</mail> 16 <mail link="swift@gentoo.org">Sven Vermeulen</mail>
15</author> 17</author>
16<author title="Editor"> 18<author title="Editor">
17 <mail link="bennyc@gentoo.org">Benny Chuang</mail> 19 <mail link="bennyc@gentoo.org">Benny Chuang</mail>
18</author> 20</author>
19 21
20<abstract> 22<abstract>
21 This guide shows Gentoo Linux developers how to set up and use 23This guide shows Gentoo Linux developers how to set up and use
22 user-mode linux for testing potentially system-breaking changes. 24user-mode linux for testing potentially system-breaking changes.
23</abstract> 25</abstract>
24 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 -->
25<license/> 29<license/>
26 30
27<version>0.2</version> 31<version>0.14</version>
28<date>October 24, 2003</date> 32<date>2006-06-26</date>
29 33
30<chapter> 34<chapter>
31<title>Obtaining User-Mode Linux</title> 35<title>Obtaining User-Mode Linux</title>
32<section> 36<section>
33<body> 37<body>
38
39<impo>
40Before you can use user-mode Linux, you <e>must</e> be using a non-NPTL
41profile, and you must be using &lt;<c>glibc</c>-2.4. Follow the instructions
42for <uri link="/doc/en/gentoo-upgrading.xml#instructions">changing
43profiles</uri>. You will need to run <c>emerge -e world</c> after switching to
44a non-NPTL profile.
45</impo>
46
47<p>
34<p>As the user-mode linux website 48As the user-mode Linux website
35(<uri>http://user-mode-linux.sourceforge.net</uri>) 49(<uri>http://user-mode-linux.sourceforge.net</uri>) states, user-modeL linux
36states, user-mode linux
37allows a user to "run Linux inside itself". Specifically, 50allows a user to "run Linux inside itself". Specifically,
38user-mode linux provides a virtual machine on which a user can "[r]un buggy 51user-mode linux provides a virtual machine on which a user can "[r]un buggy
39software, experiment with new Linux kernels or distributions, and poke around 52software, experiment with new Linux kernels or distributions, and poke around
40in the internals of Linux, all without risking your main Linux setup." Changes 53in the internals of Linux, all without risking your main Linux setup."
41to Gentoo core packages such as <e>sys-apps/baselayout</e> or <e>sys-libs/glibc</e> 54Experimental changes to Gentoo core packages such as <e>sys-apps/baselayout</e>
42have the potential to break the system and render it unbootable; with user-mode 55or <e>sys-libs/glibc</e> have the potential to break the system and render it
43linux we can test these changes without having to worry about breaking the live 56unbootable; with user-mode Linux we can test these changes without having to
44system. 57worry about breaking the live system.
45</p>
46<p> 58</p>
47Installing user-mode linux is essentially identical to a normal kernel 59
48install. First install the kernel sources (appropriately patched for
49user-mode linux), and then configure the user-mode linux kernel in the
50usual fashion:
51</p> 60<p>
61Most 2.6 kernels have UML support. Although you can use your current kernel
62sources, it might be wiser to keep the UML kernel tree(s) separate. After all,
63you'll be building a new kernel with a different configuration and you might
64want to have heterogenous systems on your main Linux system (several different
65UML kernels).
66</p>
67
52<pre> 68<p>
53# <i>emerge sys-kernel/usermode-sources</i> 69So download a nice kernel tree (like the vanilla one from <uri
70link="http://www.kernel.org">kernel.org</uri>) and extract it to some local
71development location.
72</p>
73
74<p>
75Next, configure this UML kernel as you would do for any other system, but append
76<e>ARCH=um</e> so that the kernel build software knows that the kernel
77is meant to run as a guest process on the main system.
78</p>
79
80<pre caption="Building the UML kernel">
54# <i>cd /usr/src/uml/linux</i> 81# <i>cd /srv/aegis/src/uml-linux</i>
55# <i>make menuconfig <comment>ARCH=um</comment></i> 82# <i>make menuconfig <comment>ARCH=um</comment></i>
56# <i>make linux <comment>ARCH=um</comment></i> 83# <i>make linux <comment>ARCH=um</comment></i>
57# <i>cp linux /usr/local/bin/linux</i> 84# <i>cp linux /usr/local/bin/linux</i>
58</pre> 85</pre>
86
87<warn>
59<warn>The <e>ARCH=um</e> fragment is <e>extremely</e> important!</warn> 88The <e>ARCH=um</e> fragment is <e>extremely</e> important!
60<impo> 89</warn>
90
91<p>
92Make sure that <path>/usr/local/bin</path> is in your path. Edit
93<path>/etc/env.d/00basic</path> to that the PATH variable contains
94<path>/usr/local/bin</path> and rerun <c>env-update</c>:
95</p>
96
97<pre caption="Editing 00basic">
98# <i>nano -w /etc/env.d/00basic</i>
99# <i>env-update</i>
100# <i>source /etc/profile</i>
101</pre>
102
103<p>
61For the user-mode linux kernel to properly boot a Gentoo system the 104For the user-mode Linux kernel to properly boot a Gentoo system the
62kernel needs to be configured to <e>not</e> automatically mount 105kernel needs to be configured to <e>not</e> automatically mount
63<path>/dev</path> (devfs) by default. 106<path>/dev</path> (devfs) by default. Also, you will almost certainly
64Also, you will almost certainly
65want to make sure that you have <e>tmpfs</e> (the "Virtual Memory 107want to make sure that you have <e>tmpfs</e> (the "Virtual Memory
66Filesystem") compiled in, since by default the Gentoo linux bootscripts 108Filesystem") compiled in, since by default the Gentoo Linux bootscripts
67store their information in a small tmpfs partition. 109store their information in a small tmpfs partition.
68(The binary kernels available 110(The binary kernels available from the user-mode website do automatically
69from the user-mode website do automatically mount <path>/dev</path>, 111mount <path>/dev</path>, and they don't have tmpfs compiled in; don't bother
70and they don't have tmpfs compiled in; don't bother with them.) 112with them).
71</impo> 113</p>
114
115<p>
72<p>I highly recommend reading the user-mode linux documentation, but the 116I highly recommend reading the user-mode linux documentation, but the
73basic idea is that running the <path>/usr/local/bin/linux</path> program 117basic idea is that running the <path>/usr/local/bin/linux</path> program
74boots the user-mode kernel and tries to bring up the system stored in 118boots the user-mode kernel and tries to bring up the system stored in
75the file <path>root_fs</path> that should be located in the current working 119the file <path>root_fs</path> that should be located in the current working
76directory.</p> 120directory.
121</p>
122
123<p>
77<p>It won't hurt to also install the user-mode linux tools.</p> 124It won't hurt to also install the user-mode Linux tools.
78<pre> 125</p>
126
127<pre caption="Installing UML tools">
79# <i>emerge sys-apps/usermode-utilities</i> 128# <i>emerge sys-apps/usermode-utilities</i>
80</pre> 129</pre>
130
131<p>
81<p>These tools facilitate networking (among other things) 132These tools facilitate networking (among other things) between the user-mode
82between the user-mode linux virtual system 133Linux virtual system and the host Linux system.
83and the host Linux system.</p> 134</p>
135
84</body> 136</body>
85</section> 137</section>
86</chapter> 138</chapter>
87 139
88<chapter> 140<chapter>
89<title>Creating <path>root_fs</path></title> 141<title>Creating root_fs</title>
90
91<section> 142<section>
92<title>Making the Gentoo chroot</title> 143<title>Making the Gentoo chroot</title>
93<body> 144<body>
145
94<p> 146<p>
95The <path>root_fs</path> file needed for user-mode linux is 147The <path>root_fs</path> file needed for user-mode linux is
96a single file that contains an entire Gentoo Linux filesystem. 148a single file that contains an entire Gentoo Linux filesystem.
97To generate this file you will need to have Loopback device 149To generate this file you will need to have Loopback device
98support enabled in the host (non-user-mode) kernel. 150support enabled in the host (non-user-mode) kernel.
99</p> 151</p>
152
153<p>
100<p>Generating the <path>root_fs</path> file itself will be 154Generating the <path>root_fs</path> file itself will be
101our last step. First we will generate a Gentoo filesystem in 155our last step. First we will generate a Gentoo filesystem in
102an ordinary chroot. We need the stage tarball available, which 156an ordinary chroot. We need the stage tarball available, which
103could be downloaded separately, extracted from a liveCD, or 157could be downloaded separately, extracted from an Installation CD, or
104extracted from a liveCD .iso. 158extracted from an Installation CD .iso.
105</p> 159</p>
160
106<pre caption="Mounting a liveCD .iso"> 161<pre caption="Mounting an Installation CD .iso">
107# <i>mkdir /mnt/loop</i> 162# <i>mkdir /mnt/loop</i>
108# <i>mount -o loop /path/to/build-&lt;TAB&gt;.iso /mnt/loop</i> 163# <i>mount -o loop /path/to/install-&lt;TAB&gt;.iso /mnt/loop</i>
109</pre> 164</pre>
165
110<p> 166<p>
111Setting up the chroot is essentially identical to an ordinary Gentoo 167Setting up the chroot is essentially identical to an ordinary Gentoo
112Linux build. 168Linux build.
113</p> 169</p>
114<pre> 170
171<pre caption="Creating the Gentoo chroot mount">
115# <i>mkdir /mnt/gentoo</i> 172# <i>mkdir /mnt/gentoo</i>
116# <i>cd /mnt/gentoo</i> 173# <i>cd /mnt/gentoo</i>
117# <i>tar xvjpf /path/to/build-&lt;TAB&gt;.tar.bz2</i> 174# <i>tar xvjpf /path/to/stage&lt;TAB&gt;.tar.bz2</i>
118</pre> 175</pre>
176
119<p> 177<p>
120Go ahead and unmount the .iso. You don't need it anymore. 178Go ahead and unmount the .iso. You don't need it anymore.
121</p> 179</p>
122<pre> 180
123# <i>cp /etc/resolv.conf /mnt/gentoo/etc/</i>
124# <i>mount -o bind /proc /mnt/gentoo/proc</i>
125# <i>mkdir -p /mnt/gentoo/usr/portage/distfiles</i>
126# <i>mkdir -p /mnt/gentoo/usr/portage/packages</i>
127# <i>mount -o bind /usr/portage/distfiles /mnt/gentoo/usr/portage/distfiles</i>
128# <i>mount -o bind /usr/portage/packages /mnt/gentoo/usr/portage/packages</i>
129# <i>chroot /mnt/gentoo /bin/bash</i>
130<!--per bug 16134, added emerge sync to supress warning, etc-->
131# <i>emerge sync</i>
132# <i>env-update</i>
133# <i>source /etc/profile</i>
134</pre>
135<p>
136By bind-mounting <path>/usr/portage/distfiles</path> and
137<path>/usr/portage/packages</path> we avoid having to download
138or build packages that are already present on the Gentoo host.
139</p> 181<p>
182Build the system in the usual fashion: chroot into <path>/mnt/gentoo</path> and
183follow the Gentoo installation instructions.
140<p> 184</p>
141Bootstrap and build the system in the usual fashion: 185
142</p>
143<pre>
144<!--removed the emerge sync below because it is done above-->
145# <i>cd /usr/portage</i>
146# <i>nano -w /etc/make.conf</i>
147# <i>nano -w /etc/make.profile/packages</i>
148# <i>nano -w /usr/portage/profiles/package.mask</i>
149# <i>scripts/bootstrap.sh &amp;&amp; emerge --usepkg system</i>
150</pre>
151<warn>
152<!--Changed grub to virtual/bootloader-->
153The <path>/etc/make.profile/packages</path> file needs to be
154edited to remove the virtual/bootloader ebuild from the default system (just remove the "*"
155from the beginning of the "*virtual/bootloader" line). The virtual/bootloader ebuild
156tries to mount the /boot partition, which will fail in our chroot.
157</warn>
158<note>
159Make sure you examine <path>/etc/make.profile/packages</path>
160and <path>/usr/portage/profiles/package.mask</path> to be sure that
161any to-be-tested packages that you want to install aren't masked out.
162As currently written, <path>scripts/bootstrap.sh</path> will compile
163the bootstrap packages from source. To use already-existing packages,
164add <c>alias emerge="emerge --usepkg"</c> somewhere near the top of
165the bootstrap script.
166</note>
167<p> 186<p>
168Add any additional packages you desire. Feel free to give your virtual 187Add any additional packages you desire. Feel free to give your virtual
169Gentoo system a hostname, if you so desire. In <path>/etc/fstab</path> 188Gentoo system a hostname, if you so desire. In <path>/etc/fstab</path>
170you will want <path>/dev/ROOT</path> to be <path>/dev/ubd/0</path>, with 189you will want <path>/dev/ROOT</path> to be <path>/dev/ubda</path>, with
171a fs type of either ext2, ext3, or reiserfs. Set <path>/dev/SWAP</path> 190a fs type of either ext2, ext3, or reiserfs. Set <path>/dev/SWAP</path>
172to be <path>/dev/ubd/1</path>, and comment out <path>/dev/BOOT</path>. 191to be <path>/dev/ubdb</path>, and comment out <path>/dev/BOOT</path>.
192</p>
193
173</p> 194<p>
174
175<p> At this point, remember to set your root password. </p> 195At this point, remember to set your root password.
196</p>
176 197
177<pre caption="Setting root password"> 198<pre caption="Setting root password">
178# <i>passwd</i> 199# <i>passwd</i>
179</pre> 200</pre>
180 201
181<p> 202<p>
203Now we need to make some changes to the boot scripts. Remove consolefont and
204keymaps from the boot runlevel:
205</p>
206
207<pre caption="Removing unneeded initscripts">
208# <i>rc-update del consolefont boot</i>
209# <i>rc-update del keymaps boot</i>
210</pre>
211
212<p>
182Exit the chroot, unmount all of the bind mounts, 213Exit the chroot, unmount all of the bind mounts,
183tar up the new Gentoo distro, and clean up: 214tar up the new Gentoo distro, and clean up.
184</p> 215</p>
185<pre> 216
186# <i>exit</i> 217<pre caption="Finalising the installation">
187# <i>umount /mnt/gentoo/usr/portage/distfiles</i>
188# <i>umount /mnt/gentoo/usr/portage/packages</i>
189# <i>umount /mnt/gentoo/proc</i>
190# <i>du -ks /mnt/gentoo</i>
191<!-- wtf is this? 261744 /mnt/gentoo-->
192<!-- added dir change to be more explicit-->
193# <i>cd /mnt/gentoo</i> 218# <i>cd /mnt/gentoo</i>
194# <i>tar cvjpf ~/gentoo.tbz2 *</i> 219# <i>tar cvjpf ~/gentoo.tbz2 *</i>
195# <i>cd</i> 220# <i>cd</i>
196# <i>rm -rf /mnt/gentoo</i> 221# <i>rm -rf /mnt/gentoo</i>
197</pre> 222</pre>
198 223
199<p>You might also want to consider reviewing the final steps of the
200<uri link="http://www.gentoo.org/doc/en/gentoo-x86-install.xml">Gentoo Linux x86 Installation Guide</uri>. </p>
201</body> 224</body>
202</section>
203
204<section> 225</section>
226<section>
205<title>Making <path>root_fs</path></title> 227<title>Making root_fs</title>
206<body> 228<body>
229
207<p> 230<p>
208Our Gentoo chroot is nearly 300 MB in size, so 231Our Gentoo chroot is nearly 300 MB in size, so
209<path>root_fs</path> needs to be at least that size. 232<path>root_fs</path> needs to be at least that size.
210We'll choose 0.5 GB as a reasonable size. 233We'll choose 0.5 GB as a reasonable size.
211</p> 234</p>
212<pre> 235
236<pre caption="Creating UML files">
213# <i>dd if=/dev/zero of=root_fs seek=500 count=1 bs=1M</i> 237# <i>dd if=/dev/zero of=root_fs seek=500 count=1 bs=1M</i>
214# <i>mke2fs -F root_fs</i> 238# <i>mke2fs -F root_fs</i>
215# <i>mount -o loop root_fs /mnt/loop</i> 239# <i>mount -o loop root_fs /mnt/loop</i>
216# <i>tar xvjpf gentoo.tbz2 -C /mnt/loop</i> 240# <i>tar xvjpf gentoo.tbz2 -C /mnt/loop</i>
217# <i>umount /mnt/loop</i> 241# <i>umount /mnt/loop</i>
218</pre> 242</pre>
243
219<p> 244<p>
220It would also be nice to have a 0.5 GB swap partition. 245It would also be nice to have a 0.5 GB swap partition.
221</p> 246</p>
222<pre> 247
248<pre caption="Create swap partition">
223# <i>dd if=/dev/zero of=swap_fs seek=500 count=1 bs=1M</i> 249# <i>dd if=/dev/zero of=swap_fs seek=500 count=1 bs=1M</i>
224# <i>mkswap -f swap_fs</i> 250# <i>mkswap -f swap_fs</i>
225</pre> 251</pre>
252
226<p> 253<p>
227Now see if it works! 254Now see if it works!
228</p> 255</p>
229<pre> 256
257<pre caption="Start UML kernel thread">
230# <i>linux ubd0=root_fs ubd1=swap_fs</i> 258# <i>linux ubd0=root_fs ubd1=swap_fs</i>
231</pre> 259</pre>
232<note> 260
261<p>
233User-mode linux uses xterms for the virtual consoles that 262User-mode Linux uses xterms for the virtual consoles that
234are run at boot time, so you need to make sure that the 263are run at boot time, so you need to make sure that the
235terminal from which you run user-mode linux has $DISPLAY 264terminal from which you run user-mode Linux has $DISPLAY
236properly set (along with proper xhost/xauth permissions). 265properly set (along with proper xhost/xauth permissions).
237</note>
238<p> 266</p>
267
268<p>
239With any luck you should be able to log into your user-mode linux 269With any luck you should be able to log into your user-mode Linux
240Gentoo system. The only thing keeping this user-mode linux version 270Gentoo system. The only thing keeping this user-mode Linux version
241of Gentoo from being fully functional is networking from the virtual 271of Gentoo from being fully functional is networking from the virtual
242machine to the host. 272machine to the host.
243</p> 273</p>
274
244</body> 275</body>
245</section> 276</section>
246</chapter> 277</chapter>
247 278
248<chapter> 279<chapter>
249<title>Networking</title> 280<title>Networking</title>
250
251<section> 281<section>
282<title>Using an Existing Network</title>
252<body> 283<body>
253<p> 284
254Thanks to Martin Schlemmer (Azarah), I now know how
255to get networking to function from within a user-mode
256system. The idea is that we set up a private network
257consisting of the user-mode system and the host system,
258and then the user-mode system routes all of its packets
259to the host, which then forwards packets to the net.
260Make sure that the host kernel has
261Networking --> IP: Netfilter Configuration --> IP tables support
262--> Full NAT --> MASQUERADE target support and
263Network Device Support --> Ethertap network tap
264compiled as modules; then do the following on the
265<e>host</e> machine:
266</p> 285<p>
286Make sure that the host kernel has the following settings compiled as modules:
287</p>
288
289<pre caption="Host kernel configuration">
290Networking --&gt;
291 IP: Netfilter Configuration --&gt;
292 IP tables support --&gt;
293 Full NAT --&gt;
294 &lt;M&gt; MASQUERADE target support
295
296 Network Device Support --&gt;
297 &lt;M&gt; TUN/TAP Support
267<pre> 298</pre>
299
300<p>
301Run the following commands on the <e>host</e> machine:
302</p>
303
304<pre caption="Setup networking">
268# <i>modprobe ethertap</i> 305# <i>modprobe tun</i>
306<comment>(If you receive a FATAL error here, try deleting /dev/net/tun and retry)</comment>
269# <i>modprobe iptable_nat</i> 307# <i>modprobe iptable_nat</i>
270# <i>iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE</i> 308# <i>iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE</i>
271# <i>echo 1 > /proc/sys/net/ipv4/ip_forward</i> 309# <i>echo 1 &gt; /proc/sys/net/ipv4/ip_forward</i>
272</pre> 310</pre>
311
273<p> 312<p>
274The iptables line sets up IP Masquerading between the private 313The iptables line sets up IP Masquerading between the private
275network that our user-mode system will be on and the internet 314network that our user-mode system will be on and the internet
276(reachable via <c>eth0</c> in our case). The echo line then 315(reachable via <c>eth0</c> in our case). The echo line then
277turns on packet forwarding between the private network and the 316turns on packet forwarding between the private network and the
278interface that the default gateway is on (eth0 for us). 317interface that the default gateway is on (eth0 for us).
279</p> 318</p>
319
280<p> 320<p>
281Now we bring up the user-mode system and see if networking 321Now we bring up the user-mode system and see if networking
282is functional. 322is functional.
283</p> 323</p>
284<pre> 324
325<pre caption="Get UML up and running">
285# <i>linux ubd0=root_fs ubd1=swap_fs eth0=ethertap,tap0,,192.168.0.254</i> 326# <i>linux ubd0=root_fs ubd1=swap_fs eth0=tuntap,,,192.168.0.254</i>
286<comment>(login to user-mode system)</comment> 327<comment>(login to user-mode system)</comment>
287# <i>ifconfig eth0 192.168.0.1 up</i> 328# <i>ifconfig eth0 192.168.0.1 up</i>
288# <i>ping -c 2 192.168.0.254</i> 329# <i>ping -c 2 192.168.0.254</i>
289PING 192.168.0.254 (192.168.0.254): 56 octets data 330PING 192.168.0.254 (192.168.0.254): 56 octets data
29064 octets from 192.168.0.254: icmp_seq=0 ttl=255 time=0.8 ms 33164 octets from 192.168.0.254: icmp_seq=0 ttl=255 time=0.8 ms
307 348
308--- www.gentoo.org ping statistics --- 349--- www.gentoo.org ping statistics ---
3092 packets transmitted, 2 packets received, 0% packet loss 3502 packets transmitted, 2 packets received, 0% packet loss
310round-trip min/avg/max = 92.0/105.8/119.6 ms 351round-trip min/avg/max = 92.0/105.8/119.6 ms
311</pre> 352</pre>
353
312<p> 354<p>
313On the user-mode system we assign the user-mode eth0 interface 355On the user-mode system we assign the user-mode eth0 interface
314the private IP address 192.168.0.1 and bring up the interface. The 356the private IP address 192.168.0.1 and bring up the interface. The
315host has private IP address 192.168.0.254, and we ping it to make sure 357host has private IP address 192.168.0.254, and we ping it to make sure
316that our networking is, indeed, up. The route line adds a default 358that our networking is, indeed, up. The route line adds a default
318<path>/etc/resolv.conf</path> (if necessary), and we ping www.gentoo.org 360<path>/etc/resolv.conf</path> (if necessary), and we ping www.gentoo.org
319to make sure that name resolution (and general access to the internet) 361to make sure that name resolution (and general access to the internet)
320is working from our user-mode system. Now the user-mode system can 362is working from our user-mode system. Now the user-mode system can
321<c>emerge</c> at will! 363<c>emerge</c> at will!
322</p> 364</p>
365
366</body>
367</section>
368<section>
369<title>Using a Virtual Network</title>
370<body>
371
372<p>
373Before you get all too excited, this is not a virtual private network. It is a
374network that is only accessible by the UML instances. The
375<c>usermode-utilities</c> package provides a tool called <c>uml_switch</c> which
376defines the end points of the switch.
377</p>
378
379<pre caption="Activating end points of a UML switch">
380<comment>(If the switch information should stay in the foreground:)</comment>
381$ <i>uml_switch -unix ~/tmp/switch.sock</i>
382
383<comment>(If it should be backgrounded:)</comment>
384$ <i>uml_switch -unix ~/tmp/switch.sock &amp;&gt; ~/tmp/switch.log &amp;</i>
385</pre>
386
387<p>
388To start the UML instances on the switch, run the next command. Your
389(virtual) network interface will be connected to the <c>uml_switch</c> process
390and will be using the given MAC address.
391</p>
392
393<pre caption="Running first UML instance">
394$ <i>linux ubd0=first_rootfs ubd1=first_swapfs eth0=daemon,10:00:01:02:00:00,,~/tmp/switch.sock</i>
395</pre>
396
397<p>
398You can still connect the system to the existing network, or have a second
399process attached to both the virtual one and the existing one:
400</p>
401
402<pre caption="Running second UML instance">
403$ <i>linux ubd0=second_rootfs ubd1=second_swapfs eth0=daemon,10:00:01:02:00:01,,~/tmp/switch.sock \
404 eth1=tuntap,,,192.168.1.43</i>
405</pre>
406
407<p>
408More information about the tuntap setting can be found in the previous section.
409</p>
410
323</body> 411</body>
324</section> 412</section>
325</chapter> 413</chapter>
326
327<chapter> 414<chapter>
328<title>Testing the .iso</title> 415<title>Testing the .iso</title>
329
330<section> 416<section>
331<body> 417<body>
418
332<p> 419<p>
333Perhaps the true ideal of Gentoo Linux testing would be 420Perhaps the true ideal of Gentoo Linux testing would be
334to boot the .iso with user-mode linux and do the complete 421to boot the .iso with user-mode Linux and do the complete
335Gentoo install from within the user-mode linux virtual system. 422Gentoo install from within the user-mode Linux virtual system.
336</p> 423</p>
424
337<p> 425<p>
338Booting the .iso, or actually the initrd from the .iso, is pretty 426Booting the .iso, or actually the initrd from the .iso, is pretty
339straightforward. 427straightforward.
340</p> 428</p>
341<pre> 429
430<pre caption="Booting the ISO">
342# <i>mount -o loop /path/to/build-&lt;TAB&gt;.iso /mnt/loop</i> 431# <i>mount -o loop /path/to/install-&lt;TAB&gt;.iso /mnt/loop</i>
343# <i>cp /mnt/loop/isolinux/rescue.gz .</i> 432# <i>cp /mnt/loop/isolinux/gentoo.igz .</i>
344# <i>linux load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=22000 \</i> 433# <i>linux load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=22000 \</i>
345&gt; <i>initrd=rescue.gz root=/dev/ram0 ubd0=root_fs ubd1=swap_fs \</i> 434&gt; <i>initrd=rescue.gz root=/dev/ram0 ubd0=root_fs ubd1=swap_fs \</i>
346&gt; <i>ubd2=/dev/cdroms/cdrom0 eth0=ethertap,tap0,,192.168.0.254</i> 435&gt; <i>ubd2=/dev/cdroms/cdrom0 eth0=tuntap,,,192.168.0.254</i>
347</pre> 436</pre>
437
438<p>
348<p>Now you can follow the Gentoo install doc essentially verbatim, 439Now you can follow the Gentoo install doc essentially verbatim,
349although you'll need to know that the root filesystem will be 440although you'll need to know that the root filesystem will be
350<path>/dev/ubd/0</path>, the swap "partition" 441<path>/dev/ubd/0</path>, the swap "partition"
351will be <path>/dev/ubd/1</path>, and the CD rom 442will be <path>/dev/ubd/1</path>, and the CD rom
352will be <path>/dev/ubd/2</path>.</p> 443will be <path>/dev/ubd/2</path>.
444</p>
445
353</body> 446</body>
354</section> 447</section>
355</chapter> 448</chapter>
356 449
450<chapter>
451<title>Resources</title>
452<section>
453<body>
454
455<ul>
456 <li>
457 <uri link="http://edeca.net/articles/bridging/index.html">Bridging with
458 UML</uri>
459 </li>
460 <li>
461 <uri link="http://user-mode-linux.sourceforge.net/">UML Homepage</uri>
462 </li>
463 <li>
464 <uri link="http://www.theshore.net/~caker/uml/">Caker's UML Notes</uri>
465 </li>
466 <li>
467 <uri link="http://sourceforge.net/mailarchive/forum.php?forum_id=3647">UML
468 Mailinglist archives</uri>
469 </li>
470</ul>
471
472</body>
473</section>
474</chapter>
357 475
358</guide> 476</guide>

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.26

  ViewVC Help
Powered by ViewVC 1.1.20