How to get a list of all kernel modules

M. Warner Losh imp at bsdimp.com
Sun Jun 17 06:42:06 UTC 2007


In message: <4674D5B2.4000104 at gmx.de>
            "[LoN]Kamikaze" <LoN_Kamikaze at gmx.de> writes:
: M. Warner Losh wrote:
: > In message: <4674CE41.7000103 at gmx.de>
: >             "[LoN]Kamikaze" <LoN_Kamikaze at gmx.de> writes:
: > : [LoN]Kamikaze wrote:
: > : > M. Warner Losh wrote:
: > : >> Greetings,
: > : >>
: > : >> is there an easy way to get a list of all the ports that compile
: > : >> kernel modules?  I'd like to add them to my kernel build.  I did this
: > : >> once before, but I lost all information on how to do it when I lost my
: > : >> laptop's hard disk after the last bsdcan...
: > : >>
: > : >> Warner
: > : > 
: > : > # find /boot/ -type f -exec pkg_info -W \{} \;
: > : 
: > : Sorry about that, it takes very long. Better is:
: > : 
: > : # sh -c 'for mod in `pkg_info -qaL|grep -E "^/+boot"`; { pkg_info -W "$mod"; }
: > 
: > This sounds great, except for one problem.  This will tell me all the
: > modules that I've installed that are from ports.  Since I've never
: > installed any from ports, this will not work for what I want.  I want
: > a list of all the ports in /usr/ports that install kernel modules.
: > I'd even settle for a list of all the ports in /usr/ports that only
: > install modules.
: > 
: > Something like
: > 	egrep -l '\.ko$' /usr/ports/*/*/pkg-plist | sed -e s=/pkg-plist//
: > might do the trick, but that blows the command line limits out of the
: > water.  Replacing egrep with 'find' would need to be carefully
: > constructed to avoid false positives in any work directories I have
: > laying around.  I was hoping for something a little easier to do...
: > 
: > Warner
: 
: I see I misunderstood, sorry about that. So how about that one:
: 
: # find /usr/ports/ -type f -name pkg-plist -exec grep -El
: '^@cwd[[:space:]]+/boot' \{} \; | sed -E 's|^/usr/ports/||1' | sed -E
: 's|/pkg-plist$||1'
: 
: It only works with ports that have a pkg-plist file, though.

This won't quite work because there are things like:

% cat multimedia/pvr250/pkg-plist
@unexec rm %%MODULESDIR%%/cxm.ko
@unexec rm %%MODULESDIR%%/cxm_iic.ko
bin/pvr250-setchannel

I'd kinda hoped there was a pseudo category that I could key off of.
pvr250 is also kinda a mess too, since I can't build it w/o a CD I
don't have...

Warner


More information about the freebsd-ports mailing list