Bạn muốn liệt kê thông tin về các module kernel driver thiết bị được cài đặt hỗ trợ trên hệ thống Linux của bạn ? Vậy thì xem qua bài viết nhỏ phía dưới nhé. Các cách để liệt kê thông tin về module kernel driver thiết bị trên Linux.
Contents
1. Đọc nội dung file ‘/proc/modules’
– File ‘/proc/modules‘ chứa các thông tin module đã được cài đặt vào kernel Linux. Nội dung file đơn giản không format kiểu dễ đọc như lệnh ‘lsmod‘ sẽ hỗ trợ ở phần kế.
# cat /proc/modules bonding 132885 0 - Live 0xffffffffa02f8000 iptable_filter 2793 0 - Live 0xffffffffa02f4000 ip_tables 17831 1 iptable_filter, Live 0xffffffffa02eb000 ip6t_REJECT 4340 2 - Live 0xffffffffa02e6000 nf_conntrack_ipv6 7985 3 - Live 0xffffffffa02e0000 nf_defrag_ipv6 26468 1 nf_conntrack_ipv6, Live 0xffffffffa02d5000 xt_state 1492 3 - Live 0xffffffffa02d1000 nf_conntrack 79537 2 nf_conntrack_ipv6,xt_state, Live 0xffffffffa02b2000 ip6table_filter 2889 1 - Live 0xffffffffa02ae000 ip6_tables 18732 1 ip6table_filter, Live 0xffffffffa02a5000 ipv6 336282 36 ip6t_REJECT,nf_conntrack_ipv6,nf_defrag_ipv6, Live 0xffffffffa023e000 i2c_piix4 11232 0 - Live 0xffffffffa022f000 i2c_core 29132 1 i2c_piix4, Live 0xffffffffa0221000 snd_intel8x0 30524 0 - Live 0xffffffffa0214000 snd_ac97_codec 124967 1 snd_intel8x0, Live 0xffffffffa01ec000 ac97_bus 1452 1 snd_ac97_codec, Live 0xffffffffa01e8000 snd_seq 60769 0 - Live 0xffffffffa01d1000 snd_seq_device 7277 1 snd_seq, Live 0xffffffffa01cb000 snd_pcm 93697 2 snd_intel8x0,snd_ac97_codec, Live 0xffffffffa01a9000 ....
2. Dùng lệnh ‘lsmod’
– Chương trình ‘lsmod‘ dùng để liệt kê trạng thái các module đang được sử dụng trên hệ thống Linux kernel. Chương trình sẽ format lại nội dung file ‘/proc/modules‘ nhằm thể hiện thông tin ra cho người dùng xem.
# lsmod Module Size Used by bonding 132885 0 iptable_filter 2793 0 ip_tables 17831 1 iptable_filter ip6t_REJECT 4340 2 nf_conntrack_ipv6 7985 3 nf_defrag_ipv6 26468 1 nf_conntrack_ipv6 xt_state 1492 3 nf_conntrack 79537 2 nf_conntrack_ipv6,xt_state ip6table_filter 2889 1 ip6_tables 18732 1 ip6table_filter ipv6 336282 36 ip6t_REJECT,nf_conntrack_ipv6,nf_defrag_ipv6 i2c_piix4 11232 0 i2c_core 29132 1 i2c_piix4 snd_intel8x0 30524 0 snd_ac97_codec 124967 1 snd_intel8x0 ....
3. Xem thông tin chi tiết 1 module kernel
– Sử dụng lệnh ‘modinfo‘ kèm theo tên module.
# modinfo <ten module>
# modinfo bonding filename: /lib/modules/2.6.32-642.6.1.el6.x86_64/kernel/drivers/net/bonding/bonding.ko author: Thomas Davis, tadavis@lbl.gov and many others description: Ethernet Channel Bonding Driver, v3.7.1 version: 3.7.1 license: GPL alias: rtnl-link-bond srcversion: F6C1815876DCB3094C27C71 depends: vermagic: 2.6.32-642.6.1.el6.x86_64 SMP mod_unload modversions parm: max_bonds:Max number of bonded devices (int) ....
Cám ơn các bạn đã theo dõi bài viết.