Patching, Configuring, and Building Your Kernel
These instructions are only intended to cover the steps necessary to patch
and configure your kernel for use with EVMS. For general instructions on
configuring and compiling a Linux kernel, please see the
The new Device-Mapper driver with the version-4 ioctl interface is now
available. EVMS works with either this new version of Device-Mapper or with
version 3 which was used for EVMS 2.1.0 and earlier releases.
If you already have a 2.4 kernel patched with Device-Mapper and an earlier
version of EVMS, you can continue to use that same kernel with EVMS 2.5.5, and
you can skip to the next section of these instructions. However, we recommend
upgrading to the new version of Device-Mapper if possible.
NOTE: Debian users should first read through the file
/usr/share/doc/kernel-patch-evms/README.Debian for instructions on
automatically patching and building your kernel with make-kpkg.
- Base Device-Mapper Driver
The Device-Mapper driver is already present in the 2.6 kernel. However, the
2.4 kernel does not yet include Device-Mapper, so the full driver must be
patched in. The patches are located in the Device-Mapper package downloaded
in the previous section.
- EVMS Patches
In addition to the base MD and Device-Mapper support, EVMS requires a few
additional patches for certain EVMS features to work correctly with these
drivers. These patches are provided in the EVMS package, in the
kernel/2.4/ and kernel/2.6/ subdirectories. See the INDEX
files in those directories for descriptions of the patches.
If you will be using the Snapshot plugin in EVMS, apply the following patches.
If you will be using the BBR plugin in EVMS, apply the following patches.
- 2.6 kernels
patch -p1 < /usr/src/evms-2.5.5/kernel/2.6/dm-bbr.patch
- 2.4 kernels
patch -p1 < /usr/src/evms-2.5.5/kernel/2.4/dm-bbr.patch
- BD-Claim Patch
The 2.6 kernels now prevent multiple "owners" of a block-device. This
means that the stock kernel will not allow you to mount a filesystem
on one of the kernel's built-in disk-partitions as well as use EVMS to
activate volumes on that disk.
More specifically, the kernel has its own partitioning code that runs
when the kernel boots, and provides the traditional partition devices
(e.g. /dev/hda1). When a filesystem mounts one of these partitions, the
filesystem "claims" that partition and no one else can claim it. When
this happens, the kernel's partitioning code (not the filesystem code)
also claims the underlying disk, meaning that disk is only available
for use by the kernel's built-in partitions on that disk. Other
filesystems may mount other partitions on that disk, but the disk
itself is "owned" by the partitioning code.
However, in order to allow easy management of partitions, EVMS does
its own partition detection, and creates devices to represent those
partitions using Device-Mapper (not the kernel's built-in partitioning
code). When DM creates a device, it also attempts to claim the
underlying devices (in this case the disk that holds the partition).
But, if the user has already mounted one of the kernel's built-in
partitions on that same disk, then the disk will already have been
claimed. DM will be unable to claim it, and the DM device activation
The end result is that a single disk cannot be used both for EVMS and
for mounting the kernel's built-in partitions.
There are three solutions to this problem.
- Switch to using EVMS for ALL your volumes and partitions. If none
of the kernel's built-in partitions are mounted, then there won't
be any conflicts when DM tries to claim the disks. This is, of
course, the preferred solution, but also requires some extra work
on your part to convert to mounting your root filesystem using an
EVMS volume. Please see the Root-Volume section of this
install guide as well as the Converting-To-EVMS
guide for more details on this option.
- Tell EVMS to exclude any disks that contain partitions that you are
going to mount using the kernel's built-in partitions. You can do
this by adding the names of these disks to the
sysfs_devices.exclude line in your /etc/evms.conf file. If
you choose this option, EVMS will completely ignore the specified disks
and not discover any of the partitions or volumes on those disks.
- Apply this patch, which will is a reversal of the patch that
prevents Device-Mapper and the kernel's built-in partitions from
using the same disk at the same time. This patch is not supported
by the kernel community, and in fact removes functionality that
they specifically added. However, it will allow you to share your
disks between EVMS and the kernel's built-in partitioning code, if
that's the choice you wish to make for your system.
patch -p1 < /usr/src/evms-2.5.5/kernel/2.6/bd-claim.patch
This issue does not exist on 2.4 kernels.
- Update Patches
If you downloaded any EVMS update-patches
for the kernel, they should be applied now, before configuring and building
the kernel. The top of each patch file will contain a description of the patch,
why it is necessary, and instructions on how to apply the patch to the kernel
- Configure the Kernel
After patching the kernel, the next step is configuring it with the
required support. To configure the kernel, complete the following steps:
- Type the following command:
NOTE: You can also use config or menuconfig.
- Select the Main Menu->Code Maturity Level Options
menu and enable the following option:
<y> Prompt for development and/or incomplete code/drivers
- To enable MD and DM support, select the
Main Menu->Multi-Device Support (RAID and LVM) menu, and
select the following options. These drivers can also be built as modules
<y> Multiple devices driver support (RAID and LVM)
<y> RAID support
<y> RAID-1 (mirroring) mode
<y> RAID-4/RAID-5 mode
<y> Device mapper support
<y> Crypt target support (only applicable on 2.6 kernels)
<y> Multipath target (only applicable on 2.6 kernels)
<y> Snapshot target (only applicable on 2.6 kernels)
<y> Mirror target
<y> Zero target (only applicable on 2.6 kernels)
<y> Flakey target (only applicable on 2.6 kernels)
<y> Bad Block Relocation Device Target
- To enable init-ramdisk support, select the Main Menu->Block
devices menu, and select the following options.
<y> Loopback device support
<y> RAM disk support
(4096) Default RAM disk size
<y> Initial RAM disk (initrd) support
Loopback can be built as a module. The remaining options cannot be built
- If you wish to use devfs (the kernel device-filesystem), you should
also configure your kernel to automatically mount devfs on /dev at boot. This
is necessary for the sample init-ramdisk to work properly when activating your
root volume (see later sections for more details).
NOTE: EVMS does not require devfs, and the EVMS team has no
specific recommendations about using it or not using it. If you do not wish to
use devfs, leave both of these options off.
In the Main Menu->File Systems menu, select the following options.
<y> /dev file system support (EXPERIMENTAL)
<y> Automatically mount at boot
Continue configuring your kernel as required for your system and hardware.
When you have finished configuring your kernel, choose Save and Exit to
quit the kernel configuration.
- Build the Kernel
Once you have configured the kernel, you will need to build the kernel.
- Type the following command:
- 2.6 kernels
- 2.4 kernels
- Copy the new kernel to the appropriate location (usually in /boot).
NOTE: On Intel® machines, use arch/i386/boot/bzImage.
- If you use LILO as your boot-loader, add an appropriate entry to your
/etc/lilo.conf file and run lilo to install the new kernel
image. If you use Grub as your boot-loader, add an appropriate entry to your
- Re-boot your machine to start the new kernel.