Sophie

Sophie

distrib > PLD > ra > i686 > by-pkgid > f234ed5000fa13679b1c31575cf9910c > files > 103

sag-0.7-1.noarch.rpm

<HTML
><HEAD
><TITLE
>The mknod command</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.63
"><LINK
REL="HOME"
TITLE="The Linux System Administrator's Guide"
HREF="index.html"><LINK
REL="UP"
TITLE="Device Files"
HREF="device-list.html"><LINK
REL="PREVIOUS"
TITLE="The MAKEDEV Script"
HREF="x782.html"><LINK
REL="NEXT"
TITLE="Device List"
HREF="x822.html"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>The Linux System Administrator's Guide: Version 0.7</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="x782.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 5. Device Files</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="x822.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN797"
>5.2. The <B
CLASS="COMMAND"
>mknod</B
> command</A
></H1
><P
><B
CLASS="COMMAND"
>MAKEDEV</B
> is the preferred way of creating
	device files which are not present.  However sometimes the
	<B
CLASS="COMMAND"
>MAKEDEV</B
> script will not know about the device
	file you wish to create.  This is where the <B
CLASS="COMMAND"
>mknod</B
>
	command comes in.  In order to use <B
CLASS="COMMAND"
>mknod</B
> you need
	to know the major and minor node numbers for the device you wish to
	create.  The <TT
CLASS="FILENAME"
>devices.txt</TT
> file in the kernel
	source documentation is the canonical source of this
	information.</P
><P
>To take an example, let us suppose that our version of the
	<B
CLASS="COMMAND"
>MAKEDEV</B
> script does not know how to create the
	<TT
CLASS="FILENAME"
>/dev/ttyS0</TT
> device file.  We need to use
	<B
CLASS="COMMAND"
>mknod</B
> to create it.  We know from looking at the
	<TT
CLASS="FILENAME"
>devices.txt</TT
> file that it should be a character
	device with major number 4 and minor number 64.  So we now know all
	we need to create the file.

        <TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>	<TT
CLASS="PROMPT"
>#</TT
> <TT
CLASS="USERINPUT"
><B
>mknod /dev/ttyS0 c 4 64</B
></TT
>
	<TT
CLASS="PROMPT"
>#</TT
> <TT
CLASS="USERINPUT"
><B
>chown root.dialout /dev/ttyS0</B
></TT
>
	<TT
CLASS="PROMPT"
>#</TT
> <TT
CLASS="USERINPUT"
><B
>chmod 0644 /dev/ttyS0</B
></TT
>
	<TT
CLASS="PROMPT"
>#</TT
> <TT
CLASS="USERINPUT"
><B
>ls -l /dev/ttyS0</B
></TT
>
<TT
CLASS="COMPUTEROUTPUT"
>crw-rw----   1 root dialout    4,   64 Oct 23 18:23 /dev/ttyS0</TT
> 
	</PRE
></FONT
></TD
></TR
></TABLE
>

	As you can see, many more steps are required to create the file.  In
	this example you can see the process required however.  It is
	unlikely in the extreme that the ttyS0 file would not be provided by
	the <B
CLASS="COMMAND"
>MAKEDEV</B
> script, but it suffices to illustrate
	the point.</P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="x782.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="x822.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>The <B
CLASS="COMMAND"
>MAKEDEV</B
> Script</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="device-list.html"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Device List</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>