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.

   If you wish to use the filesystem interface instead of the ioctl 
   interface specify --with-interface=fs.

   Other flags let you change the installation & working directories.

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


2) Patch, configure and build a new kernel containing 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.
   
   If you are using User Mode Linux, also apply the patch 
   patches/misc/uml_config.patch

   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.  Only one interface is supported at once - don't
   apply both patches.

   The patches were generated by running 'make patches' from the 'kernel'
   subdirectory.  Constituent patches are kept in patches/common, patches/fs
   and patches/ioctl.  Source files are kept in kernel/common, kernel/fs
   and kernel/ioctl.  Running 'make symlinks' from the 'kernel' subdirectory
   will put symbolic links into your kernel tree pointing back at the
   source files.
   

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

   Run 'make' from the top directory.

      Example:  make install


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/device-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.

   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 use 'dmsetup' to test the API.
   If you chose the filesystem interface you will first need to mount dmfs.
   e.g. mount -t dmfs dmfs /dmfs  (or add it to /etc/fstab)
   Read the dmsetup man page for more information.

