Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Auto-create modules.autoload
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
CRC
Tux's lil' helper
Tux's lil' helper


Joined: 30 Mar 2003
Posts: 90
Location: Dallas, TX, USA

PostPosted: Sat Jun 07, 2003 6:53 am    Post subject: Auto-create modules.autoload Reply with quote

These days, pcmcia and usb are controlled by hotplug, and ISA is dead, but finding the modules for your PCI cards can be a pain. Ideally, modules.conf controls everything to load the right drivers when you open the device, but this can be a pain to set up, and isn't really necessary. Gentoo uses a simple "modules.autoload" for loading various modules at boot time.

But ... what modules do you need? Try this script. It will scan your PCI bus and find the modules for you!!

Code:

#!/bin/sh

pci_module_array () {
  while read JUNK ID JUNK
  do
    VENDOR=`echo $ID | cut -b1-4`
    DEVICE=`echo $ID | cut -b5-8`
    ENTRY=`echo 0x0000${VENDOR} 0x0000${DEVICE}`
    grep "$ENTRY" /lib/modules/`uname -r`/*.pcimap | cut -d ' ' -f1
  done
}

for MODULE in `pci_module_array < /proc/bus/pci/devices | sort -u`
do
#  echo "Loading $MODULE ..."
#  modprobe -q $MODULE >/dev/null 2>&1
  echo $MODULE
done


Comment out the "echo $MODULE" line and uncomment the other two if you'd rather make this an init script to just load the modules. Great for CD-ROMS! Also try redirecting the output using >>/etc/modules.autoload
_________________
Unix/Linux Consulting & Hosting
We Support Gentoo!
http://CoolRunningConcepts.com

Freenode: Taro!
Back to top
View user's profile Send private message
Esben
Apprentice
Apprentice


Joined: 29 Jun 2002
Posts: 244
Location: Copenhagen/Denmark

PostPosted: Sat Jun 07, 2003 9:32 am    Post subject: Reply with quote

That' s a rather cool script :-D Too bad I don't have more than one pci-device 8)
_________________
regards, Esben
True trade is honest, but not merciful. Politics is dishonest, no matter how merciful... and war is neither honest nor merciful.... therefore, choose trade above politics, but politics above war.
Back to top
View user's profile Send private message
GenKiller
n00b
n00b


Joined: 04 Mar 2003
Posts: 66
Location: United States of America

PostPosted: Tue Jun 10, 2003 5:21 pm    Post subject: Reply with quote

Very neat script! This is perfect for a project I'm working on. Thanks for sharing it with us!
_________________
http://www.digital-drip.com
Back to top
View user's profile Send private message
scoobydu
Veteran
Veteran


Joined: 16 Feb 2003
Posts: 1076
Location: 'Mind the Gap'

PostPosted: Tue Jun 10, 2003 5:28 pm    Post subject: Reply with quote

Neat script :D

Although it only finds my audfigy2, but not my network card or raid controller?? :?:

Thanks for sharing it though ..
Back to top
View user's profile Send private message
CRC
Tux's lil' helper
Tux's lil' helper


Joined: 30 Mar 2003
Posts: 90
Location: Dallas, TX, USA

PostPosted: Tue Jul 01, 2003 12:58 am    Post subject: Reply with quote

For this to work, you have to have all your modules compiled. It only finds modules you have compiled!
_________________
Unix/Linux Consulting & Hosting
We Support Gentoo!
http://CoolRunningConcepts.com

Freenode: Taro!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum