User-Mode Linux and kernel 2.6.1


Here are the steps that I followed to get UML working with the latest kernel.  I've included links to local copies of all the files - you can find them on none in ~pjd/public_html/uml as well.

Building the kernel

First, get the kernel tarfile (linux-2.6.1.tar.bz2) and corresponding UML patch (uml-patch-2.6.1-1.bz2).  You might want to start with my config (config.pjd-2.6.1uml) as well.

Unpack and patch the kernel:
	tar --bzip -xvf linux-2.6.1.tar.bz2
cd linux-2.6.1
bunzip2 -c ../uml-patch-2.6.1-1.bz2 | patch -p1
Copy the config file, and then build the kernel:
	cp config.pjd-2.6.1uml .config
make ARCH=um oldconfig
make ARCH=um linux
Note that kernel modules are turned off in this config, as 2.6.1 UML doesn't compile if they are enabled.  (other features that need to be turned off to compile include IRDA and SCSI - there may be some other ones that I forgot as well)

Creating a root filesystem and booting UML

I had success with the slackware 8.1 root image (root_fs_slack8.1.bz2).  This is a really minimal system, so you'll want the iso of the slackware install disk as well, to load other packages (slackware-8.1-install.iso). 

Unpack the root filesystem, and then start linux with the root filesystem as the first virtual disk, and the installation ISO as the second virtual disk.  (this is a hack - you ought to be able to access the ISO through hostfs and then loop-mount it, but for some reason this didn't work for me) 
	./linux ubd0=root_fs_slack8.1 ubd1=slackware-8.1-install.iso
It should make it all the way through boot and give you a login prompt, as well as popping up three other xterms for the other virtual consoles.  Note that to stop the program you have to log in (root, no password) and run the 'halt' command.

It's a good idea to save a copy of the original root_fs_slack8.1.bz2 file, so that if you screw up your root filesystem you can just delete it and start over. Also, for obvious reasons UML locks a file that it's using as a virtual disk, so you can't have two UMLs running against the same disk image at once.  (well, not with the UBD driver.  There's a copy-on-write driver that lets you do this...)

Setting up the virtual system

If (like me) you don't know anything about Slackware, you'll want to know that installed packages are listed in /var/log/packages (each file has the name of a package, and contains a list of its files) and you add and remove packages with the installpkg and removepkg commands.  Mount the ISO image ('mount /dev/ubd/0 /mnt/cd') and you'll have access to all of them.

Also you'll probably want access to the host filesystem to transfer files back and forth, using the 'hostfs' filesystem.  To add /mnt/host to your fstab:
	mkdir /mnt/host
echo none hostfs defaults 0 0 >> /etc/fstab

Setting up networking

The only networking method that doesn't require root access is Slirp, and I haven't been able to get that to work. (well, I did get it to work on kernel 2.4.22, but that doesn't help here)  More info when I have something that works.

Useful links

User-mode linux home page: user-mode-linux.sourceforge.net
Another UML page: www.usermodelinux.org
Lots of slackware packages: www.linuxpackages.net
Installing RedHat under UML: linuxhacker.ru/uml
Slirp: slirp.sourceforge.net
UMLBuilder (builds root filesystem images): umlbuilder.sourceforge.net


modified: 1/28/04 pjd