Click to See Complete Forum and Search --> : Automatic module loading


Strogian
10-28-2001, 05:47 PM
Alright, I just got to setting up my modules.conf file to kmod (kernel module loader), and I have a question. I noticed that there are some groups of devices with the same major device numbers, but which would require different modules. So, will I need to set up my modules.conf file to load all the modules possible for that major device number, whenever one of those devices is used? And if so, (or if not) how would I do it? :)

DMR
10-28-2001, 08:17 PM
Which devices in particular are you referring to?

Strogian
10-28-2001, 09:20 PM
Well, in the /dev/input directory, there are several different devices (joysticks, for example) with the same major number. And even for joysticks, there can be both USB and gameport joysticks, so there's gonna be a lot of modules loading for them, unless there's some other way of doing it. :)

bdg1983
10-29-2001, 06:39 AM
You only need to load modules for your particular hardware and not for everything that's listed in /dev.

Does 'lsmod' show modules loaded for most if not all of your hardware?

Strogian
10-29-2001, 07:43 AM
I don't load any modules when I boot up. I'm gonna let Kmod take care of that, but I need to set up a modules.conf file for it to work. I don't even remember what is in /dev/input, but even if I didn't need anything in there, I'd still rather know how to do it, instead of knowing why I shouldn't have to do it. :)

Lorithar
10-29-2001, 02:34 PM
if you have the usb extensions properly built including the event interface, the modules will load when the device is detected... Once I got the USB on my mobo to work it has autodected everything ever plugged into it... including several things for which I didn't have modules.. (For which it dumped an error /var/log/messages...)

Strogian
10-29-2001, 04:45 PM
Not everything is for USB, though. (e.g. the gameport joystick)

Lorithar
10-29-2001, 11:18 PM
Okay .. .rereading the whole post...

a) You cannot load a module for which there is no physically attached device.
-- that is if you try to load it the load will fail as it cannot communicate with the device on the other end.

b) in a default build there are *thousands* of devices created in /dev/.
You will not ever use *all* of them ... however .. if you have many units of one type, the module need only load ONCE for each type. ......
/etc/modules.conf file is to manage the devices you DO have.
sometimes you need to point logical things to physical things (sound-service-x-x below)
sometimes you want to make sure that something loads with correct parameters.. (options sb io= ....below)
sometimes you want to just tell the system that something doesn't exist at all .. .stop hunting for it you silly git (alias net-pf-4 off below)


To completely deal with every possible event in the future NOW would be nigh unto impossible. ... Deal with what you have now..

(my modules.conf follows)

bash-2.05$ more /etc/modules.conf
alias net-pf-4 off # we won't use PF IPX
alias net-pf-5 off # we won't use PF AppleTalk
pre-install insmod sound dmabuf=1
alias char-major-14 sb
alias sound-slot-0 sb
alias sound-slot-1 sb
alias sound-service-1-0 sb
options opl3 io=0x388
alias midi awe_wave
options sb io=0x220 irq=7 dma=1 dma16=7 mpu_io=0x330
alias char-major-15 adi
alias sound-service-0-6 off
bash-2.05$

Now ... point to be made .. the /dev/input directory is for the USB based versions of devices .. (thus my assumption that you were talking USB) ...

My system still uses the adi.o module for the wingman joystick I have even though the module appears to be built for the gameport ...it just attaches to a different point (/dev/input/js0 instead of /dev/joystick0)

You can, when you build your kernel build everything in sight as a module ... and.. actually I'd reccomend this for someone who is playing and learning .. but NOT in a production online system. Realize that this will result in /lib/modules being HUGE .. and likely will bloat yer kernel as well.. Kmod is pretty damn smart about loading things, and can generally handle 90% of what you need.

More relevant in most*ahem* mycases ('scuze me ... Slackware ...) is /etc/rc.d/rc.modules.. (which may or may not exist in any other computer on the planet.. ) which calls the module loader automatically at system startup.

bdl
10-30-2001, 12:39 AM
You probably want to take a look at http://linux-hotplug.sourceforge.net

Strogian
10-30-2001, 07:53 AM
alias sound-slot-0 sb
alias sound-slot-1 sb
alias sound-service-1-0 sb


Woah..Where did you learn about that kind of stuff? All I've put in there so far is char-major aliases.