Linux Kernel 2.6 compilation Guide, User Mode Linux (UML), Ext4 support

by Amit


When I wrote this guide 3 years ago, it was my first ever attempt at writing articles which I had yearned to start. I had to get bluetooth support on my Linux 2.4 kernel and the easier and better way out was to upgrade to a 2.6 series kernel. Hence the guide. Its still good. Let me know, if otherwise.

Today, I wanted to play around with the Ext4 filesystem and User Mode Linux. Hence I am recompiling a vanilla 2.6.28 kernel, the first time after I had written that article. I am reproducing it here with some modifications and the theme as compilation of a vanilla kernel, rather than the upgradation and spelling corrections specific to User Mode Linux (UML) and ext4.

The idea is to build a ‘ext4’ and a UML enabled kernel, then some newbie style playing with the UML and ‘ext4’ filesystem. I am using Debian 5.0 “Lenny” on VirtualBox (I don’t have much to loose, that way :-))

Obtaining the kernel source code

Get the latest kernel source code (I am using 2.6.28) and extract it to a directory under your $HOME.

Kernel Configuration

You will need to enable the ‘ext4’ support under ‘Filesystems’ and also specify that we are building a UML kernel:

debian:/home/amit/kernel/sources/linux-2.6.28# make depconfig ARCH=um
debian:/home/amit/kernel/sources/linux-2.6.28# make menuconfig ARCH=um

Save the configuration.

Building the Kernel

Once the configuration is over, you can start the build process:

debian:/home/amit/kernel/sources/linux-2.6.28# make linux ARCH=um

After the build process is over, you will have a binary, linux which is the kernel just built for you with UML support.

Booting into UML

Before you can boot, you will need a UML root file system. You can either download one from here or build one yourself, or you may boot your host file system. I am using the root filesystem image for DSL provided in the earlier mentioned link:
./linux ubd0=./DSL-4.4-root_fs
Locating the bottom of the address space ... 0x0
Locating the top of the address space ... 0xc0000000
Core dump limits :
soft - 0
hard - NONE
Checking that ptrace can change system call numbers...OK
Checking syscall emulation patch for ptrace...OK
Checking advanced syscall emulation patch for ptrace...OK
Checking for tmpfs mount on /dev/shm...OK
Checking PROT_EXEC mmap in /dev/shm/...OK
Checking for the skas3 patch in the host:

.
.

and finally you will get a root# prompt. To ensure, that we are really in UML, cat /proc/cpuinfo :

processor : 0
vendor_id : User Mode Linux
model name : UML
mode : skas
host : Linux debian 2.6.26-1-686 #1 SMP Sat Jan 10 18:29:31 UTC 2009 i686
bogomips : 10643.04

Well, we just got started. You might want to try lots of other things. Networking, Jails, blah blah. Visit the UML homepage for more resources. Also, read the UML documentation in the Kernel source tree under Documentation/.

Trying Ext4

We will need to do some extra things to start playing around with ‘ext4’.

We will have to: create a new kernel image, make the modules, install them and boot into the new kernel (as mentioned here). Once booted into the new kernel, try out some of the stuffs as in here

I tried one of the alpha releases of Kubuntu 9.04, which supports ‘ext4’. It was pretty much blazingly fast.

Advertisement