Site Home Page
The UML Wiki
UML Community Site

Building from source

Get the source
You need to start by getting a kernel tree (generally, the more recent, the better):
host% wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.16.tar.bz2
--15:02:55--  http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.16.tar.bz2
           => `linux-2.6.16.tar.bz2'
Resolving www.kernel.org... 204.152.191.5, 204.152.191.37
Connecting to www.kernel.org|204.152.191.5|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 40,845,005 (39M) [application/x-bzip2]

100%[====================================>] 40,845,005   633.10K/s    ETA 00:00

15:04:00 (622.07 KB/s) - `linux-2.6.16.tar.bz2' saved [40845005/40845005]
Unpack the tree, which will end up in linux-2.6.16 in this case
host% bunzip2 linux-2.6.16.tar.bz2 
host% tar xf linux-2.6.16.tar 
host% cd linux-2.6.16
Configuration
Start with the UML default configuration, which will compile and boot. If you need to make changes, then do that later using menuconfig or xconfig.
host% make defconfig ARCH=um
host% # now make menuconfig or xconfig if desired
host% make menuconfig ARCH=um

If you don't start with a defconfig, then the kernel build will be that of the host (it will find a config file in /boot), which will be very wrong for UML and will produce a UML that lacks vital drivers and won't boot.

Note - it is vitally important to put "ARCH=um" on every make command while building UML, or to "export ARCH=um" to put ARCH in your environment. This causes the kernel build to build UML, which is a separate Linux architecture. Not doing so will cause the kernel build to build or configure a native kernel. If you should forget, clean the pool like this

host% make mrproper
host% make mrproper ARCH=um
to get rid of all traces of whatever building you did, and start over.
Building
Now, you can start the build
host% make ARCH=um
When this finishes, you will have a UML binary called "linux".
host% ls -l linux
-rwxrwxr-x 2 jdike jdike 18941274 Apr  7 15:18 linux
It's so large because of the debugging symbols built in to it. Removing those will shrink the UML binary to roughly the size of a native kernel.

Now, you are ready to boot your new UML.

Hosted at SourceForge Logo