Blame src/perfctr-2.6.x/INSTALL

Packit 577717
$Id: INSTALL,v 1.19.2.3 2009/01/23 18:37:41 mikpe Exp $
Packit 577717
Packit 577717
		    INSTALLATION INSTRUCTIONS
Packit 577717
		    =========================
Packit 577717
Packit 577717
KERNEL
Packit 577717
------
Packit 577717
The kernel source code of this package consists of two parts:
Packit 577717
the driver proper, and patches to integrate it into various
Packit 577717
versions of the kernel.
Packit 577717
Packit 577717
The recommended kernel build and installation procedure is as follows:
Packit 577717
Packit 577717
0. Get the source code for a supported Linux kernel version.
Packit 577717
Packit 577717
   Let PDIR be the root directory of the unpacked perfctr package.
Packit 577717
Packit 577717
   A given kernel version, KVER say, is supported if and only if one
Packit 577717
   of the following statements is true:
Packit 577717
Packit 577717
   a) $PDIR/patches/ contains a file "patch-kernel-$KVER"
Packit 577717
   b) $PDIR/patches/aliases contains a line starting with $KVER
Packit 577717
Packit 577717
   Supported kernels include many standard www.kernel.org kernels and
Packit 577717
   some RedHat kernels. RedHat kernels are identified by the "-redhat"
Packit 577717
   suffix appended to their kernel versions.
Packit 577717
Packit 577717
   ** Any kernel version which fails the above test is by definition
Packit 577717
   ** UNSUPPORTED.
Packit 577717
Packit 577717
   ** RedHat users: Please note that RedHat kernels are extensively
Packit 577717
   ** modified compared to their baseline standard kernels, and that
Packit 577717
   ** patches for standard kernels often do NOT work for RedHat kernels
Packit 577717
   ** even if the version numbers are similar. If your current kernel
Packit 577717
   ** is unsupported, then upgrading to a newer RedHat "update" kernel
Packit 577717
   ** may be required.
Packit 577717
Packit 577717
1. Unpack the kernel source code. Let KDIR be its root directory.
Packit 577717
Packit 577717
   In your shell, `cd' to $KDIR.
Packit 577717
Packit 577717
   Save a copy of the .config file if it exists and you need it later.
Packit 577717
   Then `make mrproper' (this is VERY important).
Packit 577717
Packit 577717
2. Apply all patches for all add-on features you want in this kernel.
Packit 577717
Packit 577717
   With the current directory being $KDIR, execute:
Packit 577717
Packit 577717
	$PDIR/update-kernel
Packit 577717
Packit 577717
   This will apply the patch file that matches the kernel version,
Packit 577717
   and install the new files for the perfctr driver.
Packit 577717
Packit 577717
   If update-kernel does not find a matching patch file, it will fail
Packit 577717
   with an error message. If you insist on using an unsupported kernel
Packit 577717
   version V1, but you believe the patch file for version V2 will work,
Packit 577717
   then you can try it as follows:
Packit 577717
Packit 577717
	$PDIR/update-kernel --test --patch=$V2
Packit 577717
Packit 577717
   This applies the patch in testing mode, without actually altering
Packit 577717
   any files. If the patch applies cleanly without any rejects or large
Packit 577717
   offsets, then you can force the use of this patch simply by removing
Packit 577717
   the --test option to update-kernel. This usage mode is intended for
Packit 577717
   experienced kernel builders only.
Packit 577717
Packit 577717
   Finally, edit $KDIR/Makefile and change EXTRAVERSION to include
Packit 577717
   something unique for THIS kernel, for example by appending "-perfctr"
Packit 577717
   (without the quotes). While not strictly necessary, this step is
Packit 577717
   strongly recommended if you are adding the perfctr driver to
Packit 577717
   a kernel version which is already installed on the machine.
Packit 577717
Packit 577717
3. If you have a saved .config file, copy it to $KDIR.
Packit 577717
   Then configure the kernel using your favorite kernel configuration tool,
Packit 577717
   for instance `make menuconfig', `make config', or `make oldconfig'.
Packit 577717
Packit 577717
   You should either configure with modules (CONFIG_MODULES=y) AND module
Packit 577717
   versions (CONFIG_MODVERSIONS=y), or completely without modules
Packit 577717
   (CONFIG_MODULES=n). Modules without module versions is an inherently
Packit 577717
   unsafe configuration which is not recommended.
Packit 577717
Packit 577717
   You should also enable at least CONFIG_PERFCTR, CONFIG_PERFCTR_VIRTUAL,
Packit 577717
   and CONFIG_PERFCTR_GLOBAL.
Packit 577717
Packit 577717
   You may also select CONFIG_PERFCTR=m to build the bulk of the driver
Packit 577717
   as a loadable kernel module; the module will be named `perfctr'.
Packit 577717
Packit 577717
   Note: The perfctr kernel patch adds one word to the `thread_struct'
Packit 577717
   type, which makes the patched kernel binary incompatible with an
Packit 577717
   unpatched one. This is why it is important to distinguish the patched
Packit 577717
   kernel via EXTRAVERSION and CONFIG_MODVERSIONS.
Packit 577717
Packit 577717
4. `make dep vmlinux modules'. This compiles the kernel and its modules.
Packit 577717
Packit 577717
5. As root, `make modules_install' to install the modules under /lib/modules/.
Packit 577717
Packit 577717
6. As root, edit /etc/lilo.conf to include a new entry for the new kernel.
Packit 577717
   Copy an existing entry and edit the image= and label= lines to reflect
Packit 577717
   the new kernel's name, including whatever you put in EXTRAVERSION.
Packit 577717
   Then `make install' to install the new kernel's boot image and update
Packit 577717
   the boot loader.
Packit 577717
Packit 577717
   Non-LILO users will have to adapt this step to whatever boot method
Packit 577717
   they are using.
Packit 577717
Packit 577717
7. Reboot the machine.
Packit 577717
Packit 577717
Packit 577717
DEVICE FILE
Packit 577717
-----------
Packit 577717
The kernel-side of this package is implemented as a character device
Packit 577717
driver, which has been assigned /dev/perfctr with major number 10 and
Packit 577717
minor number 182. This device file must exist in order for user-space
Packit 577717
to be able to access the perfctr extensions. How the device file is
Packit 577717
created depends on whether /dev/ is static or dynamic.
Packit 577717
Packit 577717
Dynamic /dev (udev)
Packit 577717
-------------------
Packit 577717
These instructions are known to work on Fedora Core 4, but may need
Packit 577717
adjustments for other Linux distributions. As root, execute:
Packit 577717
Packit 577717
	cp etc/perfctr.rules /etc/udev/rules.d/99-perfctr.rules
Packit 577717
	cp etc/perfctr.rc /etc/rc.d/init.d/perfctr
Packit 577717
	chmod 755 /etc/rc.d/init.d/perfctr
Packit 577717
	/sbin/chkconfig --add perfctr
Packit 577717
Packit 577717
The first step adds a udev rule so that when the perfctr driver is
Packit 577717
loaded into the kernel, udev will create /dev/perfctr with permissions
Packit 577717
that allows all users to access it.
Packit 577717
Packit 577717
The following steps add a startup script which creates /dev/perfctr
Packit 577717
if the driver module is not yet loaded into the kernel. This enables
Packit 577717
the kernel to automatically load the perfctr module the first time the
Packit 577717
device file is opened.
Packit 577717
Packit 577717
Static /dev (no udev)
Packit 577717
---------------------
Packit 577717
The first time you install the package, a special file representing
Packit 577717
this device must be created. As root, execute:
Packit 577717
Packit 577717
	mknod /dev/perfctr c 10 182
Packit 577717
	chmod 644 /dev/perfctr
Packit 577717
Packit 577717
If the driver was built as a module, it will be have to be loaded
Packit 577717
into the kernel before it can be used. This will happen automatically
Packit 577717
if the kernel was built with support for the kernel module loader
Packit 577717
(CONFIG_KMOD=y).
Packit 577717
Packit 577717
Packit 577717
LIBRARY
Packit 577717
-------
Packit 577717
To build the user-space library and the example programs, simply run
Packit 577717
Packit 577717
	make
Packit 577717
Packit 577717
The source code directory of the patched kernel you built and installed
Packit 577717
above does not have to be available when you build the library.
Packit 577717
Packit 577717
To install the user-space library, the include files, and the 'perfex'
Packit 577717
application program, run
Packit 577717
Packit 577717
	make PREFIX=$PREFIX install
Packit 577717
Packit 577717
This will install binaries in $PREFIX/bin, libraries in $PREFIX/lib,
Packit 577717
and include files in $PREFIX/include. Each of these destinations can
Packit 577717
also be overridden individually:
Packit 577717
Packit 577717
	make BINDIR=$BINDIR LIBDIR=$LIBDIR INCLDIR=$INCLDIR install