$Id: INSTALL,v 1.20 2005/04/08 10:21:16 mikpe Exp $
INSTALLATION INSTRUCTIONS
=========================
KERNEL
------
The kernel source code of this package consists of two parts:
the driver proper, and patches to integrate it into various
versions of the kernel.
The recommended kernel build and installation procedure is as follows:
0. Get the source code for a supported Linux kernel version.
Let PDIR be the root directory of the unpacked perfctr package.
A given kernel version, KVER say, is supported if and only if one
of the following statements is true:
a) $PDIR/patches/ contains a file "patch-kernel-$KVER"
b) $PDIR/patches/aliases contains a line starting with $KVER
Supported kernels include many standard www.kernel.org kernels and
some RedHat kernels. RedHat kernels are identified by the "-redhat"
suffix appended to their kernel versions.
** Any kernel version which fails the above test is by definition
** UNSUPPORTED.
** RedHat users: Please note that RedHat kernels are extensively
** modified compared to their baseline standard kernels, and that
** patches for standard kernels often do NOT work for RedHat kernels
** even if the version numbers are similar. If your current kernel
** is unsupported, then upgrading to a newer RedHat "update" kernel
** may be required.
1. Unpack the kernel source code. Let KDIR be its root directory.
In your shell, `cd' to $KDIR.
Save a copy of the .config file if it exists and you need it later.
Then `make mrproper' (this is VERY important).
2. Apply all patches for all add-on features you want in this kernel.
With the current directory being $KDIR, execute:
$PDIR/update-kernel
This will apply the patch file that matches the kernel version,
and install the new files for the perfctr driver.
If update-kernel does not find a matching patch file, it will fail
with an error message. If you insist on using an unsupported kernel
version V1, but you believe the patch file for version V2 will work,
then you can try it as follows:
$PDIR/update-kernel --test --patch=$V2
This applies the patch in testing mode, without actually altering
any files. If the patch applies cleanly without any rejects or large
offsets, then you can force the use of this patch simply by removing
the --test option to update-kernel. This usage mode is intended for
experienced kernel builders only.
Finally, edit $KDIR/Makefile and change EXTRAVERSION to include
something unique for THIS kernel, for example by appending "-perfctr"
(without the quotes). While not strictly necessary, this step is
strongly recommended if you are adding the perfctr driver to
a kernel version which is already installed on the machine.
3. If you have a saved .config file, copy it to $KDIR.
Then configure the kernel using your favorite kernel configuration tool,
for instance `make menuconfig', `make config', or `make oldconfig'.
You should either configure with modules (CONFIG_MODULES=y) AND module
versions (CONFIG_MODVERSIONS=y), or completely without modules
(CONFIG_MODULES=n). Modules without module versions is an inherently
unsafe configuration which is not recommended.
You should also enable at least CONFIG_PERFCTR, CONFIG_PERFCTR_VIRTUAL,
and CONFIG_PERFCTR_GLOBAL.
You may also select CONFIG_PERFCTR=m to build the bulk of the driver
as a loadable kernel module; the module will be named `perfctr'.
Note: The perfctr kernel patch adds one word to the `thread_struct'
type, which makes the patched kernel binary incompatible with an
unpatched one. This is why it is important to distinguish the patched
kernel via EXTRAVERSION and CONFIG_MODVERSIONS.
4. `make dep vmlinux modules'. This compiles the kernel and its modules.
5. As root, `make modules_install' to install the modules under /lib/modules/.
6. As root, edit /etc/lilo.conf to include a new entry for the new kernel.
Copy an existing entry and edit the image= and label= lines to reflect
the new kernel's name, including whatever you put in EXTRAVERSION.
Then `make install' to install the new kernel's boot image and update
the boot loader.
Non-LILO users will have to adapt this step to whatever boot method
they are using.
7. Reboot the machine.
LIBRARY
-------
To build the user-space library and the example programs, simply run
make
The source code directory of the patched kernel you built and installed
above does not have to be available when you build the library.
To install the user-space library, the include files, and the 'perfex'
application program, run
make PREFIX=$PREFIX install
This will install binaries in $PREFIX/bin, libraries in $PREFIX/lib,
and include files in $PREFIX/include. Each of these destinations can
also be overridden individually:
make BINDIR=$BINDIR LIBDIR=$LIBDIR INCLDIR=$INCLDIR install