/usr/share/doc/user-mode-linux-doc/html/compile.html is in user-mode-linux-doc 20060501-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<title>Building from source</title>
</head>
<body alink="#FF0000" vlink="#55188A" link="#0000EF" bgcolor="#FFFFFF" text="#000099">
<table border="0">
<tr align="left">
<td valign="top">
<table border="0">
<tr align="left"><td valign="top" >
<img src="uml-small.png" height="171" width="120"/>
</td></tr>
<tr align="left"><td valign="top" bgcolor="#e0e0e0">
<font size="-1"><a href="index.html">Site Home Page</a></font>
<br>
<font size="-1"><a href="http://uml.harlowhill.com">The UML Wiki</a></font>
<br>
<font size="-1"><a href="http://usermodelinux.org">UML Community Site</a></font>
<br>
<font size="-1"><a href="roadmap.html">The UML roadmap</a></font>
<br>
<font size="-1"><a href="uses.html">What it's good for</a></font>
<br>
<font size="-1"><a href="case-studies.html">Case Studies</a></font>
<br>
<font size="-1"><a href="kernel.html">Kernel Capabilities</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/dl-sf.html">Downloading it</a></font>
<br>
<font size="-1"><a href="run.html">Running it</a></font>
<br>
<font size="-1"><a href="compile.html">Compiling</a></font>
<br>
<font size="-1"><a href="install.html">Installation</a></font>
<br>
<font size="-1"><a href="skas.html">Skas Mode</a></font>
<br>
<font size="-1"><a href="patches.html">Incremental Patches</a></font>
<br>
<font size="-1"><a href="tests.html">Test Suite</a></font>
<br>
<font size="-1"><a href="devanon.html">Host memory use</a></font>
<br>
<font size="-1"><a href="fs_making.html">Building filesystems</a></font>
<br>
<font size="-1"><a href="faq.html">Troubles</a></font>
<br>
<font size="-1"><a href="contrib.html">User Contributions</a></font>
<br>
<font size="-1"><a href="links.html">Related Links</a></font>
<br>
<font size="-1"><a href="todo.html">The ToDo list</a></font>
<br>
<font size="-1"><a href="projects.html">Projects</a></font>
<br>
<font size="-1"><a href="diary.html">Diary</a></font>
<br>
<font size="-1"><a href="thanks.html">Thanks</a></font>
<br>
<font size="-1"><a href="contacts.html">Contacts</a></font>
</td></tr>
<tr align="left"><td valign="top" bgcolor="#e0e0e0">Tutorials<br>
<font size="-1"><a href="UserModeLinux-HOWTO.html">The HOWTO (html)</a></font>
<br>
<font size="-1"><a href="UserModeLinux-HOWTO.txt.gz">The HOWTO (text)</a></font>
<br>
<font size="-1"><a href="hostfs.html">Host file access</a></font>
<br>
<font size="-1"><a href="input.html">Device inputs</a></font>
<br>
<font size="-1"><a href="shared_fs.html">Sharing filesystems</a></font>
<br>
<font size="-1"><a href="fs.html">Creating filesystems</a></font>
<br>
<font size="-1"><a href="resize.html">Resizing filesystems</a></font>
<br>
<font size="-1"><a href="networking.html">Virtual Networking</a></font>
<br>
<font size="-1"><a href="mconsole.html">Management Console</a></font>
<br>
<font size="-1"><a href="debugging.html">Kernel Debugging</a></font>
<br>
<font size="-1"><a href="honeypots.html">UML Honeypots</a></font>
<br>
<font size="-1"><a href="gprof.html">gprof and gcov</a></font>
<br>
<font size="-1"><a href="xtut.html">Running X</a></font>
<br>
<font size="-1"><a href="trouble.html">Diagnosing problems</a></font>
<br>
<font size="-1"><a href="config.html">Configuration</a></font>
<br>
<font size="-1"><a href="slack_readme.html">Installing Slackware</a></font>
<br>
<font size="-1"><a href="arch-port.html">Porting UML</a></font>
<br>
<font size="-1"><a href="iomem.html">IO memory emulation</a></font>
<br>
<font size="-1"><a href="2G-2G.html">UML on 2G/2G hosts</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/lksct/index.html">Adding a UML system call</a></font>
<br>
<font size="-1"><a href="nesting.html">Running nested UMLs</a></font>
</td></tr>
<tr align="left"><td valign="top" bgcolor="#e0e0e0">How you can help<br>
<font size="-1"><a href="help-gen.html">Overview</a></font>
<br>
<font size="-1"><a href="help-doc.html">Documentation</a></font>
<br>
<font size="-1"><a href="help-userspace.html">Utilities</a></font>
<br>
<font size="-1"><a href="help-kernel-v1.html">Kernel bugs</a></font>
<br>
<font size="-1"><a href="projects.html">Kernel projects</a></font>
</td></tr>
<tr align="left"><td valign="top" bgcolor="#e0e0e0">Screenshots<br>
<font size="-1"><a href="net.html">A virtual network</a></font>
<br>
<font size="-1"><a href="x.html">An X session</a></font>
</td></tr>
<tr align="left"><td valign="top" bgcolor="#e0e0e0">Transcripts<br>
<font size="-1"><a href="login.html">A login session</a></font>
<br>
<font size="-1"><a href="debug-session.html">A debugging session</a></font>
<br>
<font size="-1"><a href="slackinst.html">Slackware installation</a></font>
</td></tr>
<tr align="left"><td valign="top" bgcolor="#e0e0e0">Reference<br>
<font size="-1"><a href="switches.html">Kernel switches</a></font>
<br>
<font size="-1"><a href="slack_readme.html">Slackware README</a></font>
</td></tr>
<tr align="left"><td valign="top" bgcolor="#e0e0e0">Papers<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/als2000/index.html">ALS 2000 paper (html)</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/als2000.tex">ALS 2000 paper (TeX)</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/slides/als2000/slides.html">ALS 2000 slides</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/slides/lca2001/lca.html">LCA 2001 slides</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/slides/ols2001/index.html">OLS 2001 paper (html)</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/ols2001.tex">OLS 2001 paper (TeX)</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/als2001/index.html">ALS 2001 paper (html)</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/als2001.tex">ALS 2001 paper (TeX)</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/slides/ists2002/umlsec.htm">UML security (html)</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/slides/lca2002/lca2002.htm">LCA 2002 (html)</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/slides/wvu2002/wvu2002.htm">WVU 2002 (html)</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/slides/ists_rt/ists_rt.htm">Security Roundtable (html)</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/slides/ols2002/ols2002.html">OLS 2002 slides</a></font>
<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/slides/lwe2005/LWE2005.html">LWE 2005 slides</a></font>
</td></tr>
<tr align="left"><td valign="top" bgcolor="#e0e0e0">Fun and Games<br>
<font size="-1"><a href="http://user-mode-linux.sourceforge.net/cgi-bin/hangman">Kernel Hangman</a></font>
<br>
<font size="-1"><a href="sdotm.html">Disaster of the Month</a></font>
</td></tr>
</table>
</td>
<td valign="top" align="left">
<center>
<h3>Compiling the kernel and modules</h3>
</center>
<a name="Compiling the kernel"/><table width="100%" bgcolor="#e0e0e0">
<tr>
<td>
<b>
<font color="black">Compiling the kernel</font>
</b>
</td>
</tr>
</table>
<blockquote head="Compiling the kernel">
Compiling the user mode kernel is just like compiling any other
kernel. Let's go through the steps, using 2.4.0-prerelease (current
as of this writing) as an example:
<ol>
<li> Download the latest UML patch from
<a href="dl-sf.html">the download page</a>
In this example, the file is uml-patch-2.4.0-prerelease.bz2.
</li>
<li> Download the matching kernel from your favourite kernel mirror,
such as:
http://ftp.ca.kernel.org/linux/kernel/
<a href="http://ftp.ca.kernel.org/linux/kernel/">
http://ftp.ca.kernel.org/linux/kernel/
</a>.
</li>
<li> Make a directory and unpack the kernel into it.
<blockquote>
<tt>
<font color="#000000" where="host">host%
mkdir ~/uml
</font>
</tt>
</blockquote>
<blockquote>
<tt>
<font color="#000000" where="host">host%
cd ~/uml
</font>
</tt>
</blockquote>
<blockquote>
<tt>
<font color="#000000" where="host">host%
tar -xjvf linux-2.4.0-prerelease.tar.bz2
</font>
</tt>
</blockquote>
</li>
<li> Apply the patch using
<blockquote>
<tt>
<font color="#000000" where="host">host%
cd ~/uml/linux
</font>
</tt>
</blockquote>
<blockquote>
<tt>
<font color="#000000" where="host">host%
bzcat uml-patch-2.4.0-prerelease.bz2 | patch -p1
</font>
</tt>
</blockquote>
</li>
<li> Run your favorite config; `make xconfig ARCH=um' is the most
convenient. `make config ARCH=um' and 'make menuconfig ARCH=um' will
work as well. The defaults will give you a useful kernel. If you
want to change something, go ahead, it probably won't hurt anything.
<p>
Note: If the host is configured with a 2G/2G address space split
rather than the usual 3G/1G split, then the packaged UML binaries will
not run. They will immediately segfault. See
<a href="2G-2G.html">this page</a> for the scoop on
running UML on your system.
</li>
<li> Finish with `make linux ARCH=um': the result is a file called `linux'
in the top directory of your source tree.
</li>
You may notice that the final binary is pretty large (many 10's of
megabytes for a debuggable UML). This is almost entirely symbol
information. The actual binary is comparable in size to a native
kernel. You can run that huge binary, and only the actual code and
data will be loaded into memory, so the symbols only consume disk
space unless you are running UML under gdb. You can strip UML:
<blockquote>
<tt>
<font color="#000000" where="host">host% strip linux</font>
</tt>
</blockquote>
to see the true size of the UML kernel.
</ol>
Make sure that you don't build this
kernel in /usr/src/linux. On some distributions, /usr/include/asm
is a link into this pool. The user-mode build changes the other end
of that link, and things that include <asm/anything.h> stop compiling.
<p>The sources are also available from cvs. You can <a href="http://www.user-mode-linux.org/cvs">browse</a> the CVS pool
or access it anonymously via
<blockquote>
<tt>
<font color="#000000"> cvs -d:pserver:anonymous@www.user-mode-linux.org:/cvsroot/user-mode-linux
<i>cvs command</i>
</font>
</tt>
</blockquote>
<p>If you get the CVS sources, you will have to check them out into an
empty directory. You will then have to copy each file into the corresponding
directory in the appropriate kernel pool.
<p>If you don't have the latest kernel pool, you can get the corresponding
user-mode sources with <blockquote>
<tt>
<font color="#000000" where="host">host% cvs co -r v_2_3_x linux</font>
</tt>
</blockquote>
where 'x' is the version in your pool. Note that you will not get the bug
fixes and enhancements that have gone into subsequent releases.
<p>
If you build your own kernel, and want to boot it from one of the
filesystems distributed from this site, then, in nearly all cases,
devfs must be compiled into the kernel and mounted at boot time. The
exception is the tomsrtbt filesystem. For this,
devfs must either not be in the kernel at all, or "devfs=nomount" must
be on the kernel command line. Any disagreement between the kernel
and the filesystem being booted about whether devfs is being used will
result in the boot getting no further than single-user mode.
<p>
If you don't want to use devfs, you can remove the need for it from a
filesystem by copying /dev from someplace, making a bunch of
/dev/ubd devices:
<blockquote>
<tt>
<font color="#000000" where="UML">UML#
for i in 0 1 2 3 4 5 6 7; do mknod ubd$i b 98 $[ $i * 16 ]; done
</font>
</tt>
</blockquote>
and changing /etc/fstab and /etc/inittab to refer to the non-devfs devices.
</blockquote>
<a name="Compiling and installing kernel modules"/><table width="100%" bgcolor="#e0e0e0">
<tr>
<td>
<b>
<font color="black">Compiling and installing kernel modules</font>
</b>
</td>
</tr>
</table>
<blockquote head="Compiling and installing kernel modules">
UML modules are built in the same way as the native kernel (with the
exception of the 'ARCH=um' that you always need for UML):
<blockquote>
<tt>
<font color="#000000" where="host">host% make modules ARCH=um</font>
</tt>
</blockquote>
Any modules that you want to load into this kernel need to
be built in the user-mode pool. Modules from the native kernel won't
work. If you notice that the modules you get are much larger than
they are on the host, see the note above about the size of the final
UML binary.
<br>You can install them by using ftp or something to copy them into the
virtual machine and dropping them into /lib/modules/`uname -r`.
<br>You can also get the kernel build process to install them as
follows:
<ol>
<li>
with the kernel not booted, mount the root filesystem in the top level
of the kernel pool:
<blockquote>
<tt>
<font color="#000000" where="host">host% mount root_fs mnt -o loop</font>
</tt>
</blockquote>
</li>
<li>
run <blockquote>
<tt>
<font color="#000000" where="host">host%
make modules_install INSTALL_MOD_PATH=`pwd`/mnt ARCH=um
</font>
</tt>
</blockquote>
</li>
<li>
unmount the filesystem
<blockquote>
<tt>
<font color="#000000" where="host">host% umount mnt</font>
</tt>
</blockquote>
</li>
<li>
boot the kernel on it
</li>
</ol>
If you can't mount the root filesystem on the host for some reason
(like it's a COW file), then an alternate approach is to mount the
UML kernel tree from the host into the UML with <a href="hostfs.html">hostfs</a> and run the modules_install inside
UML:
<ol>
<li>
With UML booted, mount the host kernel tree inside UML at the same
location as on the host:
<blockquote>
<tt>
<font color="#000000" where="UML">UML# mount none -t hostfs <i>path to UML pool</i> -o
<i>path to UML pool</i>
</font>
</tt>
</blockquote>
</li>
<li>
Run make modules_install:
<blockquote>
<tt>
<font color="#000000" where="UML">UML# cd <i>path to UML pool</i> ; make modules_install
</font>
</tt>
</blockquote>
</li>
</ol>
The depmod at the end may complain about unresolved symbols because
there is an incorrect or missing System.map installed in the UML
filesystem. This appears to be harmless. insmod or modprobe should
work fine at this point.
<p>
When the system is booted, you can use insmod as usual to get the modules
into the kernel. A number of things have been loaded into UML as
modules, especially filesystems and network protocols and filters, so
most symbols which need to be exported probably already are. However,
if you do find symbols that need exporting, let <a href="contacts.html">us</a> know, and they'll be "taken care of".
<p>
If you try building an external module against a UML tree, you will
find that it doesn't compile because of missing includes. There are
less obvious problems with the CFLAGS that the module Makefile or
script provides which would make it not run even if it did build. To
get around this, you need to provide the same CFLAGS that the UML
kernel build uses.
<p>
A reasonably slick way of getting the UML CFLAGS is
<blockquote>
<tt>
<font color="#000000">
cd <i>uml-tree</i> ; make script 'SCRIPT=@echo $(CFLAGS)' ARCH=um
</font>
</tt>
</blockquote>
If the module build process has something that looks like
<blockquote>
<tt>
<font color="#000000"> $(CC) $(CFLAGS) <i>file</i>
</font>
</tt>
</blockquote>
then you can define CFLAGS in a script like this
<blockquote>
<tt>
<font color="#000000">
CFLAGS=`cd <i>uml-tree</i> ; make script 'SCRIPT=@echo $(CFLAGS)' ARCH=um`
</font>
</tt>
</blockquote>
and like this in a Makefile
<blockquote>
<tt>
<font color="#000000">
CFLAGS=$(shell cd <i>uml-tree</i> ; make script 'SCRIPT=@echo
$$(CFLAGS)' ARCH=um)
</font>
</tt>
</blockquote>
</blockquote>
<a name="Compiling and installing uml_utilities"/><table width="100%" bgcolor="#e0e0e0">
<tr>
<td>
<b>
<font color="black">Compiling and installing uml_utilities</font>
</b>
</td>
</tr>
</table>
<blockquote head="Compiling and installing uml_utilities">
Many features of the UML kernel require a user-space helper program,
so a uml_utilities package is distributed separately from the kernel
patch which provides these helpers. Included within this is:
<ul>
<li>
port-helper - Used by consoles which connect to xterms or ports
</li>
<li>
tunctl - Configuration tool to create and delete tap devices
</li>
<li>
uml_net - Setuid binary for automatic tap device configuration
</li>
<li>
uml_switch - User-space virtual switch required for daemon transport
</li>
</ul>
The uml_utilities tree is compiled with:
<blockquote>
<tt>
<font color="#000000" where="host root">host#
make && make install
</font>
</tt>
</blockquote>
Note that UML kernel patches may require a specific version of the
uml_utilities distribution. If you don't keep up with the mailing lists,
ensure that you have the latest release of uml_utilities if you are
experiencing problems with your UML kernel, particularly when dealing
with consoles or command-line switches to the helper programs
</blockquote>
</td>
</tr>
</table>
<center>
<font size="-1">Hosted at </font>
<a href="http://sourceforge.net">
<img src="http://sourceforge.net/sflogo.php?group_id=429" width="88" height="31" border="0" alt="SourceForge Logo">
</a>
</center>
</body>
</html>
|