Linux Format forums Forum Index Linux Format forums
Help, discussion, magazine feedback and more
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

how to find parameters that a kernel module takes

 
Post new topic   Reply to topic    Linux Format forums Forum Index -> Hints and tips
View previous topic :: View next topic  
Author Message
John Lumby



Joined: Wed May 12, 2010 3:10 am
Posts: 22
Location: Toronto

PostPosted: Sat Apr 16, 2011 1:45 am    Post subject: how to find parameters that a kernel module takes Reply with quote

Suppose you have some vague idea that some kernel module may take some parameter telling it what to do, but can't find out what the parameter is. Many device drivers have such parms. Or suppose you are plain curious. Then you can run this nifty scriptlet to list the parms and their documentation strings :

Suppose the module name is abcxyz

kmod="abcxyz";find /lib/modules/`uname -r`/kernel -name ${kmod}.ko -exec strings -a '{}' \; | fgrep -e parm=

Three caveats:

1) the module must exist under the /lib/modules dir - i.e. it must not be built-in to the kernel image
2) you have to spell the name exactly - hyphen and underscore are not interchangeable, as the scriptlet is looking for a matching file. But you can run it again with the alternative, or you can make the find command cleverer for a specific name, e.g. to look for whichever of parport_pc or parport-pc

find /lib/modules/`uname -r`/kernel -name parport'[-_]'pc.ko -exec strings -a '{}' \; | fgrep -e parm=
parm=init_mode:Initialise mode for VIA VT8231 port (spp, ps2, epp, ecp or ecpepp)
parm=dma:DMA channel
parm=irq:IRQ line
parm=io_hi:Base I/O address (ECR)
parm=io:Base I/O address (SPP regs)

3) some modules parms may be hidden if the kernel was configured to omit the relevant feature, as they will be compiled out.
_________________
John Lumby
Back to top
View user's profile Send private message
nelz
Site admin


Joined: Mon Apr 04, 2005 12:52 pm
Posts: 8455
Location: Warrington, UK

PostPosted: Sun Apr 17, 2011 5:30 pm    Post subject: Reply with quote

You can also get a list of parameters with
Code:
modinfo modulename

_________________
"Insanity: doing the same thing over and over again and expecting different results." (Albert Einstein)
Back to top
View user's profile Send private message
View previous topic :: View next topic  
Display posts from previous:   
Post new topic   Reply to topic    Linux Format forums Forum Index -> Hints and tips 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
Linux Format forums topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group


Copyright 2011 Future Publishing, all rights reserved.


Web hosting by UKFast