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:
- Download the latest UML patch from
the project's download page
In this example, the file is uml-patch-2.4.0-prerelease.bz2.
- Download the matching kernel from your favourite kernel mirror,
such as:
ftp://ftp.ca.kernel.org/pub/kernel/v2.4/linux-2.4.0-prerelease.tar.bz2
.
- Make a directory and unpack the kernel into it.
$ cd /usr/src/uml
$ tar -xzvf linux-2.4.0-prerelease.tar.bz2
- Apply the patch using
$ cd /usr/src/uml/linux
$ cat uml-patch-2.4.0-prerelease.bz2 | bunzip2 - | patch -p1
- 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.
- Finish with `make linux ARCH=um': the result is a file called `linux'
in the top directory of your source tree.
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.
The sources are also available from cvs at
the project's cvs page , which has directions on getting
the sources. You
can also browse the CVS pool from there.
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.
If you don't have the latest kernel pool, you can get the corresponding
user-mode sources with
cvs co -r v_2_3_x linux
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.
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 SuSE 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.
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:
for i in 0 1 2 3 4 5 6 7; do mknod ubd$i b 98 $i; done
and changing /etc/fstab and /etc/inittab to refer to the non-devfs devices.