linux设备驱动命令 lsmod insmod rmmod modinfo modprobe

35 篇文章 3 订阅
13 篇文章 0 订阅

lsmod 显示已经加载的模组:

# lsmod
mali 291301 0 - Live 0xbf1f5000 (O)
xradio_core 231955 0 - Live 0xbf15b000
xradio_mac 260629 1 xradio_core, Live 0xbf109000
sunxi_eve 6574 0 - Live 0xbf103000
gslX680new 641781 0 - Live 0xbf000000

lsmod实际是读取/proc/modules信息:

# cat /proc/modules
xradio_core 231955 0 - Live 0xbf15b000
xradio_mac 260629 1 xradio_core, Live 0xbf109000
sunxi_eve 6574 0 - Live 0xbf103000
gslX680new 641781 0 - Live 0xbf000000

insmod

# insmod /lib/modules/3.10.65/mali.ko
[ 9072.822320] ------------[ cut here ]------------
[ 9072.827489] WARNING: at fs/sysfs/dir.c:530 sysfs_add_one+0x8c/0xac()
[ 9072.834603] sysfs: cannot create duplicate filename '/devices/gpu/scenectrl'
[ 9072.842466] Modules linked in: mali(O+) xradio_core xradio_mac sunxi_eve gslX680new [last unloaded: mali]
[ 9072.853207] CPU: 2 PID: 7339 Comm: insmod Tainted: G        W  O 3.10.65 #12
[ 9072.861079] [<c0018374>] (unwind_backtrace+0x0/0x124) from [<c00148a4>] (show_stack+0x20/0x24)
[ 9072.870701] [<c00148a4>] (show_stack+0x20/0x24) from [<c06bb254>] (dump_stack+0x20/0x28)
[ 9072.879739] [<c06bb254>] (dump_stack+0x20/0x28) from [<c0026410>] (warn_slowpath_common+0x5c/0x7c)
[ 9072.889726] [<c0026410>] (warn_slowpath_common+0x5c/0x7c) from [<c0026470>] (warn_slowpath_fmt+0x40/0x48)
[ 9072.900409] [<c0026470>] (warn_slowpath_fmt+0x40/0x48) from [<c0164588>] (sysfs_add_one+0x8c/0xac)
[ 9072.910413] [<c0164588>] (sysfs_add_one+0x8c/0xac) from [<c0164784>] (create_dir+0x70/0xc4)
[ 9072.919744] [<c0164784>] (create_dir+0x70/0xc4) from [<c0164a84>] (sysfs_create_subdir+0x2c/0x34)
[ 9072.929650] [<c0164a84>] (sysfs_create_subdir+0x2c/0x34) from [<c01663c0>] (internal_create_group+0x94/0x204)
[ 9072.940706] [<c01663c0>] (internal_create_group+0x94/0x204) from [<c0166550>] (sysfs_create_group+0x20/0x24)
[ 9072.951816] [<c0166550>] (sysfs_create_group+0x20/0x24) from [<bf26099c>] (mali_platform_device_init+0x360/0x8c0 [mali])
[ 9072.964173] [<bf26099c>] (mali_platform_device_init+0x360/0x8c0 [mali]) from [<bf263450>] (mali_probe+0x68/0x2c4 [mali])
[ 9072.976419] [<bf263450>] (mali_probe+0x68/0x2c4 [mali]) from [<c0335b4c>] (platform_drv_probe+0x24/0x28)
[ 9072.986998] [<c0335b4c>] (platform_drv_probe+0x24/0x28) from [<c033436c>] (driver_probe_device+0x144/0x34c)
[ 9072.997870] [<c033436c>] (driver_probe_device+0x144/0x34c) from [<c0334640>] (__driver_attach+0x78/0x9c)
[ 9073.008453] [<c0334640>] (__driver_attach+0x78/0x9c) from [<c03325b8>] (bus_for_each_dev+0x7c/0xa0)
[ 9073.018548] [<c03325b8>] (bus_for_each_dev+0x7c/0xa0) from [<c0333d04>] (driver_attach+0x28/0x30)
[ 9073.028461] [<c0333d04>] (driver_attach+0x28/0x30) from [<c0333840>] (bus_add_driver+0x118/0x254)
[ 9073.038365] [<c0333840>] (bus_add_driver+0x118/0x254) from [<c0334e64>] (driver_register+0xac/0x130)
[ 9073.048569] [<c0334e64>] (driver_register+0xac/0x130) from [<c0336180>] (platform_driver_register+0x54/0x68)
[ 9073.059646] [<c0336180>] (platform_driver_register+0x54/0x68) from [<bf263308>] (init_module+0x1c/0x64 [mali])
[ 9073.070902] [<bf263308>] (init_module+0x1c/0x64 [mali]) from [<c000a4b4>] (do_one_initcall+0xcc/0x170)
[ 9073.081306] [<c000a4b4>] (do_one_initcall+0xcc/0x170) from [<c007fdb8>] (load_module+0x17cc/0x1d98)
[ 9073.091413] [<c007fdb8>] (load_module+0x17cc/0x1d98) from [<c0080494>] (SyS_init_module+0x110/0x120)
[ 9073.101608] [<c0080494>] (SyS_init_module+0x110/0x120) from [<c0010160>] (ret_fast_syscall+0x0/0x30)
[ 9073.111794] ---[ end trace eb9941f0a642ca97 ]---
[ 9073.116955] Mali: ERR: /home/yuanguochao/t7linux-auto/linux-3.10/modules/gpu/mali-utgard/kernel_mode/driver/src/devicedrv/mali/linux/mali_platform.c
[ 9073.131788]            create_fs_node_for_userspace() 972
           Failed to create sysfs!
[ 9073.158563] Mali: Set gpu voltage to 1200mV.
[ 9073.174274] Mali: Enable gpu power successfully.
[ 9073.179691] mali-utgard gpu: Unbalanced pm_runtime_enable!
[ 9073.185887] Mali: Mali GPU initialization finished.
[ 9073.195307] Mali: ERR: /home/yuanguochao/t7linux-auto/linux-3.10/modules/gpu/mali-utgard/kernel_mode/driver/src/devicedrv/mali/linux/mali_devfreq.c
[ 9073.210265]            mali_devfreq_init_freq_table() 181
           Unable to enumerate all OPPs (36!=9)
[ 9073.221113]
[ 9073.226295] gpu cooling callback register Success
[ 9073.231665] Mali: Mali device driver loaded

rmmod

# rmmod mali
[ 9188.624947] gpu cooling callback unregister Success
[ 9188.637932] devfreq gpu: releasing devfreq which doesn't exist
[ 9188.650005] Mali: Disable gpu power successfully.
[ 9188.655467] gpu cooling callback unregister Success
[ 9188.661396] Mali: Mali device driver unloaded

modprobe,按依赖加载驱动,会加载对应的依赖库,可以不带路径,功能更加强大:
我也不知道为啥可以不带路径,反正insmod就必须带路径。

# modprobe mali
[ 9096.437424] ------------[ cut here ]------------
[ 9096.442856] WARNING: at fs/sysfs/dir.c:530 sysfs_add_one+0x8c/0xac()
[ 9096.449974] sysfs: cannot create duplicate filename '/devices/gpu/scenectrl'
[ 9096.457958] Modules linked in: mali(O+) xradio_core xradio_mac sunxi_eve gslX680new [last unloaded: mali]
[ 9096.468734] CPU: 0 PID: 10232 Comm: modprobe Tainted: G        W  O 3.10.65 #12
[ 9096.477008] [<c0018374>] (unwind_backtrace+0x0/0x124) from [<c00148a4>] (show_stack+0x20/0x24)
[ 9096.486663] [<c00148a4>] (show_stack+0x20/0x24) from [<c06bb254>] (dump_stack+0x20/0x28)
[ 9096.495812] [<c06bb254>] (dump_stack+0x20/0x28) from [<c0026410>] (warn_slowpath_common+0x5c/0x7c)
[ 9096.505868] [<c0026410>] (warn_slowpath_common+0x5c/0x7c) from [<c0026470>] (warn_slowpath_fmt+0x40/0x48)
[ 9096.516574] [<c0026470>] (warn_slowpath_fmt+0x40/0x48) from [<c0164588>] (sysfs_add_one+0x8c/0xac)
[ 9096.526601] [<c0164588>] (sysfs_add_one+0x8c/0xac) from [<c0164784>] (create_dir+0x70/0xc4)
[ 9096.535956] [<c0164784>] (create_dir+0x70/0xc4) from [<c0164a84>] (sysfs_create_subdir+0x2c/0x34)
[ 9096.545907] [<c0164a84>] (sysfs_create_subdir+0x2c/0x34) from [<c01663c0>] (internal_create_group+0x94/0x204)
[ 9096.557108] [<c01663c0>] (internal_create_group+0x94/0x204) from [<c0166550>] (sysfs_create_group+0x20/0x24)
[ 9096.568371] [<c0166550>] (sysfs_create_group+0x20/0x24) from [<bf2c099c>] (mali_platform_device_init+0x360/0x8c0 [mali])
[ 9096.580888] [<bf2c099c>] (mali_platform_device_init+0x360/0x8c0 [mali]) from [<bf2c3450>] (mali_probe+0x68/0x2c4 [mali])
[ 9096.593256] [<bf2c3450>] (mali_probe+0x68/0x2c4 [mali]) from [<c0335b4c>] (platform_drv_probe+0x24/0x28)
[ 9096.603880] [<c0335b4c>] (platform_drv_probe+0x24/0x28) from [<c033436c>] (driver_probe_device+0x144/0x34c)
[ 9096.614781] [<c033436c>] (driver_probe_device+0x144/0x34c) from [<c0334640>] (__driver_attach+0x78/0x9c)
[ 9096.625402] [<c0334640>] (__driver_attach+0x78/0x9c) from [<c03325b8>] (bus_for_each_dev+0x7c/0xa0)
[ 9096.635547] [<c03325b8>] (bus_for_each_dev+0x7c/0xa0) from [<c0333d04>] (driver_attach+0x28/0x30)
[ 9096.645485] [<c0333d04>] (driver_attach+0x28/0x30) from [<c0333840>] (bus_add_driver+0x118/0x254)
[ 9096.655426] [<c0333840>] (bus_add_driver+0x118/0x254) from [<c0334e64>] (driver_register+0xac/0x130)
[ 9096.665622] [<c0334e64>] (driver_register+0xac/0x130) from [<c0336180>] (platform_driver_register+0x54/0x68)
[ 9096.676755] [<c0336180>] (platform_driver_register+0x54/0x68) from [<bf2c3308>] (init_module+0x1c/0x64 [mali])
[ 9096.688073] [<bf2c3308>] (init_module+0x1c/0x64 [mali]) from [<c000a4b4>] (do_one_initcall+0xcc/0x170)
[ 9096.698477] [<c000a4b4>] (do_one_initcall+0xcc/0x170) from [<c007fdb8>] (load_module+0x17cc/0x1d98)
[ 9096.708620] [<c007fdb8>] (load_module+0x17cc/0x1d98) from [<c0080494>] (SyS_init_module+0x110/0x120)
[ 9096.718831] [<c0080494>] (SyS_init_module+0x110/0x120) from [<c0010160>] (ret_fast_syscall+0x0/0x30)
[ 9096.729045] ---[ end trace eb9941f0a642ca98 ]---
[ 9096.734234] Mali: ERR: /home/yuanguochao/t7linux-auto/linux-3.10/modules/gpu/mali-utgard/kernel_mode/driver/src/devicedrv/mali/linux/mali_platform.c
[ 9096.749163]            create_fs_node_for_userspace() 972
           Failed to create sysfs!
[ 9096.775582] Mali: Set gpu voltage to 1200mV.
[ 9096.791283] Mali: Enable gpu power successfully.
[ 9096.796663] mali-utgard gpu: Unbalanced pm_runtime_enable!
[ 9096.802923] Mali: Mali GPU initialization finished.
[ 9096.811791] Mali: ERR: /home/yuanguochao/t7linux-auto/linux-3.10/modules/gpu/mali-utgard/kernel_mode/driver/src/devicedrv/mali/linux/mali_devfreq.c
[ 9096.826664]            mali_devfreq_init_freq_table() 181
           Unable to enumerate all OPPs (45!=9)
[ 9096.837532]
[ 9096.842614] gpu cooling callback register Success
[ 9096.847852] Mali: Mali device driver loaded

modprobe -r:

# modprobe -r mali
[ 9094.249859] gpu cooling callback unregister Success
[ 9094.263602] devfreq gpu: releasing devfreq which doesn't exist
[ 9094.275676] Mali: Disable gpu power successfully.
[ 9094.281076] gpu cooling callback unregister Success
[ 9094.287683] Mali: Mali device driver unloaded

modinfo 模组名可以得到对应的模组信息:

modinfo stp
filename:       /lib/modules/3.19.0-80-generic/kernel/net/802/stp.ko
license:        GPL
srcversion:     AFBB842A0563D27C8F56BBF
depends:        llc
intree:         Y
vermagic:       3.19.0-80-generic SMP mod_unload modversions
signer:         Magrathea: Glacier signing key
sig_key:        A0:FE:5D:15:C7:93:91:1F:01:EC:45:5D:4A:8B:3D:59:BA:2E:0E:88
sig_hashalgo:   sha512

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值