📄 introduction_to_modules.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head> <title></title> <link rel="stylesheet" media="screen" type="text/css" href="./style.css" /> <link rel="stylesheet" media="screen" type="text/css" href="./design.css" /> <link rel="stylesheet" media="print" type="text/css" href="./print.css" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body><a href=start.html>start</a></br><div class="toc"><div class="tocheader toctoggle" id="toc__header">Table of Contents</div><div id="toc__inside"><ul class="toc"><li class="level1"><div class="li"><span class="li"><a href="#kernel_modules" class="toc">Kernel Modules</a></span></div><ul class="toc"><li class="clear"><ul class="toc"><li class="level3"><div class="li"><span class="li"><a href="#module_loading" class="toc">Module Loading</a></span></div></li><li class="level3"><div class="li"><span class="li"><a href="#more_information" class="toc">More Information</a></span></div></li></ul></li></ul></li></ul></div></div><h1><a name="kernel_modules" id="kernel_modules">Kernel Modules</a></h1><div class="level1"><p> Modules are pieces of kernel code that can be <strong>added</strong> to a running kernel after it has booted.</p><p>They are often used to load device drivers or other kernel components that are needed by the kernel as it responds to user or hardware actions.</p><p>The action of plugging in a USB device will trigger an action by the kernel to load all the components it needs to access the device. if possible.</p><p> An extensive guide to creating modules can be found in the following sections. </p><ul><li class="level1"><div class="li"> <a href="kernel_modules.html" class="wikilink1" title="kernel_modules.html">kernel modules</a></div></li><li class="level1"><div class="li"> <a href="kernel_module_development.html" class="wikilink1" title="kernel_module_development.html">kernel module development</a></div></li></ul></div><!-- SECTION [1-564] --><h3><a name="module_loading" id="module_loading">Module Loading</a></h3><div class="level3"><p>The <strong>kmod</strong> kernel task is responsible to auto loading kernel modules. It actually uses a user mode task called <strong>/sbin/modprobe</strong>. This uses information from a number of files to get the module loaded and configured. </p><ul><li class="level1"><div class="li"> /etc/modprobe.conf - overrides or modifies default actions for loading modules</div></li><li class="level1"><div class="li"> /lib/modules/2..x-<sub version name>/modules.dep - a file that lists all the modules found and declares other modules that need to be loaded prior to loading a specified module.</div></li></ul><p> The mopdules.dep file can be produced automatically by a program called <strong>depmod</strong>.</p><p>Modules can also be loaded manually using the <strong>modprobe</strong> or <strong>insmod</strong> commands.</p><p>If you want to see all the modules loaded in a running kernel use the <strong>lsmod</strong> command.</p><p>Note that you have to be superuser or <strong>root</strong> to <strong>insert</strong> or <strong>remove</strong> modules.</p><pre class="code">An example of lsmod/>lsmodModule Size Used bynls_utf8 2176 1ext3 115688 3jbd 61348 1 ext3vfat 13056 0fat 43168 1 vfatsbp2 22792 3snd_seq 53008 1bluetooth 44932 0nvram 8328 0usbserial 26856 0parport_pc 37824 1lp 10536 0parport 37960 2 parport_pc,lpnfsd 106824 5exportfs 5632 1 nfsdspeedstep_lib 4228 0freq_table 4356 0processor 25640 0[...] and many more</pre></div><!-- SECTION [565-2130] --><h3><a name="more_information" id="more_information">More Information</a></h3><div class="level3"><p> The Device Drivers section goes into more detail on modules.</p><p>See also the following man pages </p><ul><li class="level1"><div class="li"> insmod</div></li><li class="level1"><div class="li"> modprobe</div></li><li class="level1"><div class="li"> depmod</div></li><li class="level1"><div class="li"> modprobe.conf</div></li></ul></div><!-- SECTION [2131-] --></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -