autoloading of kernel modules in the udev area ?!

Hans de Goede j.w.r.degoede at hhs.nl
Tue Nov 13 20:20:56 UTC 2007


Bill Nottingham wrote:
> Hans de Goede (j.w.r.degoede at hhs.nl) said: 
>> I'm basing my work on the i2c-tools specfile from Suse (one of the 
>> lm_sensors project lead works for Suse).
>>
>> This specfile contains in %files:
>> %attr(660, root, root) %dev(c, 89, 0) /lib/udev/devices/i2c-0
>>
>> This causes a /dev/i2c-0 char device to be effectively statically created. 
>> If I then also add the proper alias to modprobe.conf.dist, tools like 
>> i2cdump which need the i2c-dev kernel module loaded will automagically 
>> work.
>>
>> Is this ok / the best way todo this. Also I will be adding i2c-0 to i2c-3 
>> then, as there are many cases where there is more then 1 i2c bus (some 
>> motherboards have 2 on the board and many graphics / tv cards have i2c 
>> busses).
> 
> What are the modules that live behind that device?
> 

The module / driver behind it us i2c-dev, which gives userspace access to one 
ore more i2c-busses. So the chain basically is:
-userspace app (i2cdump for example) -> i2c-dev -> i2c master driver (i2c-i801
  for example).

Notice that under normal circumstances userspace access to the i2c busses is 
not used, its main use is as a debugging / development technique.

>> I just thought the same problem exists for non hardware backed devices like 
>> loop. Then I noticed that loop.ko is loaded, removing it and then trying a 
>> mount -o loop will cause mount to fail because it cannot find /dev/loop#.
>>
>> Who / what is responsible for loop.ko getting loaded by default, wouldn't 
>> it be better to use a similar trick with a static /dev entry and module 
>> autoloading, this would probably save both boottime and memory.
> 
> loop is created by /etc/udev/makedev.d/50-udev.nodes.
> 

Hmm,

Interesting this seems to be different from adding entries under 
/lib/udev/devices, as as said on my system after dev the loop module gets 
loaded, while I assume its not used during boot. Wouldn't it be better (faster, 
less memory use) for the loop-devices to sit under /lib/udev/devices, so that 
no module gets loaded?

Regards,

Hans




More information about the fedora-devel-list mailing list