NetBSD-5.0.2/external/gpl2/libdevmapper/dist/INSTALL

Device Mapper Installation
==========================

1) Generate custom makefiles.

   Run the 'configure' script from the top directory.

   Example:
   ./configure

   2.6 kernels now already contain basic device-mapper patches.

   If you are using a 2.4 kernel that does NOT contain the device-mapper
   mapper source AND you want to try patching it automatically (described 
   in step 2) then you need to tell 'configure' where your kernel 
   source directory is using --with-kernel-dir.  Otherwise, don't
   supply this parameter or you may get compilation failures.

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


   The same userspace library and tools work with both 2.4 and 2.6 kernels
   because they share the same device-mapper interface (version 4).
   If you also still need backwards-compatibility with the obsolete
   version 1 interface, then you must compile against 2.4 kernel 
   headers (not 2.6 ones) and:

   ./configure --enable-compat

   Other parameters let you change the installation & working directories.


2) ONLY FOR 2.4 KERNELS:

   If your kernel does not already contain device-mapper, patch,
   configure and build a new kernel with it.

   If there is a patch for your kernel included in this package and you
   gave 'configure' appropriate parameters in step 1, you can run 
   'make apply-patches' from the top directory to apply the patches.  
   (This also attempts to apply the VFS lock patch, which will fail if 
   you've already applied it.  For 2.4.21 there's a choice of two VFS lock
   patches: the experimental one is destined to replace the old-style one.
   The VFS lock patch is designed to suspend the filesystem whenever
   snapshots are created so that they contain a consistent filsystem.)
   
   Configure, build and install your kernel in the normal way, selecting
   'Device mapper support' from the 'Multiple devices driver support' menu.
   If you wish to use 'pvmove' you also need to select 
   'Mirror (RAID-1) support'.

   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 at end.)

   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) You can now use 'dmsetup' to test the API.
   Read the dmsetup man page for more information.
   Or proceed to install the LVM2 tools.


Note if you are upgrading from a very old release
=================================================
   /dev/mapper was called /dev/device-mapper prior to 0.96.04.
   Consequently scripts/devmap_mknod.sh has been updated,
   but this script is now obsolete because its functionality has
   been incorporated into the library.


Notes about the alternative device-mapper filesystem interface
==============================================================
The original 2.4 "dmfs" filesystem interface which mapped
device-mapper operations into filesystem operations has been
abandoned.  It requires a very old kernel and is missing lots of
features.  The userspace code (lib/fs in CVS) was finally
removed from the tree in 1.02.23.