Search This Blog

Monday, June 8, 2009

Understanding /etc/modules.conf

Loading modules for the hardware

All modules and settings are controlled in /etc/modules.conf for mandrake and /etc/conf.modules for redhat. Other methods are using the lilo.conf and /boot/grub/menu.lst.

By using the lilo.conf the modules are load as part of the kernel (built in), but the correct way of doing this is using the modules.conf file.

Before I go to the actual configuration, you may want to try some of these commands related to modules:

Commands Description
/sbin/lsmod Lists all configured modules on your system
/sbin/modprobe -l Lists all available modules
/sbin/modprobe -c Lists all configured aliases
/sbin/modprobe -r [module] Removes a loaded module rmmod
/sbin/modprobe [module] Loads a module same as insmod
man modprobe Loads the documentation for modprobe

Note: For all new modules downloaded or compiled must be moved to /lib/modules/[kernel version]/ for the system to be able to use it.

After moving the modules to the appropriate directory, run depmod -a to let the system know about the new module, to test the module run this: modprobe [module name] if the module is loaded without error that means everything is OK. If you get any error messages, that means the module is wrong, or maybe the device is already running with the appropriate driver. Believe me it happens.

Modules loaded in the /etc/modules.conf, are loaded as alias of drivers. For example:

          Alias          Device          Driver
         alias          eth0            8139too 

Many of the modules require further configurations, like I/O addresses and IRQ numbers. The following is an example of a parallel port assigned in the file modules.conf

        alias parport_lowlevel parport_pc
       options parport_pc io=0x378 irq = 7 

It is very easy to identify, io=0x378 and irq = 7, is the address and irq assigned to the first onboard parallel port in your system.

When you install additional hardware in your system, you have to manually edit the modules.conf, unless hard drake allows you to configure it.

Step 2

From the assumption of our next two-port installation we continue…

The modules.conf already contains some information; edit it to add the new information.

This port1 (integrated on the motherboard):

       alias parport_lowlevel parport_pc
      options parport_pc io=0x378 irq=7 

You could just add the parameters required in the same line or create it separately for each port. Combination of the ports 1,2,3:

alias parport_lowlevel parport_pc
options parport_pc io=0x378, 0x6400, 0x6500 irq=7, 5, auto 

As you can see in the io=0x378, 0x6400, 0x6500 are the IO address for each parallel port1, port2 port3. The port2 and port3 belongs to the dual ports B&C.

The IRQs= 7, 5, auto are assigned to the port1, port2 and port3. You can either set the IRQ number manually or set it to get first available IRQ automatically.

As I have already stated, you could also separate the settings as in the following:

Separation of ports by line

       alias parport_lowlevel parport_pc
      options parport_pc io=0x378 irq=7
      alias parport_lowlevel parport_pc
      options parport_pc io=0x6400 irq=5

      alias parport_lowlevel parport_pc
      options parport_pc io=0x6500 irq=auto 

If you exit the editor and save the file, restart the system. The parallel ports lp0, lp1 and lp2 should be enabled now and is ready to use. Other hardware may require special procedures, read the documentations or browse the web for help. You could also load modules or special configuration in other way such as search for it and execute it at boot time, this could be accomplished by creating a bash file. Call it whatever you want, makes it +x executable and add it in /etc/rc.d/ Before you attempt the rc.d, try adding it in /etc/modules this file is used to load from the kernel; as far as the documentation concerns. Note I am not referring to modules.conf, which is in the same directory.


Possible explanation to modules.conf alias

The modules.conf mystery puzzled me. I decided to read the documentation
in the kernel sources. Here's what I found

>From /usr/src/linux/Documentation/modules.txt
Whenever a program wants the kernel to use a feature that is only
available as a loadable module, and if the kernel hasn't got the
module installed yet, the kernel will ask the kerneld daemon to take
care of the situation and make the best of it.

This is what happens:

       - The kernel notices that a feature is requested that is not
         resident in the kernel.
       - The kernel sends a message to kerneld, with a symbolic
         description of the requested feature.
       - The kerneld daemon asks e.g. modprobe to load a module that
         fits this symbolic description.
Here's the important point that I think solves the mystery:
       - modprobe looks into its internal "alias" translation table
         to see if there is a match.  This table can be reconfigured
         and expanded by having "alias" lines in "/etc/modules.conf".

So, as I see it, the ppp aliases *should* already be in modprobe's
internal alias translation table. People with older versions of modutils
might not have it in their modprobe's alias tables, and so would need
the alias lines in /etc/modules.conf .

(NOTE: The following documentation file is a bit old, but it is still
relevant. There is no longer a kerneld daemon, IIRC, but I might be

Important Note was added by
Jan Michael Ibanez
Student, University of Asia & the Pacific

No comments: