
ident $Id: README,v 1.8 2004/12/27 11:45:15 raven Exp $

This README describes the purpose of this kit and how to use it.

Ghosting
========

Ghosting of map directories allows you to see the directories in the
autofs map without mounting them. When they are accessed, such as when
a directory listing is requested the map entry is mounted so that it
is seen.

This feature has been implemented for file, nis and ldap maps.

For it to work an updated autofs4 kernel module is needed.

There are two ways to update the kernel module. One is to apply a
patch to your kernel source tree as described below. If you wish to
compile autofs4 into the kernel then you must use this method. It is
also possible to build and install an autofs4 module, that matches
your kernel without also building a new kernel. Unfortuneatly,
rebuilding your kernel cannot be avoided entirely. A mandatory kernel
patch is needed for the module to work properly. Once this is applied
and your kernel built and installed updates can be buildtand installed
without subsequent kernel builds. In order to build the module you
must have the kernel headers for your running kernel installed.


Compile a Kernel Module Seperately
==================================

You must have a tree of kernel header files that match the running
kernel to use this method. Your kernel must have the namei-mandatory
and, if your architecture needs it, the compat-ioctl and the
auto_fs4.h patches previously applied to your kernel. These patches
are located in the kernel-patches directory,

The required header files will be available as a package in most,
if not all distributions. For example in RedHat the kernel-source
package has the header files that correspond to the kernel package.
In Debian there is a kernel-headers package which has the headers
for the corresponding kernel-image package. Of course if you need
add the patches refered to above you will need the kernel-source
package instead of just the headers package.

If you have compiled and installed a kernel then you have a
matching set of header files.

Now.

Edit Makefile.conf and set the KERNELDIR to point to the base
directory of your kernel source tree.

eg.

KERNELDIR = /usr/src/linux-2.4.20-27.9

Next, if you are running a RedHat packaged kernel for RedHat 9 or above 
then you need to set the REDHAT9 macro to yes because some of the patches
that RedHat apply change some internal data structures as well as some
Makefiles.

eg.

REDHAT9 = yes

Now.

make
make install

and you are done.

To revert to the original module (if there was one).

make uninstall

should do it.


Applying the Kernel Patches
===========================

Patches that can be applied to the autofs4 kernel module are located
in the module-patches directory. A mandatory kernel patch is also
needed for kernel 2.4.26 and below. They consist of one for kernel
version 2.4.18 and below, one for kernel version 2.4.19 and above,
2.4.22 and above as well as patches for RedHat 9 and Fedora Core 1 kernels.
Kernel 2.4.27 has the mandatory and documentation patch included and so
those patches are not needed.

The patch naming convention is autofs4-2.4.nn<-distro-variant>.patch.
For example the 2.4.20 patch is named autofs4-2.4.20.patch and the
Fedora Core 1 patch is named autofs4-2.4.22-fc1.patch.

To apply the patches:

1) change to the root of your kernel source tree.
2) save a copy of include/linux/auto_fs* fs/autofs4/*
3) apply the mandatory patch from kernel-patches directory
4) apply the optional patch from the same directory if you wish
5) apply the autofs4 update patch from the module-pathes directory
6) make the kernel

If you are compiling autofs4 into the kernel (and you don't use a
modular kernel) you now install the kernel as normal and you're done.

If you are using autofs4 as a module and your kernel has the mandatory
patch already then you can:

7) make modules
8) save a copy of /lib/modules/<kernel version>/kernel/fs/autofs4/autofs4.o
9) copy the updated kernel module.

Otherwise you need to:

7) make and install your modules

But using the build kit as above is easier once the mandatory
patch is added to you kernel.

Like this:

cd <source_tree_base_dir> 
tar cf <backup_tar_file> include/linux/auto_fs* fs/autofs4/*
patch -p1 < <autofs4-2.4-module path>/kernel-patches/autofs4<kernel version>-namei-mandatory.patch
patch -p1 < <autofs4-2.4-module path>/kernel-patches/autofs4<kernel version>-doco-optional.patch
#
# If your archcitecture has a 32 bit <-> 64 bit compatibility requirement you need this patch.
patch -p1 < <autofs4-2.4-module path>/kernel-patches/autofs4<kernel version>-compat-ioctl.patch
patch -p1 < <autofs4-2.4-module path>/module-patches/autofs4-<kernel version>.patch
make modules

Then:

cp /lib/modules/<kernel version>/kernel/fs/autofs4/autofs4.o <backup_location>
cp fs/autofs4/autofs4.o /lib/modules/<kernel version>/kernel/fs/autofs4

Or if you are building the kernel from scratch:

make modules_install

To revert to the original module (if there was one) simple copy the
original autofs4.o to its proper location in the module tree from the
backup copy you made.

Make sure autofs is not running and remove your current autofs4 module
(rmmod autofs4) if it is in use before starting autofs to get the new
one.

