Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sat 05 Sep 2015, 10:31
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Utilities
lsmodinfo - a script to show info about all loaded modules
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [3 Posts]  
Author Message
gyro

Joined: 28 Oct 2008
Posts: 793
Location: Brisbane, Australia

PostPosted: Mon 27 Apr 2015, 06:02    Post subject:  lsmodinfo - a script to show info about all loaded modules
Subject description: A tool to make it easier to find modules supporting a particular device
 

This script combines some of 'lsmod' with some of 'modinfo'.
It lists all the currently loaded kernel modules, providing the 'description:' and 'file:' information from 'modinfo'.

Here is output for the first 2 modules from running it on my Tahrpup 6.0.2:
Code:
# ./lsmodinfo
joydev
  Joystick device interfaces
  /lib/modules/3.14.20/kernel/drivers/input/joydev.ko
snd_hda_codec_hdmi
  HDMI HD-audio codec
  /lib/modules/3.14.20/kernel/sound/pci/hda/snd-hda-codec-hdmi.ko

Note: Some modules don't have a 'description:' so there is only a 'file:' line for such a module:
Code:
parport
  /lib/modules/3.14.20/kernel/drivers/parport/parport.ko

This script is meant to be a tool to assist in identifying any modules that support the keyboard. Since if there are, then most likely the keyboard won't work during the 'init' script in 'initrd.gz', when asking for the number for multiple savefiles/savefolders, or entering a password for encrypted savefiles. (Kernel modules are not available to the 'init'script.)

To use:
Dwonload the '.gz' file and move it to the directory you want to contain the utility.
Then gunzip the downloaded file.

gyro
lsmodinfo.gz
Description  gunzip to produce the script file
gz

 Download 
Filename  lsmodinfo.gz 
Filesize  258 Bytes 
Downloaded  63 Time(s) 
Back to top
View user's profile Send private message 
stemsee

Joined: 27 Jun 2013
Posts: 1316
Location: In The Way

PostPosted: Mon 27 Apr 2015, 08:27    Post subject:  

I was going to write a script for stripping out unused modules, to slim down the kernel package. Your script with the 'file' line only is a solid step towards that goal! How to output only file lines to a file?

edit: ok did it.

Code:
#!/bin/bash
touch /tmp/modlist
IFS_BAK=$IFS
IFS=$'\n'
for MOD in `lsmod`; do
   MODNM="${MOD%% *}"
   [ "$MODNM" = "Module" ] && continue
   MODFN="`modinfo \"$MODNM\" | grep -m1 'filename:' | tr -s ' ' | cut -f 2-20 -d ' '`"
   MODDES="`modinfo \"$MODNM\" | grep -m1 'description:' | tr -s ' ' | cut -f 2-20 -d ' '`"
   echo "$MODNM"
   [ "$MODDES" ] && echo "  $MODDES"
   [ "$MODFN" ] && echo "  $MODFN" >> /tmp/modlist
done
IFS=$IFS_BAK
IFS_BAK=
geany /tmp/modlist
exit
Back to top
View user's profile Send private message MSN Messenger 
gyro

Joined: 28 Oct 2008
Posts: 793
Location: Brisbane, Australia

PostPosted: Mon 27 Apr 2015, 09:10    Post subject:  

stemsee wrote:
I was going to write a script for stripping out unused modules, to slim down the kernel package. Your script with the 'file' line only is a solid step towards that goal! How to output only file lines to a file?

edit: ok did it.
I was just about to suggest the following:
Code:
#!/bin/bash
IFS_BAK=$IFS
IFS=$'\n'
for MOD in `lsmod`; do
   MODNM="${MOD%% *}"
   [ "$MODNM" = "Module" ] && continue
   echo "`modinfo \"$MODNM\" | grep -m1 'filename:' | tr -s ' ' | cut -f 2-20 -d ' '`"
done
IFS=$IFS_BAK
IFS_BAK=
exit
then to get it into a file just:
Code:
./lsmodfiles > /tmp/module-files
But glad you worked it out yourself.
gyro
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [3 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Utilities
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
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1130s ][ Queries: 12 (0.0135s) ][ GZIP on ]