how to find parameters that a kernel module takes

Share your how-tos and guides with other users

Moderators: ChriThor, LXF moderators

how to find parameters that a kernel module takes

Postby John Lumby » Sat Apr 16, 2011 12:45 am

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
John Lumby
Posts: 22
Joined: Wed May 12, 2010 2:10 am
Location: Toronto

Postby nelz » Sun Apr 17, 2011 4:30 pm

You can also get a list of parameters with
Code: Select all
modinfo modulename
"Insanity: doing the same thing over and over again and expecting different results." (Albert Einstein)
User avatar
Site admin
Posts: 9046
Joined: Mon Apr 04, 2005 11:52 am
Location: Warrington, UK

Return to Hints and tips

Who is online

Users browsing this forum: No registered users and 0 guests