# What's the proper way to autoload modules?

## ReD-BaRoN

I need my NIC driver to autoload on boot, but I have to be able to specify some options when loading the module.

I have /etc/modprobe.d/, /etc/modules.conf, /etc/modules.d, but from what I've read, I'm supposed to have stuff in /etc/modules.autoload.d/kernel-2.6, but this file doesn't exist.

I've also read that udev is supposed to take care of this, but I don't know how, and would need to know how to pass arguments to the modules upon load.

Thanks!

----------

## radio_flyer

Having just played around with my autoload modules file myself (as an openrc update decided to delete it), the file you're looking for if you're running the openrc baselayout (and I believe everyone does now) is:

 *Quote:*   

> 
> 
> /etc/conf.d/modules
> 
> 

 

The 'modules' init script symlink should also be in the /etc/runlevels/boot directory (openrc should have put it there by default).

The syntax documentation is spotty (I haven't found anything but the rough comments at the top of the default modules file), but my auto-generated file has lines like:

```

modules_2_6="${modules_2_6} NIC"

module_NIC_args_2_6=""

```

where 'NIC' should be replaced by the name of your module, and the appropriate args inserted between the quotes in the args line.

The /etc/modules.autoload.d/ files and stuff went away when Gentoo migrated to baselayout-2 and openrc. The file /etc/modules.conf and directory /etc/modules.d no longer exist in baselayout-2 (in fact you'll get a warning at startup if they exist). /etc/modprobe.d still exists and apparently can also be used to pass options to a module if desired (try 'man modprobe.d').Last edited by radio_flyer on Mon Jul 04, 2011 2:40 am; edited 1 time in total

----------

## ReD-BaRoN

Thanks, radio_flyer, appreciate the response.

The openrc clearing of this file also prompted me to wonder what the right was to do it is.

----------

