old-www/HOWTO/Module-HOWTO/parm.html

227 lines
3.7 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML
><HEAD
><TITLE
>About Module Parameters</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="Linux Loadable Kernel Module HOWTO"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="How To Boot Without A Disk Device Driver"
HREF="x589.html"><LINK
REL="NEXT"
TITLE="Persistent Data"
HREF="x615.html"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Linux Loadable Kernel Module HOWTO</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="x589.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="x615.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="PARM"
></A
>8. About Module Parameters</H1
><P
>It is useful to compare parameters that get passed to LKMs and parameters
that get passed to modules that are bound into the base kernel, especially
since modules often can be run either way.</P
><P
>We've seen above that you pass parameters to an LKM by specifying
something like <TT
CLASS="LITERAL"
>io=0x300</TT
> on the
<B
CLASS="COMMAND"
>insmod</B
> command. For a module that is bound into
the base kernel, you pass parameters to it via the kernel boot
parameters. One common way to specify kernel boot parameters is at a
<B
CLASS="COMMAND"
>lilo</B
> boot prompt. Another is with an
<TT
CLASS="LITERAL"
>append</TT
> statement in the <B
CLASS="COMMAND"
>lilo</B
>
configuration file.</P
><P
>The kernel initializes an LKM at the time you load it. It initializes
a bound-in module at boot time.</P
><P
>Since there is only one string of kernel boot parameters, you need
some way within that string to identify which parameters go to which
modules. The rule for this is that if there is a module named
<TT
CLASS="LITERAL"
>xyz</TT
>, then a kernel boot parameter named
<TT
CLASS="PARAMETER"
><I
>xyz</I
></TT
> is for that module. The value of a kernel
boot parameter is an arbitrary string that makes sense only to the
module.</P
><P
>This is why you sometimes see an LKM whose only parameter is its own
name. E.g. you load the Mitsumi CDROM driver with a command like
<TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
> insmod mcd mcd=0x340</PRE
></FONT
></TD
></TR
></TABLE
>
It seems ridiculous to have the parameter named
<TT
CLASS="PARAMETER"
><I
>mcd</I
></TT
> instead of, say, <TT
CLASS="PARAMETER"
><I
>io</I
></TT
>,
but this is done for consistency with the case where you bind
<TT
CLASS="LITERAL"
>mcd</TT
> into the base kernel, in which case you would
select the I/O port address with the characters
<TT
CLASS="PARAMETER"
><I
>mcd=0x340</I
></TT
> in the kernel boot parameters.</P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="x589.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="x615.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>How To Boot Without A Disk Device Driver</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Persistent Data</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>