📄 hotplug.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=gb2312" />
<title>
6.47. Hotplug-2004_09_23
</title>
<link rel="stylesheet" href="../stylesheets/lfs.css" type="text/css" />
<meta name="generator" content="DocBook XSL Stylesheets V1.68.1" />
<link rel="stylesheet" href="../stylesheets/lfs-print.css" type="text/css" media="print" />
</head>
<body id="lfs" class="6.1">
<div class="navheader">
<div class="headertitles">
<h4>
Linux From Scratch - Version 6.1
</h4>
<h3>
Chapter 6. 安装系统基础软件
</h3>
</div>
<ul class="headerlinks">
<li class="prev">
<a accesskey="p" href="gzip.html" title="Gzip-1.3.5">后退</a>
<p>
Gzip-1.3.5
</p>
</li>
<li class="next">
<a accesskey="n" href="man.html" title="Man-1.5p">前进</a>
<p>
Man-1.5p
</p>
</li>
<li class="up">
<a accesskey="u" href="chapter06.html" title="Chapter 6. 安装系统基础软件">上一级</a>.
</li>
<li class="home">
<a accesskey="h" href="../index.html" title="Linux From Scratch - Version 6.1">回首页</a>
</li>
</ul>
</div>
<div class="wrap" lang="zh_cn" xml:lang="zh_cn">
<div class="titlepage">
<h1 class="sect1">
6.47. Hotplug-2004_09_23
</h1>
</div>
<div class="package" lang="zh_cn" xml:lang="zh_cn">
<p>
Hotplug 软件包包含影响内核产生的热插拔事件的脚本。这些事件符合反映在 <tt class="systemitem">sysfs</tt> 文件系统上的、内核态可见的每一个改变,比如添加和删除硬件。这个软件包还在引导时检测现存的硬件并在运行的内核中加载相关模块。</p>
<div class="segmentedlist">
<div class="seglistitem">
<div class="seg">
<strong><span class="segtitle">预计编译时间:</span></strong> <span class="seg">0.01 SBU</span>
</div>
<div class="seg">
<strong><span class="segtitle">所需磁盘空间:</span></strong> <span class="seg">460 KB</span>
</div>
</div>
</div>
<div class="segmentedlist">
<div class="seglistitem">
<div class="seg">
<strong><span class="segtitle">安装依赖于:</span></strong> <span class="seg">Bash, Coreutils, Find, Gawk, Make</span>
</div>
</div>
</div>
</div>
<div class="installation" lang="zh_cn" xml:lang="zh_cn">
<div class="titlepage">
<h2 class="sect2">
6.47.1. 安装 Hotplug
</h2>
</div>
<p>
安装 Hotplug 软件包:</p>
<pre class="userinput"><kbd class="command">make install</kbd></pre>
<p>
复制一个 “<span class="quote">install</span>” 目标忽略的文件:</p>
<pre class="userinput"><kbd class="command">cp etc/hotplug/pnp.distmap /etc/hotplug</kbd></pre>
<p>
因为我们要使用 LFS-Bootscripts 安装的初始化脚本,所以这里要删除 Hotplug 安装的初始化脚本:</p>
<pre class="userinput"><kbd class="command">rm -rf /etc/init.d</kbd></pre>
<p>
LFS-Bootscripts 程序包现在还不支持网络设备热插拔,所以我们要删除网络热插拔代理:</p>
<pre class="userinput"><kbd class="command">rm -f /etc/hotplug/net.agent</kbd></pre>
<p>
创建一个用于
<span><strong class="command">hotplug</strong></span> 加载固件的目录:</p>
<pre class="userinput"><kbd class="command">mkdir /lib/firmware</kbd></pre>
</div>
<div class="content" lang="zh_cn" xml:lang="zh_cn">
<div class="titlepage">
<a id="contents-hotplug" name="contents-hotplug"></a>
<h2 class="sect2">
6.47.2. Hotplug 的内容 </h2>
</div>
<div class="segmentedlist">
<div class="seglistitem">
<div class="seg">
<strong><span class="segtitle">安装的程序:</span></strong> <span class="seg">hotplug</span>
</div>
<div class="seg">
<strong><span class="segtitle">安装的脚本</span></strong> <span class="seg">/etc/hotplug/*.rc, /etc/hotplug/*.agent</span>
</div>
<div class="seg">
<strong><span class="segtitle">安装的文件:</span></strong>
<span class="seg">/etc/hotplug/hotplug.functions, /etc/hotplug/blacklist, /etc/hotplug/{pci,usb}, /etc/hotplug/usb.usermap, /etc/hotplug.d, /var/log/hotplug/events</span>
</div>
</div>
</div>
<div class="variablelist">
<h3>
<a id="id3332647" name="id3332647"></a>简要描述</h3>
<table border="0">
<col align="left" valign="top" />
<tbody>
<tr>
<td>
<a id="hotplug" name="hotplug"></a><span class="term"><span><strong class="command">hotplug</strong></span></span> </td>
<td>
<p>
Linux内核默认情况下将在内核态的某些事情发生变化时(如硬件的插入和拔出)调用此脚本。</p> </td>
</tr>
<tr>
<td>
<a id="hotplug-rc" name="hotplug-rc"></a><span class="term"><span><strong class="command">/etc/hotplug/*.rc</strong></span></span> </td>
<td>
<p>
这些脚本用于冷插拔(检测和激活在系统启动时已经存在的硬件)。它们被 <tt class="filename">hotplug</tt> 初始化脚本(包括LFS-Bootscripts)调用。<span><strong class="command">*.rc</strong></span> 脚本会尝试恢复系统引导时丢失的热插拔事件,因为,举例来说,内核没有挂载根文件系统。</p> </td>
</tr>
<tr>
<td>
<a id="hotplug-agent" name="hotplug-agent"></a><span class="term"><span><strong class="command">/etc/hotplug/*.agent</strong></span></span> </td>
<td>
<p>
这些脚本将被 <span><strong class="command">hotplug</strong></span> 调用以响应内核产生的各种不同的热插拔事件,导致插入相应的内核模块和调用用户预定义的脚本。</p> </td>
</tr>
<tr>
<td>
<a id="hotplug-blacklist" name="hotplug-blacklist"></a><span class="term"><tt class="filename">/etc/hotplug/blacklist</tt></span> </td>
<td>
<p>
这个文件包含了那些禁止 Hotplug 脚本插入内核的模块列表。</p> </td>
</tr>
<tr>
<td>
<a id="hotplug-functions" name="hotplug-functions"></a><span class="term"><tt class="filename">/etc/hotplug/hotplug.functions</tt></span> </td>
<td>
<p>
这个文件包含了 Hotplug 包中其它脚本使用的公共函数。</p> </td>
</tr>
<tr>
<td>
<a id="hotplug-subdirs" name="hotplug-subdirs"></a><span class="term"><tt class="filename">/etc/hotplug/{pci,usb}</tt></span> </td>
<td>
<p>
这个目录包含用户自己编写的热插拔事件处理器。</p> </td>
</tr>
<tr>
<td>
<a id="hotplug-usb.usermap" name="hotplug-usb.usermap"></a><span class="term"><tt class="filename">/etc/hotplug/usb.usermap</tt></span> </td>
<td>
<p>
这个文件包含确定为每个USB设备调用哪个用户自定义的处理器的规则,这些规则基于 vendor ID 和 其它属性。</p> </td>
</tr>
<tr>
<td>
<a id="hotplug-hotplug.d" name="hotplug-hotplug.d"></a><span class="term"><tt class="filename">/etc/hotplug.d</tt></span> </td>
<td>
<p>
这个目录包含了那些对接受热插拔事件感兴趣的程序(或符号连接)。例如, Udev 将会在安装时把它的符号连接放在这里。</p> </td>
</tr>
<tr>
<td>
<a id="hotplug-firmware" name="hotplug-firmware"></a><span class="term"><tt class="filename">/lib/firmware</tt></span> </td>
<td>
<p>
这个目录包含了那些需要在使用前加载固件的设备的固件。</p> </td>
</tr>
<tr>
<td>
<a id="hotplug-events" name="hotplug-events"></a><span class="term"><tt class="filename">/var/log/hotplug/events</tt></span> </td>
<td>
<p>
这个文件包含了自系统启动以来所有的
<span><strong class="command">hotplug</strong></span> 调用事件。</p> </td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="navfooter">
<ul>
<li class="prev">
<a accesskey="p" href="gzip.html" title="Gzip-1.3.5">后退</a>
<p>
Gzip-1.3.5
</p>
</li>
<li class="next">
<a accesskey="n" href="man.html" title="Man-1.5p">前进</a>
<p>
Man-1.5p
</p>
</li>
<li class="up">
<a accesskey="u" href="chapter06.html" title="Chapter 6. 安装系统基础软件">上一级</a>.
</li>
<li class="home">
<a accesskey="h" href="../index.html" title="Linux From Scratch - Version 6.1">回首页</a>.
</li>
</ul>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -