Device Mapper installation
==========================

1) Generate custom makefiles.

   Run the 'configure' script from the top directory.

   If your kernel source is not in /usr/src/linux give its location
   using --with-kernel-dir.

   Other flags let you change the installation & working directories.

   Example:  
   ./configure --with-kernel-dir=/usr/src/linux-2.4.20


2) Patch, configure and build a new kernel containing device-mapper
   (unless, of course, your kernel already contains device-mapper).

   If there is already a patch for your kernel and you gave 'configure'
   appropriate parameters in step 1, you can just run 'make apply-patches' 
   from the top directory and go on to step 3.  (This also attempts to
   apply the VFS lock patch, which will fail if you've already applied it.)
   
   Configure, build and install your kernel in the normal way, selecting
   'Device mapper support' from the 'Multiple devices driver support' menu.

   If you are patching by hand, the patches are stored in the
   'patches' subdirectory.  The name of each patch contains the kernel
   version it was generated against and whether it is for the 'fs' or
   'ioctl' interface.  Current development effort is concentrated
   on the 'ioctl' interface.  (Use CVS to get the older 'fs' patches if
   you want - see note below.)

   patches/common holds the constituent patches.
   You may need to use these if some of the patches (e.g. mempool)
   have already been applied to your kernel.  See patches/common/README.
   You should also apply the VFS lock patch (but not required if you're only
   using ext2).

   Running 'make symlinks' from the 'kernel' subdirectory will put symbolic 
   links into your kernel tree pointing back at the device-mapper source files.
   If you do this, you'll probably also need to apply the VFS patch and all
   the constituent patches in patches/common except for the devmapper one.
   

3) Build and install the shared library (libdevmapper.so) that
   provides the API.

   Run 'make' from the top directory.

      Example:  make install

   The DESTDIR environment variable is supported (e.g. for packaging).


4) If you are using the ioctl interface but not devfs then install 
   scripts/devmap_mknod.sh to run either:

      Each time the kernel boots 
        e.g. add to /etc/rc*

      Or whenever the device-mapper is loaded (if you built it as a module)
        e.g. add the following line to /etc/modules.conf and run depmod -a
	     and use modprobe dm-mod to load the module
	post-install dm-mod /etc/init.d/devmap_mknod.sh
	
   The script creates the /dev/mapper/control device for the ioctl
   interface using the major and minor numbers that have been allocated
   dynamically.  It prints a message if it works or else it fails silently 
   with a non-zero status code (which you probably want to test for).

   If you want the block devices created by the device-mapper to have a 
   specific major number, then specify this when loading the module
      e.g. modprobe dm-mod major=123
   This major number is visible in /proc/devices.


5) You can now boot your new kernel and use 'dmsetup' to test the API.
   Read the dmsetup man page for more information.
   Or proceed to install a beta version of the new LVM2 tools.


Note if you are upgrading
=========================
   /dev/mapper was called /dev/device-mapper prior to 0.96.04.
   Consequently scripts/devmap_mknod.sh has been updated.

Notes about the alternative filesystem interface
================================================
The original 2.4 filesystem interface has not been updated for several 
months, requires an old kernel, and is missing lots of features.

A new filesystem interface is under development for 2.5 kernels (and
will get back-ported to 2.4 if it's successful).
Look for "dmfs" patches at:
   http://people.sistina.com/~thornber/patches/

