mdev

David Henderson dhenderson at digital-pipe.com
Wed Jan 12 19:24:09 UTC 2011


Andrew wrote:
> 12.01.2011 20:28, David Henderson пишет:
>> Andrew wrote:
>>> 12.01.2011 18:15, David Henderson пишет:
>>>> So far in my project, I've been loading the kernel modules 
>>>> (drivers) manually in the startup scripts. This is, obviously, far 
>>>> from ideal as this will only allow the OS to work on a fixed set of 
>>>> hardware. I've been investigating how to use mdev to install the 
>>>> drivers for detected hardware (e.g. network cards). So far, it 
>>>> looks like I'll have to setup a script that's called by mdev to 
>>>> process any kernel modules related to the hardware in 
>>>> /etc/mdev.conf. The problem I've found is that I can't really find 
>>>> an example of how to do this with mdev (udev seems to use $MODALIAS 
>>>> with /etc/udev/scripts). I've also searched the busybox 
>>>> documentation for mdev which doesn't cover this topic. Can anyone 
>>>> point me to some relevant documentation/example, or provide 
>>>> something to get me started?
>>>>
>>>> Thanks,
>>>> Dave
>>> For cold-plug hardware detection I used simple modalias search + 
>>> modprobe by aliases (5 lines in script). Works perfectly with full 
>>> modprobe, on tiny variant of modprobe (which loads just 1st matching 
>>> module) it fails sometimes for devices like IDE controllers that 
>>> have 2 or more corresponding modules (for ex., generic ata which 
>>> matches by device class&etc and vendor driver which match 
>>> VenID/DevID). You can see it in LEAF v4.
>>>
>> Thanks Andrew.  I'm not familiar with LEAF, and since we're only 
>> talking about a file that's 5 lines, can you post in a reply?
>>
>      #autodetection of hardware
>      MODALIAS=`find /sys/devices -iname modalias -exec cat {} \;`
>      TMODALIAS=""
>      while [ `echo "$MODALIAS"|wc -l` -gt `echo "$TMODALIAS"|wc -l` ]; do
>      for i in $MODALIAS; do
>      /sbin/modprobe $i 2>/dev/null
>      done
>      [ "$VERBOSE" ] && echo Loaded `echo "$MODALIAS"|wc -l` modaliases
>      [ "$DRV_WAIT" -gt 0 ] && sleep $DRV_WAIT
>      TMODALIAS="$MODALIAS"
>      MODALIAS=`find /sys/devices -iname modalias -exec cat {} \;`
>      done
>> Is there a way to do a "sleep" or "process order" for devices using 2 
>> or more modules?
>>
>> Dave
> Here is a patch for additional module loading priority: 
> http://leaf.cvs.sourceforge.net/viewvc/leaf/src/bering-uclibc4/source/busybox/modprobe_alias_behaviors.patch?revision=1.2&view=markup 
>
> Or you can switch from tiny to full modutils in busybox (+14kB of code)
Thanks for the script Andrew!  I'll incorporate it (and possibly use it 
permenantly) right away.  Also, I am currently using the full version of 
modutils offered by busybox, so no patching for me! :)


More information about the busybox mailing list