!! IMPORTANT !!  If you are using a kernel old than 2.2.18 please read
the relevent section below.

The makefile in this directory will attempt to create an LVM patch for
your kernel.

This patch will be suitable for applying to a clean kernel from Linus.
The kernels supplied with popular distributions (eg, RedHat) are not
Linus kernels.

If you are not familiar with patching or building the kernel then
consider looking for pre-built binaries of LVM.

Configuring LVM for your kernel
-------------------------------

You can skip this step if you are sure you ran configure with the correct
options.

o untar your clean Linux kernel

o run 'make distclean' in the directory above this one to clean up any
  previous configure information.  If you get an error that says
  "make: *** No rule to make target `distclean'.  Stop." it generally
  means your source tree is clean and you can ignore it.
  
o run configure in the directory above this one to produce 'Makefile', making
  sure to specify the '--with-kernel_dir=' flag if your kernel source is not
  in '/usr/src/linux'.

Creating the patch
------------------

o check the following variables at the top of 'Makefile' in the PATCHES
  directory

  KERNEL_DIR should point to the kernel source that you wish to patch
  eg, KERNEL_DIR=/usr/src/linux

  LVM_VERSION the LVM version
  eg, LVM_VERSION=0.9.1_beta5

  KERNEL_VERSION the version of your kernel that is to be patched
  eg, KERNEL_VERSION=2.2.18

o Apply raw_io patch if you're using a 2.2 kernel (see below).

o type 'make', a file of the form lvm-<LVM_VERSION>-<KERNEL_VERSION>.patch
  should be built


Applying the patch to a 2.4 kernel
----------------------------------

linux-2.4 contains LVM already so the patch for these kernels does
little more than update the lvm source files.  You only need to apply
the one patch.

eg, 

cd /usr/src/linux
patch -p1 < /home/joe/develop/LVM/PATCHES/lvm-0.9.1_beta5-2.4.1.patch


Applying the patch to a 2.2 kernel
----------------------------------

LVM requires Stephen Tweedie's raw_io patch to work under linux-2.2,
we have included versions of this patch for various kernel releases
(linux-2.2.*-rawio.patch).  However we do not guarantee that this is
the most up to date version.

See ftp://ftp.kernel.org/pub/linux/kernel/people/sct/raw-io/

This patch must be applied before you make the LVM patch.

eg,

cd /usr/src/linux
patch -p1 < /home/joe/develop/LVM/PATCHES/linux-2.2.18-rawio.patch
cd /home/joe/develop/LVM/PATCHES
make
cd /usr/src/linux
patch -p1 < /home/joe/develop/LVM/PATCHES/lvm-0.9.1_beta5-2.2.18.patch


Kernels older than 2.2.18
-------------------------

The patches have only been tested with kernels 2.2.18 and 2.4.0 at the
moment.

If you are using a kernel earlier than 2.2.18 you will not be able to
build the patch successfully.  Copying the 2.2.18 fragments file to a
file named after your kernel and trying again will produce a patch
that may work (almost certain for 2.2.17 less likely for 2.2.14).

eg, 
  
  cp fragments-2.2.18 fragments-2.2.16
  make

If you try this and manage to produce an acceptable patch please tell
us (linux-lvm@sistina.com or thornber@sistina.com) so we can update
this document.


Software RAID issues
--------------------

** The Makefile in the PATCHES directory no longer automatically spots
   new raid **

There appear to be two commonly used implementations of software raid
for 2.2 kernels, the one in the kernel and the one found here
(referred to as 'new raid' from now on):

ftp://ftp.kernel.org/pub/linux/kernel/people/mingo/raid-patches/

Which is used in many distributions.

If you wish to use the new raid you should apply the new raid patch
before you configure lvm and build the lvm patch.

Also you will have to edit the fragments file for you kernel (eg,
fragments-2.2.18) to point to
fragments/generic-map-raid-2.2.19-A1.patch rather than the usual
fragments/generic-map-2.2.patch


*** WARNING: Practically no testing has been done with this new raid patch.

If you do use this patch could you please provide feedback to
linux-lvm@sistina.com or mail me directly at thornber@sistina.com

eg, 

cd /usr/src/linux
patch -p1 < /home/joe/develop/LVM/PATCHES/linux-2.2.18-rawio.patch
patch -p1 < ~/raid-2.2.18-B0.patch
cd /home/joe/develop/LVM/
configure
cd PATCHES
make
cd /usr/src/linux
patch -p1 < /home/joe/develop/LVM/PATCHES/lvm-0.9.1_beta6-2.2.18RAID.patch


Support
-------

If you have any problems please report them to the
linux-lvm@sistina.com mailing list.
