629 lines
11 KiB
HTML
629 lines
11 KiB
HTML
<HTML
|
|
><HEAD
|
|
><TITLE
|
|
>Recompiling the Kernel for Modules</TITLE
|
|
><META
|
|
NAME="GENERATOR"
|
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.63
|
|
"><LINK
|
|
REL="HOME"
|
|
TITLE="Linux Kernel Modules Installation HOWTO"
|
|
HREF="index.html"><LINK
|
|
REL="PREVIOUS"
|
|
TITLE="Compiler Speed-up"
|
|
HREF="speedup.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"
|
|
>Linux Kernel Modules Installation HOWTO</TH
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="left"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="speedup.html"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="80%"
|
|
ALIGN="center"
|
|
VALIGN="bottom"
|
|
></TD
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="right"
|
|
VALIGN="bottom"
|
|
> </TD
|
|
></TR
|
|
></TABLE
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"></DIV
|
|
><DIV
|
|
CLASS="SECT1"
|
|
><H1
|
|
CLASS="SECT1"
|
|
><A
|
|
NAME="KERNEL"
|
|
>4. Recompiling the Kernel for Modules</A
|
|
></H1
|
|
><P
|
|
> The kernel can be reconfigured to use modules for everything other than
|
|
the file system mounted as root (in most cases, this is the ext2 file
|
|
system).
|
|
</P
|
|
><P
|
|
> However, there are certain items that appear to be difficult to set up
|
|
properly as modules, so I would recommend the following be compiled into
|
|
the kernel:
|
|
</P
|
|
><P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
> Ethernet hardware drivers.
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> SCSI CD-ROM drivers.
|
|
</P
|
|
></LI
|
|
></UL
|
|
><P
|
|
> On the other hand, there are certain driver combinations that
|
|
<EM
|
|
>ONLY</EM
|
|
> work as modules, especially combinations
|
|
of two or more of the following group:
|
|
</P
|
|
><P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
> A Parallel Printer,
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> A Parallel Port drive, such as the <EM
|
|
>IOMEGA</EM
|
|
> ZipDrive or
|
|
JazzDrive, or the <EM
|
|
>BackPack</EM
|
|
> CD-ROM drive, and
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> The <EM
|
|
>PLIP</EM
|
|
> Daemon.
|
|
</P
|
|
></LI
|
|
></UL
|
|
><P
|
|
> You will need to decide what you are compiling into the kernel, and
|
|
what as modules, but should take the above points into consideration. The
|
|
actual choices are made during the compilation, by the second of the
|
|
following sequence of instructions:
|
|
</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><FONT
|
|
COLOR="#000000"
|
|
><PRE
|
|
CLASS="PROGRAMLISTING"
|
|
>cd /usr/src/linux
|
|
make menuconfig
|
|
make dep clean modules modules_install zImage
|
|
</PRE
|
|
></FONT
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
> Having done that, the module dependencies need to be mapped out. This
|
|
is done with the following command:
|
|
</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><FONT
|
|
COLOR="#000000"
|
|
><PRE
|
|
CLASS="PROGRAMLISTING"
|
|
>depmod -a
|
|
</PRE
|
|
></FONT
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
> The new kernel now needs to be inserted in the boot chain. I am
|
|
assuming the reader is using <SPAN
|
|
CLASS="APPLICATION"
|
|
>LILO</SPAN
|
|
> for this purpose, since this is the only
|
|
loader I have any experience with.
|
|
</P
|
|
><P
|
|
> I recommend that one does NOT automatically insert the newly compiled
|
|
kernel as the default Linux kernel since if it should fail, it is then
|
|
extremely difficult to recover one's Linux setup without doing a complete
|
|
reinstallation, which is not to be recommended. For this reason, I have
|
|
the following entry in my <TT
|
|
CLASS="FILENAME"
|
|
>/etc/lilo.conf</TT
|
|
> file:
|
|
</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><FONT
|
|
COLOR="#000000"
|
|
><PRE
|
|
CLASS="PROGRAMLISTING"
|
|
>image=/usr/src/linux/arch/i386/boot/zImage
|
|
label=new
|
|
alias=n
|
|
read-only
|
|
vga=ask
|
|
optional
|
|
</PRE
|
|
></FONT
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
> This entry says that there is an OPTIONAL boot option (which will be
|
|
ignored if the image in question does not exist) which boots the file
|
|
<TT
|
|
CLASS="FILENAME"
|
|
>/boot/newlinux</TT
|
|
> if selected, and allows one to select
|
|
the video mode it is to be booted in.
|
|
</P
|
|
><P
|
|
> Assuming the existence of the above entry in <TT
|
|
CLASS="FILENAME"
|
|
>/etc/lilo.conf</TT
|
|
>
|
|
the revised kernel is already correctly located at the end of compilation, and
|
|
it can be installed via the following command:
|
|
</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><FONT
|
|
COLOR="#000000"
|
|
><PRE
|
|
CLASS="PROGRAMLISTING"
|
|
>lilo
|
|
</PRE
|
|
></FONT
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
> Having done that, the reader needs to follow the further steps relevant
|
|
to their selected distribution, as follows:
|
|
</P
|
|
><DIV
|
|
CLASS="SECT2"
|
|
><H2
|
|
CLASS="SECT2"
|
|
><A
|
|
NAME="REDHAT"
|
|
>5.1. Configuring Debian or RedHat for Modules</A
|
|
></H2
|
|
><P
|
|
> Prior to carrying out the steps listed here, the steps listed in
|
|
<SPAN
|
|
CLASS="QUOTE"
|
|
>"<A
|
|
HREF="kernel.html"
|
|
><I
|
|
>Recompiling the Kernel for Modules</I
|
|
></A
|
|
>"</SPAN
|
|
>
|
|
are assumed to have been carried out.
|
|
</P
|
|
><P
|
|
> The Debian and RedHat distributions have identical boot procedures, so
|
|
also have identical procedures for configuring modules into them.
|
|
</P
|
|
><P
|
|
></P
|
|
><OL
|
|
TYPE="1"
|
|
><LI
|
|
><P
|
|
> Having logged in as root, use your favourite text editor to create
|
|
a new file called <TT
|
|
CLASS="FILENAME"
|
|
>/etc/rc.d/init.d/modules.init</TT
|
|
>
|
|
with the following contents therein:
|
|
</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="90%"
|
|
><TR
|
|
><TD
|
|
><FONT
|
|
COLOR="#000000"
|
|
><PRE
|
|
CLASS="PROGRAMLISTING"
|
|
># Modules initialisation.
|
|
#
|
|
# Start up the module auto-loading daemon.
|
|
/sbin/kerneld
|
|
|
|
# Mount all currently unmounted auto-mounted partitions.
|
|
/sbin/mount -a
|
|
</PRE
|
|
></FONT
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
></LI
|
|
><LI
|
|
><P
|
|
> Having created the above file, perform the following steps whilst
|
|
logged on as root:
|
|
</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="90%"
|
|
><TR
|
|
><TD
|
|
><FONT
|
|
COLOR="#000000"
|
|
><PRE
|
|
CLASS="PROGRAMLISTING"
|
|
>cd /etc/rc.d
|
|
chmod 755 init.d/*
|
|
cd rc3.d
|
|
ln -s ../init.d/modules.init 05modules.init
|
|
</PRE
|
|
></FONT
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
></LI
|
|
></OL
|
|
><P
|
|
> The system can now be rebooted, and on doing so, it will be found that
|
|
modules are fully implemented
|
|
</P
|
|
></DIV
|
|
><DIV
|
|
CLASS="SECT2"
|
|
><H2
|
|
CLASS="SECT2"
|
|
><A
|
|
NAME="SLACKWARE"
|
|
>5.2. Configuring Slackware for Modules</A
|
|
></H2
|
|
><P
|
|
> Prior to carrying out the steps listed here, the steps listed in
|
|
<SPAN
|
|
CLASS="QUOTE"
|
|
>"<A
|
|
HREF="kernel.html"
|
|
><I
|
|
>Recompiling the Kernel for Modules</I
|
|
></A
|
|
>"</SPAN
|
|
>
|
|
are assumed to have been carried out.
|
|
</P
|
|
><P
|
|
> The file <TT
|
|
CLASS="FILENAME"
|
|
>/etc/rc.d/rc.M</TT
|
|
> needs to be edited as follows:
|
|
</P
|
|
><P
|
|
></P
|
|
><OL
|
|
TYPE="1"
|
|
><LI
|
|
><P
|
|
> Around line 18, there is a section reading as follows:
|
|
</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="90%"
|
|
><TR
|
|
><TD
|
|
><FONT
|
|
COLOR="#000000"
|
|
><PRE
|
|
CLASS="PROGRAMLISTING"
|
|
># Screen blanks after 15 minutes idle time.
|
|
/bin/setterm -blank 15
|
|
</PRE
|
|
></FONT
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
> Immediately after this, insert the following paragraph, with the usual
|
|
blank lines either side of it:
|
|
</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="90%"
|
|
><TR
|
|
><TD
|
|
><FONT
|
|
COLOR="#000000"
|
|
><PRE
|
|
CLASS="PROGRAMLISTING"
|
|
># Load the kernel module auto-loader.
|
|
/sbin/kerneld
|
|
</PRE
|
|
></FONT
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
></LI
|
|
><LI
|
|
><P
|
|
> About 12 lines further down is the following:
|
|
</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="90%"
|
|
><TR
|
|
><TD
|
|
><FONT
|
|
COLOR="#000000"
|
|
><PRE
|
|
CLASS="PROGRAMLISTING"
|
|
># if there is no /etc/HOSTNAME, fall back on this default:
|
|
</PRE
|
|
></FONT
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
> Immediately prior to this, insert the following paragraph, again with the
|
|
usual blank lines either side of it:
|
|
</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="90%"
|
|
><TR
|
|
><TD
|
|
><FONT
|
|
COLOR="#000000"
|
|
><PRE
|
|
CLASS="PROGRAMLISTING"
|
|
># Mount remaining unmounted auto-mount drives.
|
|
/sbin/mount -a
|
|
</PRE
|
|
></FONT
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
></LI
|
|
></OL
|
|
><P
|
|
> When those changes have been made, save the file.
|
|
</P
|
|
><P
|
|
> No further modifications are required for Slackware.
|
|
</P
|
|
></DIV
|
|
><DIV
|
|
CLASS="SECT2"
|
|
><H2
|
|
CLASS="SECT2"
|
|
><A
|
|
NAME="OTHERDIST"
|
|
>5.3. Configuring Other Distributions for Modules</A
|
|
></H2
|
|
><P
|
|
> Prior to carrying out the steps listed here, the steps listed in
|
|
<SPAN
|
|
CLASS="QUOTE"
|
|
>"<A
|
|
HREF="kernel.html"
|
|
><I
|
|
>Recompiling the Kernel for Modules</I
|
|
></A
|
|
>"</SPAN
|
|
>
|
|
are assumed to have been carried out.
|
|
</P
|
|
><P
|
|
> The precise procedure for other distributions has not been ascertained,
|
|
but is probably one of the above. To determine which one, display a
|
|
directory of the contents of the <TT
|
|
CLASS="FILENAME"
|
|
>/etc/rc.d</TT
|
|
> directory,
|
|
as follows:
|
|
</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><FONT
|
|
COLOR="#000000"
|
|
><PRE
|
|
CLASS="PROGRAMLISTING"
|
|
>cd /etc/rc.d
|
|
ls -l *.d rc.*
|
|
</PRE
|
|
></FONT
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
> From this resulting display, you can select one of the following three
|
|
options:
|
|
</P
|
|
><P
|
|
></P
|
|
><OL
|
|
TYPE="1"
|
|
><LI
|
|
><P
|
|
> If this list includes a directory named <TT
|
|
CLASS="FILENAME"
|
|
>init.d</TT
|
|
> and some
|
|
directories with names matching <TT
|
|
CLASS="FILENAME"
|
|
>rc?.d</TT
|
|
> where the
|
|
question mark is replaced by single digits, and does <EM
|
|
>NOT</EM
|
|
>
|
|
include a file with the name <TT
|
|
CLASS="FILENAME"
|
|
>rc.M</TT
|
|
>, that distribution can
|
|
be configured for modules by following the procedure listed under the title
|
|
<SPAN
|
|
CLASS="QUOTE"
|
|
>"<A
|
|
HREF="kernel.html#REDHAT"
|
|
><I
|
|
>Configuring Debian or RedHat for Modules</I
|
|
></A
|
|
>"</SPAN
|
|
>.
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> If this list does not include a directory named <TT
|
|
CLASS="FILENAME"
|
|
>init.d</TT
|
|
> but
|
|
includes a file named <TT
|
|
CLASS="FILENAME"
|
|
>rc.M</TT
|
|
> then that distribution can
|
|
be configured for modules by following the procedure listed under the title
|
|
<SPAN
|
|
CLASS="QUOTE"
|
|
>"<A
|
|
HREF="kernel.html#SLACKWARE"
|
|
><I
|
|
>Configuring Slackware for Modules</I
|
|
></A
|
|
>"</SPAN
|
|
>.
|
|
</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
> If this list matches neither of the above criteria, then the
|
|
distribution has a boot script not covered by this HowTo. In that case,
|
|
you are invited to contact the author of this document for advice.
|
|
</P
|
|
></LI
|
|
></OL
|
|
></DIV
|
|
></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="speedup.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"
|
|
> </TD
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
>Compiler Speed-up</TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
> </TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
> </TD
|
|
></TR
|
|
></TABLE
|
|
></DIV
|
|
></BODY
|
|
></HTML
|
|
> |