⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 building dd.htm

📁 What is this ``device driver stuff anyway? Here s a very short introduction to the concept.
💻 HTM
📖 第 1 页 / 共 5 页
字号:
This name is a string that matches the string you specified for the
<tt><var>entry_name</var></tt>
item in the
<tt>/etc/sysconfigtab</tt>
database.
Typically, third-party driver writers specify the driver name (followed
by a colon) in the
<tt>sysconfigtab</tt>
file fragment, which gets appended to the
<tt>/etc/sysconfigtab</tt>
database during the driver product installation.
</p><p></p></li><li>
<tt>standard</tt>
<p>
The
<tt>standard</tt>
keyword indicates that the module will be included in every
kernel.
Note that the
<tt>sourceconfig</tt>
program ignores the
<tt>standard</tt>
keyword.
</p><p></p></li><li>
<tt>Binary</tt>
<p>
The
<tt>Binary</tt>
keyword causes the
<tt>sourceconfig</tt>
program to generate the build rules in the
<tt>BINARY</tt>
<tt>Makefile</tt>.
When this
<tt>Makefile</tt>
is run to build the driver module, the single binary module (a file with
a
<tt>.mod</tt>
extension) is placed in the
<tt>/usr/sys/BINARY</tt>
directory.
A soft link is created in the directory that contains the driver product
files (for EasyDriver Incorporated, the
<tt>/usr/sys/io/ESA100</tt>
directory) that points to the
<tt>.mod</tt>
file (for EasyDriver Incorporated, the
<tt>none.mod</tt>
file) that resides in the
<tt>/usr/sys/BINARY</tt>
directory.
</p></li></ul><p>
<a href="#co_id_92_rtn_1">[Return to example]</a>
</p><p></p></li><li>
<a name="co_id_92_2"></a>
Gives the path and source file name or names that make up the driver
product.
The driver writer at EasyDriver Incorporated specifies
<tt>io/ESA100/none.c</tt>
as the path and source file name.
The driver writer at EasyDriver Incorporated also specifies the
<tt>MODULE</tt>
keyword followed by the token that represents the driver name,
<tt>none</tt>.
<p>
Replace the path and source file name with the path and source file name
associated with your driver product.
Also replace the token following the
<tt>module</tt>
keyword with the token that represents the name of your driver
product.
<a href="#co_id_92_rtn_2">[Return to example]</a>
</p></li></ol><p>
<a name="CreBINARYdotlistFileSingBinMod"></a>
</p><p></p><hr><p align="center">
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/Digital_UNIX_Bookshelf.html"><img src="building%20DD_files/BOOKSHELF.GIF" alt="[Return to Library]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/TOC.html"><img src="building%20DD_files/TOC.GIF" alt="[Contents]" border="0"></a>
<a href="#ConfigModuleDynamicDrv"><img src="building%20DD_files/REW.GIF" alt="[Previous Chapter]" border="0"></a>
<a href="#CrefilesFileFragforSingBinMod"><img src="building%20DD_files/PREV.GIF" alt="[Previous Section]" border="0"></a>
<a href="#StaticConfigCresysconfigtab"><img src="building%20DD_files/NEXT.GIF" alt="[Next Section]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut20.html"><img src="building%20DD_files/FF.GIF" alt="[Next Chapter]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/INDEX.html"><img src="building%20DD_files/INDEX.GIF" alt="[Index]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/HELP.html"><img src="building%20DD_files/HELP.GIF" alt="[Help]" border="0"></a>
</p><p></p><hr><p>
</p><h3>
14.1.4&nbsp;&nbsp;&nbsp;&nbsp;Step 4: Create a BINARY.list File
</h3>
<p>
<a name="nx_id_598"></a>
<a name="nx_id_599"></a>
Use an editor such as
<tt>vi</tt>
to create a
<tt>BINARY.list</tt>
file: 
</p><p>
</p><pre># cd /usr/sys/conf <a name="co_id_93_rtn_1"></a><a href="#co_id_93_1"><strong>[1]</strong></a>
# vi BINARY.list <a name="co_id_93_rtn_2"></a><a href="#co_id_93_2"><strong>[2]</strong></a>
</pre>
<p>
</p><ol>
<p></p><li>
<a name="co_id_93_1"></a>
Shows that the driver writer at EasyDriver Incorporated changes to the
<tt>/usr/sys/conf</tt>
directory. 
<p>
You should also change to the
<tt>/usr/sys/conf</tt>
directory.
<a href="#co_id_93_rtn_1">[Return to example]</a>
</p><p></p></li><li>
<a name="co_id_93_2"></a>
Shows that the driver writer at EasyDriver Incorporated uses the
<tt>vi</tt>
editor to create the
<tt>BINARY.list</tt>
file. 
<p>
You can use
<tt>vi</tt>
or another editor to create your
<tt>BINARY.list</tt>
file. 
<a href="#co_id_93_rtn_2">[Return to example]</a>
</p></li></ol><p>
</p><p>
The following example shows the contents of the
<tt>BINARY.list</tt>
file that the driver writer at EasyDriver Incorporated creates:
</p><p>
</p><pre>/usr/sys/io/ESA100: <a name="co_id_94_rtn_1"></a><a href="#co_id_94_1"><strong>[1]</strong></a>
</pre>
<p>
</p><ol>
<p></p><li>
<a name="co_id_94_1"></a>
Shows the typical contents of a
<tt>BINARY.list</tt>
file.
The contents is the directory path where you placed the driver
product-related files.
You created this directory in
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut19.html#CreDirContainDrvProdFiles">Section 14.1.1</a>
(Step 1). 
For EasyDriver Incorporated, this directory is:
<p>
<tt>/usr/sys/io/ESA100:</tt>
</p><p>
Replace the path and source file name with the path and source file name
associated with your driver product.
You must follow the path and source file name with a colon (:), as shown
in the example.
<a href="#co_id_94_rtn_1">[Return to example]</a>
</p></li></ol><p>
<br>
<a name="StaticConfigCresysconfigtab"></a>
</p><p></p><hr><p align="center">
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/Digital_UNIX_Bookshelf.html"><img src="building%20DD_files/BOOKSHELF.GIF" alt="[Return to Library]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/TOC.html"><img src="building%20DD_files/TOC.GIF" alt="[Contents]" border="0"></a>
<a href="#ConfigModuleDynamicDrv"><img src="building%20DD_files/REW.GIF" alt="[Previous Chapter]" border="0"></a>
<a href="#CreBINARYdotlistFileSingBinMod"><img src="building%20DD_files/PREV.GIF" alt="[Previous Section]" border="0"></a>
<a href="#RunsourceconfigforSingBinMod"><img src="building%20DD_files/NEXT.GIF" alt="[Next Section]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut20.html"><img src="building%20DD_files/FF.GIF" alt="[Next Chapter]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/INDEX.html"><img src="building%20DD_files/INDEX.GIF" alt="[Index]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/HELP.html"><img src="building%20DD_files/HELP.GIF" alt="[Help]" border="0"></a>
</p><p></p><hr><p>
</p><h3>
14.1.5&nbsp;&nbsp;&nbsp;&nbsp;Step 5: Create a sysconfigtab File Fragment
</h3>
<p>
<a name="nx_id_600"></a>
<a name="nx_id_601"></a>
Use an editor such as
<tt>vi</tt>
to create a
<tt>sysconfigtab</tt>
file fragment: 
</p><p>
</p><pre># cd /usr/sys/io/ESA100 <a name="co_id_95_rtn_1"></a><a href="#co_id_95_1"><strong>[1]</strong></a>

# vi sysconfigtab <a name="co_id_95_rtn_2"></a><a href="#co_id_95_2"><strong>[2]</strong></a>
</pre>
<p>
</p><ol>
<p></p><li>
<a name="co_id_95_1"></a>
Shows that the driver writer at EasyDriver Incorporated changes to the
directory created in
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut19.html#CreDirContainDrvProdFiles">Section 14.1.1</a>
(Step 1). 
<p>
You should also change to the directory that you created in
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut19.html#CreDirContainDrvProdFiles">Section 14.1.1</a>
(Step 1). 
<a href="#co_id_95_rtn_1">[Return to example]</a>
</p><p></p></li><li>
<a name="co_id_95_2"></a>
Shows that the driver writer at EasyDriver Incorporated uses the
<tt>vi</tt>
editor to create the
<tt>sysconfigtab</tt>
file fragment.
<p>
You can use
<tt>vi</tt>
or another editor to create your
<tt>sysconfigtab</tt>
file fragment.
<a href="#co_id_95_rtn_2">[Return to example]</a>
</p></li></ol><p>
</p><p>
The following example shows the possible contents of the
<tt>sysconfigtab</tt>
file fragment that the driver writer at EasyDriver Incorporated creates:
</p><p>
</p><pre>none:
  Module_Config_Name = none <a name="co_id_96_rtn_1"></a><a href="#co_id_96_1"><strong>[1]</strong></a>
  Device_Dir = /dev <a name="co_id_96_rtn_2"></a><a href="#co_id_96_2"><strong>[2]</strong></a>
  Device_Char_Major = ANY <a name="co_id_96_rtn_3"></a><a href="#co_id_96_3"><strong>[3]</strong></a>
  Device_Char_Minor = 0 <a name="co_id_96_rtn_4"></a><a href="#co_id_96_4"><strong>[4]</strong></a>
  Device_Char_Files = none <a name="co_id_96_rtn_5"></a><a href="#co_id_96_5"><strong>[5]</strong></a>
  Device_User = root <a name="co_id_96_rtn_6"></a><a href="#co_id_96_6"><strong>[6]</strong></a>
  Device_Group = 0 <a name="co_id_96_rtn_7"></a><a href="#co_id_96_7"><strong>[7]</strong></a>
  Device_Mode = 666 <a name="co_id_96_rtn_8"></a><a href="#co_id_96_8"><strong>[8]</strong></a>
  Device_Major_Req = Same <a name="co_id_96_rtn_9"></a><a href="#co_id_96_9"><strong>[9]</strong></a>
  TC_Option = Modname - 'NONE    ', Driver_Name - none, Type - C,
              Adpt_Config - N <a name="co_id_96_rtn_10"></a><a href="#co_id_96_10"><strong>[10]</strong></a>
</pre>
<p>
</p><ol>
<p></p><li>
<a name="co_id_96_1"></a>
Shows that the driver writer at EasyDriver Incorporated assigns the driver
product name
<tt>none</tt>
to the
<tt>Module_Config_Name</tt>
field.
<p>
This name is a string that matches the string you specified for the
<tt><var>entry_name</var></tt>
item in the
<tt>/etc/sysconfigtab</tt>
database.
Typically, third-party driver writers specify the driver name (followed
by a colon) in the
<tt>sysconfigtab</tt>
file fragment, which gets appended to the
<tt>/etc/sysconfigtab</tt>
database during the driver product installation.
See
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut18.html#figStanzaFileFormat">Figure 13-4</a>
for a description of the
<tt><var>entry_name</var></tt>
item.
</p><p>
You should specify the
<tt>Module_Config_Name</tt>
field with the name of your driver product.
<a href="#co_id_96_rtn_1">[Return to example]</a>
</p><p></p></li><li>
<a name="co_id_96_2"></a>
Shows that the driver writer at EasyDriver Incorporated assigns the directory
<tt>/dev</tt>
to the
<tt>Device_Dir</tt>
field.
This directory is where the device special files for the
<tt>/dev/none</tt>
driver will be located.
<p>
You should specify the
<tt>Device_Dir</tt>
field with the
<tt>/dev</tt>
specification for your driver product or replace it with some other
directory specification.
<a href="#co_id_96_rtn_2">[Return to example]</a>
</p><p></p></li><li>
<a name="co_id_96_3"></a>
Shows that the driver writer at EasyDriver Incorporated assigns the value
<tt>ANY</tt>
to the
<tt>Device_Char_Major</tt>
field.
This field indicates that the device special files associated with the
driver product will be created and will be assigned a major number.
<p>
The device special files for the driver product have an associated major
number.
You obtained this major number by calling the
<tt>devsw_add</tt>
interface. 
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut10.html#ReserveMajorNumber">Section 6.6.5.2</a>
discusses how to reserve a major number by calling the
<tt>devsw_add</tt>
interface.
Use the value
<tt>ANY</tt>
to indicate that the device special files will be created and that the
associated major number was reserved when the driver's
<tt>configure</tt>
interface calls the
<tt>devsw_add</tt>
interface.
<a href="#co_id_96_rtn_3">[Return to example]</a>
</p><p></p></li><li>
<a name="co_id_96_4"></a>
Shows that the driver writer at EasyDriver Incorporated assigns the value
zero (0) to the
<tt>Device_Char_Minor</tt>
field.
This field identifies the minor number for the character device
controlled by the
<tt>/dev/none</tt>
driver.
Use a single value as the minor number for the character device
controlled by your driver product.
Or, specify the minor number as follows:
<ul>
<p></p><li>
One device minor number, for example:
<p>
<tt>Device_Char_Minor = 1</tt>
</p><p>
To specify a single device minor number, simply specify the number.
The device minor number must be a positive integer that cannot
exceed 99999.
A maximum of 512 device special files can be created for a device major
number, unless a driver is both a block and character device.
In this case, the maximum is 1024 device special files (512 for the
block and 512 for the character drivers).
</p><p></p></li><li>
More than one device minor number, for example:
<p>
<tt>Device_Char_Minor = 0,1,2,3</tt>
</p><p>
To specify more than one device minor number, specify the numbers
separated by commas.
Each device minor number must be greater than the one previously
specified. 
</p><p></p></li><li>
A range of device minor numbers, for example:
<p>
<tt>Device_Char_Minor = [0-10]</tt>
</p><p>
To specify a range of device minor numbers, enclose the range within
brackets ([]) and separate the beginning and ending values with a
dash (-).
The following rules apply to numbers specified in a range:
</p><ul>
<p></p><li>
The ending number must be greater than the beginning number, as in the
example.
Thus,
<tt>[10-0]</tt>
is an invalid range specification.
<p></p></li><li>
The numbers specified in the range must be greater than the value zero
(0).
Thus,
<tt>[-1-10]</tt>
is also an invalid range specification because the first number is less
than the value zero (0).
<p></p></li><li>
The largest allowable number in the range is 99999.
<p></p></li><li>
A maximum of 512 device special files can be created for any device
major number.
Thus,
<tt>[0-511]</tt>
and
<tt>[1000-1500]</tt>
are valid range specifications while
<tt>[0-600]</tt>
is invalid.
</li></ul><p>
</p><p></p></li><li>
More than one range of device minor numbers, for example:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -