Solved List of kernel modules in use

fred974

Daemon

Reaction score: 44
Messages: 1,620

Hi,

Prior to create a custom kernel, how can I see a list all driver my system curently use?

Thank you
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 9,283
Messages: 33,825

The dmesg(8) output is usually a good place to start looking. But in case that got rotated away, /var/log/messages. Look for the kernel messages just after booting. That will show you what's detected.
 

Phishfry

Son of Beastie

Reaction score: 1,975
Messages: 4,967

Yes but for example my dmesg shows u3g started when I am using a wired connection and no modem in use. So module is showing in kldstat with its memory address used but it is not in use..Dynamically loaded but not in use until called.

So really to find modules "in use" you would need to use top or ps correct?
How would you show memory usage by module?
 

Kevin

New Member


Messages: 14

Code:
: ${_DIR_TREE_MODULES:="$(find /usr/src/sys/modules -type d | egrep -v "tests|dtb" | awk -F "/usr/src/sys/modules/" '{ print $2 }' )"}
_LIST_MENU="$(echo "${_DIR_TREE_MODULES}" | awk -v path="/usr/src/sys/modules" '{ print "awk -F \x27KMOD\x27 \x27/^KMOD/ {print \""$1 "\" $2 \" off \"}\x27 "path"/"$1"/Makefile" }' | egrep -v "^&"  | tr '\t' ' ' | sh 2>/dev/null  | sed 's|=| |g'  | tr '\t' ' ')"
 

JibJabM

New Member

Reaction score: 1
Messages: 10

Code:
: ${_DIR_TREE_MODULES:="$(find /usr/src/sys/modules -type d | egrep -v "tests|dtb" | awk -F "/usr/src/sys/modules/" '{ print $2 }' )"}
_LIST_MENU="$(echo "${_DIR_TREE_MODULES}" | awk -v path="/usr/src/sys/modules" '{ print "awk -F \x27KMOD\x27 \x27/^KMOD/ {print \""$1 "\" $2 \" off \"}\x27 "path"/"$1"/Makefile" }' | egrep -v "^&"  | tr '\t' ' ' | sh 2>/dev/null  | sed 's|=| |g'  | tr '\t' ' ')"
lol. Maybe some explanation is needed here? Looks amazing, but what does it do? Not sure anyone will want to copy/paste and run this on their system without having a summary of what it's doing. 😆
 
Top