imm
to autoloadIf you want to get a module to autoload when a device is accessed
you can often add a file to
/etc/modutils
and run
update-modules
to generate
/etc/modules.conf
.
When the kernel receives a request to open a device file that it does
not have capabilities for it issues a request to
modprobe
for the module `char-major-n' or `block-major-n'
depending on whether the device is a character or block device, and
the device's major number, n. For example, my sound devices have major
number 14, and my sound module is
emu10k1
so added the
alias below to my
/etc/modutils
directory.
$ ls -l /dev/dsp
crw-rw---- 1 root audio 14, 3 Jul 5 2000 /dev/dsp
$ cat /etc/modutils/sound
alias char-major-14 emu10k1
imm
failedI added the file below to
/etc/modutils
, but try as I might, it just
would not let
imm
autoload.
$ cat /etc/modutils/zip
alias block-major-8 imm
After an hour or so of browsing the kernel source I discovered the reason: When a device file is opened the kernel checks to see if the driver associated with that device is registered. If not, it asks modprobe to load it as a module. The kernel registers new device drivers either on boot if they are compiled in, or when the relevant module is loaded. It remembers that they are registered, and won't try to register them again.
If the SCSI subsystem is compiled into the kernel it will be
registered at boot. Requests to open
/dev/sda1
, say, will
therefore not trigger registration again. In this situation modprobe
never gets asked for char-major-8, and therefore never loads
imm
.
The solution that I found was to compile both
scsi_mod.o
(CONFIG_SCSI) and
sd_mod.o
(CONFIG_BLK_DEV_SD) as modules.
This introduces a second problem:
depmod
does not know
that
imm
needs
sd_mod.o
. The second line in the file
below sorts that out.
$ cat /etc/modutils/zip
alias block-major-8 imm
below imm sd_mod
Don't forget to run
update-modules
to generate
/etc/modules.conf
.
The kernel source. I can't remember which files I found the information in. I should have noted it down. If I find it again I'll put it here.
If you still can't get
imm
to autoload, then mail me for some
extra help.