Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
TIP: Generate modules.autoload.d
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
nlindblad
Guru
Guru


Joined: 30 Jun 2005
Posts: 476
Location: Lund, Sweden

PostPosted: Sun Oct 30, 2005 1:33 pm    Post subject: TIP: Generate modules.autoload.d Reply with quote

An extended version of the method from the handbook

Code:
#!/bin/bash
kernel="${1}"
for ko in $(find /lib/modules/${kernel} -type f -iname '*.ko')
        do
                mod_ko=$(basename "${ko}" .ko)
                echo "${mod_ko}"
        done
for o in $(find /lib/modules/${kernel} -type f -iname '*.o')
        do
                mod_o=$(basename "${o}" .o)
                echo "${mod_o}"
        done


Usage:
Code:
./module.sh 2.6.13-gentoo-r3


Result:
Code:
nfs
nfsd
exportfs
lockd
libcrc32c
ipt_NOTRACK
iptable_raw
sunrpc
s2io
dummy
cytherm
phidgetservo
touchkitusb
ibm_acpi
video
firmware_class
Back to top
View user's profile Send private message
El_Presidente_Pufferfish
Veteran
Veteran


Joined: 11 Jul 2002
Posts: 1179
Location: Seattle

PostPosted: Sun Oct 30, 2005 3:20 pm    Post subject: Reply with quote

If you're going to load all the modules you have at boot, why not just build them in?
Back to top
View user's profile Send private message
nlindblad
Guru
Guru


Joined: 30 Jun 2005
Posts: 476
Location: Lund, Sweden

PostPosted: Sun Oct 30, 2005 3:37 pm    Post subject: Reply with quote

El_Presidente_Pufferfish wrote:
If you're going to load all the modules you have at boot, why not just build them in?


Why not put that in the handbook?
Back to top
View user's profile Send private message
Earthwings
Bodhisattva
Bodhisattva


Joined: 14 Apr 2003
Posts: 7753
Location: Karlsruhe, Germany

PostPosted: Sun Oct 30, 2005 4:19 pm    Post subject: Reply with quote

Compiling everything into the kernel is not always desirable even it the module is used all the time. For example, when suspending (hibernating) a laptop, some modules have to be unloaded to avoid crashes. Compiling them into the kernel would always lead to a crash then.
_________________
KDE
Back to top
View user's profile Send private message
nlindblad
Guru
Guru


Joined: 30 Jun 2005
Posts: 476
Location: Lund, Sweden

PostPosted: Sun Oct 30, 2005 4:27 pm    Post subject: Reply with quote

Earthwings wrote:
Compiling everything into the kernel is not always desirable even it the module is used all the time. For example, when suspending (hibernating) a laptop, some modules have to be unloaded to avoid crashes. Compiling them into the kernel would always lead to a crash then.


So my idea is not completly rubbish then?
Back to top
View user's profile Send private message
Earthwings
Bodhisattva
Bodhisattva


Joined: 14 Apr 2003
Posts: 7753
Location: Karlsruhe, Germany

PostPosted: Sun Oct 30, 2005 4:50 pm    Post subject: Reply with quote

It's a nice way to get an overview of what modules are available. Here's a slightly enhanced version of the script, defaults to the running kernel if called without argument.
Code:
#!/bin/bash
kernel="${1:-$(uname -r)}"

for module in $(find /lib/modules/${kernel} -type f -iname '*.o' -or -iname '*.ko' -printf '%f\n')
do
  echo ${module%.*}
done

_________________
KDE
Back to top
View user's profile Send private message
rojaro
l33t
l33t


Joined: 06 May 2002
Posts: 732

PostPosted: Mon Oct 31, 2005 7:40 am    Post subject: Reply with quote

Hi,

although this script might be kinda nice if you compile the Kernel yourself with just a few modules, it is a really bad idea to use this script if you're running a Kernel compiled by the genkernel script. By default genkernel produces a huge amount of modules to ensure that the machine will have support for all devices you might have (or for devices you might plugin later on). So only use this script if you are really sure that it only loads the modules you really need.

- rojaro -
_________________
A mathematician is a machine for turning coffee into theorems. ~ Alfred Renyi (*1921 - †1970)
Back to top
View user's profile Send private message
nlindblad
Guru
Guru


Joined: 30 Jun 2005
Posts: 476
Location: Lund, Sweden

PostPosted: Mon Oct 31, 2005 9:54 am    Post subject: Reply with quote

rojaro wrote:
Hi,

although this script might be kinda nice if you compile the Kernel yourself with just a few modules, it is a really bad idea to use this script if you're running a Kernel compiled by the genkernel script. By default genkernel produces a huge amount of modules to ensure that the machine will have support for all devices you might have (or for devices you might plugin later on). So only use this script if you are really sure that it only loads the modules you really need.

- rojaro -


I agree, but for the lazy admin who compiles only a few modules it might be nice.
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