# Why compile necessesary drivers as modules? [solved]

## MalleRIM

Hi,

Short question:

All the ALSA-guides (gentoo.org/doc, gentoo-wiki.com) tell you to install the soundcard drivers as modules. Is there any reason to do so?

MalleLast edited by MalleRIM on Fri Dec 14, 2007 7:06 pm; edited 1 time in total

----------

## BradN

No real reason that I know of... probably the only thing it would make easier is setting the order of the ALSA devices.  Otherwise I always just compile the driver into the kernel and forget about it.

----------

## PaulBredbury

The reasons are:

 * Have the flexibility to use alsa-driver "cvs" (actually Mercurial) code.

 * Can use the alsa initscript, which does some good checks, and loads asound.state

 * /etc/modprobe.conf options take effect, as opposed to not taking effect and confusing newbies

----------

## MalleRIM

Thanks for your answers  :Wink: 

I'll try compiling everything into the kernel to have it all in one file.

----------

## BradN

 *PaulBredbury wrote:*   

> The reasons are:
> 
>  * Have the flexibility to use alsa-driver "cvs" (actually Mercurial) code.
> 
>  * Can use the alsa initscript, which does some good checks, and loads asound.state
> ...

 

I agree with the first point, but the alsa initscript works fine with drivers compiled in the kernel, and you can still pass options to the drivers on the kernel command line (although yes, this can be more confusing since it's done like driver.option=value)

----------

## MalleRIM

 *BradN wrote:*   

> the alsa initscript works fine with drivers compiled in the kernel, and you can still pass options to the drivers on the kernel command line (although yes, this can be more confusing since it's done like driver.option=value)

 

Is there a documentation for this?

----------

## BradN

from the top of /usr/src/linux/Documentation/kernel-parameters.txt:

 *Quote:*   

> Module parameters for loadable modules are specified only as the
> 
> parameter name with optional '=' and value as appropriate, such as:
> 
>         modprobe usbcore blinkenlights=1
> ...

 

It took me forever to figure this out when I first needed to do it...

----------

## MalleRIM

Thanks for that  :Smile: 

----------

## ofathi

I used to prefer compiling all in-kernel but now I do prefer compiling some stuff as modules as it eases trouble-shooting (especially sound / network / video.... especially when you prefer to use ex kernel stuff   :Smile: 

----------

## timeBandit

 *ofathi wrote:*   

> I used to prefer compiling all in-kernel but now I do prefer compiling some stuff as modules as it eases trouble-shooting (especially sound / network / video.... especially when you prefer to use ex kernel stuff  

 ++. Using modular drivers for all non-critical hardware (which means almost everything except disks and filesystems) avoids needless reboots when fiddling with hardware and/or updating drivers. Many hardware problems that require a "reboot" can in fact be fixed by reloading relevant modules.

----------

## Spidey

 *timeBandit wrote:*   

>  *ofathi wrote:*   I used to prefer compiling all in-kernel but now I do prefer compiling some stuff as modules as it eases trouble-shooting (especially sound / network / video.... especially when you prefer to use ex kernel stuff   ++. Using modular drivers for all non-critical hardware (which means almost everything except disks and filesystems) avoids needless reboots when fiddling with hardware and/or updating drivers. Many hardware problems that require a "reboot" can in fact be fixed by reloading relevant modules.

 

Now that's a GREAT argument for this discussion. I always had that doubt, now I'm satisfied.

So, the question is, since we all have 209832190830291 hardware devices, how do I know exactly what modules to load at boot time?

I mean, emerged userspace drivers as alsa and nvidia-drivers are naturally added to /etc/modules.autoload.d/kernel-2.6, but how can I find out the modules names to autoload when using kernel modules?

----------

## ofathi

not sure if you'd really have such a large amount of modules unless you try to compile almost everything as a module... 

In this topic the question is limited to hardware 

    -> network card / soundcard (and alsa all together) / wifi / bluetooth / graphics card / webcam ...

I wouldn't go as far as trying to compile ipv4 & Co or fs support as modules

Udev should take care of some of the autoloading and also the in-kernel option to auto-load modules

http://en.wikipedia.org/wiki/Udev

----------

## Bones McCracker

 *timeBandit wrote:*   

>  *ofathi wrote:*   I used to prefer compiling all in-kernel but now I do prefer compiling some stuff as modules as it eases trouble-shooting (especially sound / network / video.... especially when you prefer to use ex kernel stuff   ++. Using modular drivers for all non-critical hardware (which means almost everything except disks and filesystems) avoids needless reboots when fiddling with hardware and/or updating drivers. Many hardware problems that require a "reboot" can in fact be fixed by reloading relevant modules.

 

A related factor to consider is that modular hardware -> modular software.

Having drivers as kernel modules makes it convenient for you to change modular hardware components such as HIDs, NICs, GPUs, sound cards, etc.  It makes less sense for on-board (motherboard chipset-based) components.

----------

