
Installing Linux-GPIB kernel space
--------------------------------------------------------------------

A) First steps:
---------------

o) Installing your Hardware:

	If you have an old ISA board it may need to be configured by
	setting the appropriate board jumpers or switches for its
	base-address, interrupt-level (IRQ) and dma-request channel
	(DMA).  Please choose a free base-address, irq and dma for
	your system (refer to your hardware documentation for
	this). You can "cat" /proc/interrupts, /proc/dma,
	/proc/ioports, and /proc/iomem to get information on
	interrupt, dma lines, io ports, and io memory already in use
	by other drivers. Now shut down your system and install the
	board in your computer.

o) Unpacking the Software:
	Unpack the archives with the 'tar' program, for example
	'tar -xzf linux-gpib-kernel-4.2.0.tar.gz'.

	You will also need the linux kernel source code, or a
	reasonable approximation thereof, which the linux-gpib package
	reads for header files and compilation variables when
	compiling the gpib kernel modules.  Ideally, you have the
	linux source your current kernel was compiled from, or are
	willing to compile a fresh kernel.  Otherwise, your
	distribution may provide a useable setup you can compile
	against (usually pointed at by a symbolic link at
	/lib/modules/<kernel_version>/build).  For example, on Debian
	Sarge you can install the kernel-headers package which matches
	the kernel you are running and all should be well.

	You could also prepare a kernel source tree that matches
	the kernel you are currently running if you have its config file (in
	the Debian distibution the config files for the kernel-image packages
	are in the /boot directory).  Perform the following steps:

	1) Get a copy of the kernel source that matches the kernel you
	   are running.  Unpack it and copy your kernel config file to
	   '.config' in the top directory of your kernel source.
	   Note: you will need to have write permission to your kernel
	   source directory when compiling linux-gpib, so it might be
	   easiest to unpack the kernel source into a user-owned
	   directory.

	2) You might need to edit the file 'Makefile' in the kernel
	   source.  At the top of the Makefile, the variable
	   EXTRAVERSION is defined.  If necessary, change it to match
	   your kernel (for example, if the command 'uname -r'
	   produces "2.6.8-1-386" then your EXTRAVERSION should be set
	   as 'EXTRAVERSION=-1-386'.

        3) run 'make oldconfig' in your kernel source directory.  

        4) run 'make vmlinux' and 'make modules' in the kernel source
	   directory.  This will compile the Linux kernel and modules
	   (and take a long time).  You can probably get by with just
	   doing a 'make modules_prepare' instead, and your GPIB
	   driver modules should still work.  However, the GPIB
	   modules will taint your kernel when loaded.  Tainting is a
	   flag to kernel developers that something fishy has been
	   done, and they tend to ignore bug reports from tainted
	   kernels.

B) Installing Linux-GPIB
-------------------------

o) cd to your linux-gpib-kernel directory and run the './configure' script.
	run './configure --help' for a list of the possible options.
	In particular, the '--with-linux-srcdir' option is useful for
	specifying the location of your Linux kernel source directory,
	and the '--enable-pcmcia' option is useful for laptops. If you
	have an ISA based card you will need to use the
	'--enable-isa' option unless you have a kernel version >=
	3.12.0 with CONFIG_ISA set.

	If the configure script does not exist (you are using a svn
	checkout), it can be generated by running the './bootstrap'
	script.  You will need automake, autoconf, etc. to generate
	the configure script.

	Type 'make'.  Now the Package will be compiled.  Note, you
	will need to use the same version of gcc to compile the
	linux-gpib kernel modules as was used to compile your kernel.
	Using different versions has been known to cause problems
	(kernel panics, crashes, etc.).  Linux-gpib will compile its
	kernel modules with the compiler specified by the kernel's
	Makefile (the CC variable).

	Type 'make install' (as root).  This will copy the kernel
	drivers to /lib/modules/<kernel version>/gpib.

C) Loading the driver modules
-----------------------------


o) PCI and ISA boards

	You can load the driver module by typing

		modprobe <driver name>

	See the documentation in linux-gpib-user-x.x.x/doc/ to see
	which driver your board is supported by.

        You need to run the 'gpib_config' utility to setup the driver
	before you can use it (the 'minor' options specifies which
	board index you are setting up):

		gpib_config --minor 0

        In most modern systems the modprobe utility, which is run at
        boot-up, will automatically ensure that the appropriate
        modules are loaded when the boards/adaptors are plugged in.
	'sudo modprobe -c' will show the list of modules it has detected.

  	You can also set up the modules to load automatically by adding lines
	something like 

	alias char-major-160 gpib_common
	alias gpib0 tnt4882
	install tnt4882 PATH=/sbin:/usr/sbin:/usr/local/sbin:$PATH;modprobe --ignore-install tnt4882;gpib_config --minor 0

	to /etc/modprobe.conf, which would autoload the tnt4882.o
	module and run gpib_config when the library is used.  In the
	Debian distribution, modprobe.conf is modified by adding a
	file to the /etc/modprobe.d directory, and then running
	'update-modules'.

o) For PCMCIA and USB adaptors see the linux-gpib-usr-x.x.x/INSTALL file.

