3. Configuring the software

You've plugged your board in your computer, and you want Linux to recognize it. You now have to load and configure the driver that will know how to talk to your board.

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

However, if some specific options are needed, or if your board isn't PnP, you'll just have to say to the driver the settings you've defined earlier (IRQ, DMA, for non-PnP), and quite possibly other settings. It depends on your hardware. See Passing Options to a module....

3.1. What kind of driver do you have ?

I'll prefix all commands that need to be run as root with a '#', since that's the default prompt when you login as root.

Easy case: the driver 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.

Tip

if you need to pass arguments to the module, see the syntax below. If not, just press ENTER.

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 if you have the source. You need first to compile it, then to try and load it, and then have it done automatically at boot-time. Section "Compiling a driver" is for you. The problem almost goes away (almost) if the driver's source is packaged as a Debian package, because most of the hard work will be done automatically for you. See Compiling a Debian-packaged module, below.

Evil case: Your driver is precompiled. Usually it is compiled against a given kernel ( say 2.2.15 , 2.2.16, and 2.2.17). In this case, either you run the right kernel, and in that case it should work well. Or you don't run the right kernel, and you have to consider switching kernel, getting a different driver, or getting similar hardware from a more linux-friendly vendor. In all cases, read the docs that comes with the driver since some stuff will be very specific, I can't help you there.

3.2. Compiling a driver

For those whose driver is not included in the standard kernel

3.2.3. Testing the driver

The driver is compiled and ready for testing.

First of all, the dependencies between all modules need to be computed:
depmod
Then load the module:
# modprobe my_new_driver
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

Note

Some modules can't be removed because others depend on them. The names in brackets in an 'lsmod' are the modules dependencies.

3.3. Passing Options to a module...

3.3.2. ...Automatically

Modules can be loaded automatically, see below Automatic Module Loading

So where do I specify the options ? Add a file to the /etc/modutils directory (the name of the file doesn't matter). For the SoundBlaster module we loaded previously, the syntax would then be:
options sb irq 7 io 0x220 dma 1 dma16 5
The kernel also sometimes needs to be able to link a module to an entry in /dev:
alias char-major-195 NVdriver
This says that devices 195.* are to be managed by the NVdriver module. This is usually well documented in the doc that comes with the driver.

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. Do NOT edit modules.conf directly, since it will be overwritten by the next update-modules.

3.4. Automatic Module Loading

There are two ways for modules to be loaded:

  1. If they are needed by another module, or by a program that needs access to a device (graphics board, sound card,...). In that case there's nothing to worry about. The modules know which other fellow modules they need thanks to 'depmod', and the programs actually use /dev/* files, which are linked to corresponding modules by the 'alias' keyword in /etc/modules.conf

  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 as 'sb','ne2k-pci','vfat', etc...)

If arguments are needed, the module will know by itself to look for them in /etc/modules.conf. See paragraph about passing options ...Automatically

3.5. Summary

To summarize: