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:
$ cd /usr/src/uml
$ tar -xzvf linux-2.4.0-prerelease.tar.bz2
$ cd /usr/src/uml/linux
$ cat uml-patch-2.4.0-prerelease.bz2 | bunzip2 - | patch -p1
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.
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):
make modules ARCH=um
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.
You can install them by using ftp or something to copy them into the virtual machine and dropping them into /lib/modules/`uname -r`.
You can also get the kernel build process to install them as follows:
# mount root_fs mnt -o loop
make modules_install INSTALL_MOD_PATH=`pwd`/mnt ARCH=um
# umount mnt
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 us know, and they'll be "taken care of".