Linux Kernel Modules 内核模块管理

Posted Vincen_shen

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux Kernel Modules 内核模块管理相关的知识,希望对你有一定的参考价值。

Linux 设备驱动以Kernel Module形式存在,Linux Kernel Module可以动态加载到内核中。

 

- lsmod  Show the status of modules in the Linux Kernel

 

- modinfo  Show information about a Linux Kernle module

 

- modprobe  Add and Remove modules from the Linux Kernel

 

示例1:

- 加载ip_vs模块(重启后失效)

$ modprobe -v ip_vs
$ lsmod | grep ip_vs
ip_vs                 145497  0 
nf_conntrack          139224  7 ip_vs,nf_nat,nf_nat_ipv4,nf_nat_ipv6,xt_conntrack,nf_conntrack_ipv4,nf_conntrack_ipv6
libcrc32c              12644  4 xfs,ip_vs,nf_nat,nf_conntrack

 

- 卸载ip_vs模块

$ modprobe -v -r ip_vs

 

- 开机自动加载

// 将模块加载命令放入 /etc/sysconfig/modules 路径下
$ cat > /etc/sysconfig/modules/ipvs.modules <<EOF > /sbin/modprobe ip_vs > EOF

 

以上是关于Linux Kernel Modules 内核模块管理的主要内容,如果未能解决你的问题,请参考以下文章

Linux 内核及系统启动流程

kernel信息及其相关命令

8Linux内核与内核模块

linux下加内核模块时出现出现如下错误:insmod: error inserting 'kernel.ko': -1 Invalid parameters因该

内核模块

重构linux系统