Configuring devices with Debian GNU/Linux

Romain Lerallut

  rom1@catsrule.garfield.com
        

Revision History
Revision v0.0116 April 2001Revised by: rml
Started this whole thing.

OK, this is my second try at writing something to help newbies configuring several devices, starting with sound cards.

SGML source for this document is available. This is GPL territory.


Table of Contents
1. Introduction
1.1. Credits
1.2. Feedback
2. Setting up the hardware
2.1. Plug and Play
2.2. non-Plug-and-Play
3. Configuring the software
3.1. Plug and Play
3.2. non Plug and Play
3.3. Passing Options to a module
3.4. Summary
4. Troubleshooting

1. Introduction

A basic Debian installation will usually set up several peripherals, including disks (floppies, IDE and SCSI), networking devices and the screen-related stuff (if you're lucky and your video card is supported).

However, it will usually NOT include many essential devices, such as sound cards, TV cards, and a lot of other exotic boards I don't know about but which I'll help you set up.

Pre-requisites:

Well, I'll try to make it as simple as possible, to explain difficult stuff, and to guide you step by step. So I don't think any special knowledge is required, however, I'll assume you're familiar with Unix concepts such as 'kernel' and 'root' and 'compiling'. But that's all. If you don't feel like that at all, just tell me, and I'll update this paragraph.

As usual, comments, both positive (good for the mood) and negative are welcome. Really.


1.1. Credits

Thanks to the people at the NewbieDoc project.


1.2. Feedback

"Great stuff ! Keep up the good work" -- New York Time

"One of the best docs around" -- Computer Quarterly


2. Setting up the hardware

2.1. Plug and Play

Plug and Play is basically one thing: knowing where, and how to talk to the device. It is not directly related to autodetecting new hardware.

If your hardware is plug-and-play, as is the case with most modern stuff ( all PCI and AGP devices, and a few of the last ISA boards), you may jump directly to the section about software configuration.


2.2. non-Plug-and-Play

Aaaahh. OK. This is for people having some really old hardware.

First thing to do:

Before even plugging in your board: let's check for free IRQ, I/O and DMA channels. Those are the channels that are used to talk to any and each piece of hardware.

cat /proc/interrupts
will list all used IRQ channels

cat /proc/ioports
will list all used I/O ports

I don't know how to list used DMA channels.
cat /proc/dma
shows a ridiculously short list. I have no idea.

Once done, take a look at your board, and the manual that comes with it. There should be jumpers (small removable plastic+metal parts) that you can plug into different places that allow you to physically change the IRQ, DMA, IO port, etc...

Use them to set your device's IRQ DMA and IO port to an unused value.


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:

  • Standard Modules

    1. as root do
      #modconf
      provide the correct options (if needed) and have fun...

  • Non Standard Modules

    1. Compile the driver

    2. Find the correct settings using
      #insmod my_module irq XX dma YY other_option ZZ

    3. Add a file in /etc/modutils containing these settings (if no setting is needed, then no file is required). And run
      #update-modules

    4. Try to load the module with
      #modprobe my_module
      This shouldn't fail if the previous step was correctly done.

    5. If you want (or need), reference your module in /etc/modules.

    6. Have fun...


4. Troubleshooting

I'm a bit tired, so come back later.