3. Configuring the software

3.1. Plug and Play

If you have a Plug and Play device, it will know how to talk to the driver which will tell its IRQ, DMA, etc... So you don't need to know about them. That's cool.

Easy case: the driver for you device is included in the kernel distribution. The magic word is:
#modconf
Browse through the menus until you find the right module, then press enter and say 'Yes' when asked if you want the modules loaded in the kernel.

Medium case: you need to recompile your kernel. Usually that's because you're not using a standard kernel, or because your hardware is a bit too 'exotic'. You need to recompile your kernel (no big deal, usually). Since we at Newbiedoc think things ahead, there is a Kernel Compiling Doc.

Patching a kernel: sometimes patches are available that modify your kernel source. To apply a patch:
cd /usr/src/kernel-source-xx.yy.zz
	      cat my_patch | patch -p0
(CHECK!! I can't seem to remember if it's -p0 or -p1 , but try the other if one doesn't work :-)

Hard case: You got the driver from elsewhere. Don't worry, it's not that bad. You need first to compile it, then to try and load it, and then have it done automatically at boot-time. Next section is for you ( feel privileged huh ?)

3.1.1. Compiling a driver

For those whose driver is not included in the standard kernel

The standard way is to uncompress the source somewhere:
 tar zxvf driver-src.tgz
Then run the 'configure' script:
cd unpacked_source_directory
./configure
If there is no 'configure' script, don't worry. It happens.
make
will compile the driver, leaving you with a file named, say, my_new_driver.o.
#make install
should be done as root and will install the driver where it should be installed. Check /lib/modules/kernel_version/wherever/my_new_driver.o

OK, so now the driver is compiled and ready for testing.

Now, I'll assume you are root, so I'll prefix all commands with a '#'.

#modprobe my_new_driver
will try to load your new module. It might need arguments, consult the README and see below the section about passing options to a module. To test if the module was correctly loaded:
#lsmod
will list all loaded modules. And to remove a module:
#rmmod my_new_driver

3.2. non Plug and Play

Since the driver can't read IRQ DMA (etc) values from the board, that means you'll have to tell it at load-time.

Aside from that, it's the same as for PnP devices, so refer to what I wrote above. You'll need to add info either when using 'modconf', when compiling the kernel, or when loading the driver 'by hand'.

3.3. Passing Options to a module

3.3.1. at loadtime

Usually you need at least to tell the module the IRQ of the device it's talking to, and possibly some other stuff. This should load a good ol'SoundBlaster:
#insmod sb irq=7 io=0x220 dma=1 dma16=6
Note that we use insmod, which is more 'low-level' than modprobe.

Check if the insmod succeeded by doing
#lsmod
Note: there are dependencies for modules, so a module may request that others are loaded, and will load them by itself if they are available.

3.3.2. automatically

There are two ways for modules to be loaded:

  1. If they are needed by another module, or by a program (such as X).

  2. If they appear in /etc/modules

To automatically load a module, just write its name in the file /etc/modules , without any options or path, just the name (such a 'sb','ne2k-pci','vfat', etc...)

So where do I put the options ? Add a file to the /etc/modutils (the name doesn't matter). The syntax would then be:
options sb irq 7 io 0x220 dma 1 dma16 5
Sometimes, for exterior modules, the kernel needs to be able to link a module to a device:
alias char-major-195 NVdriver
This says that devices 195.* are to be managed by the NVdriver module.

When all is done, do as root:
#update-modules
which will concatenate all the files in the /etc/modutils directory (including subdirs) and store that in /etc/modules.conf which can be read by modprobe.

3.4. Summary

OK so to sum up: