old-www/HOWTO/Remote-Serial-Console-HOWTO/configure-kernel.html

606 lines
9.4 KiB
HTML

<HTML
><HEAD
><TITLE
>Configure Linux
kernel</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="Remote Serial Console HOWTO"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="Configure the SYSLINUX boot
loader"
HREF="configure-boot-loader-syslinux.html"><LINK
REL="NEXT"
TITLE="Configure Linux kernel using
LILO"
HREF="configure-kernel-lilo.html"></HEAD
><BODY
CLASS="CHAPTER"
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"
>Remote Serial Console HOWTO</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="configure-boot-loader-syslinux.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="configure-kernel-lilo.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="CONFIGURE-KERNEL"
></A
>Chapter 5. Configure <SPAN
CLASS="SYSTEMITEM"
>Linux</SPAN
>
kernel</H1
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
>5.1. <A
HREF="configure-kernel-lilo.html"
>Configure Linux kernel using
<SPAN
CLASS="APPLICATION"
>LILO</SPAN
></A
></DT
><DT
>5.2. <A
HREF="configure-kernel-grub.html"
>Configure Linux kernel using
<SPAN
CLASS="APPLICATION"
>GRUB</SPAN
></A
></DT
><DT
>5.3. <A
HREF="configure-kernel-syslinux.html"
>Configure Linux kernel using
<SPAN
CLASS="APPLICATION"
>SYSLINUX</SPAN
></A
></DT
></DL
></DIV
><P
>The <SPAN
CLASS="SYSTEMITEM"
>Linux</SPAN
> kernel is
configured to select the console by passing it the
<TT
CLASS="LITERAL"
>console</TT
> parameter. The
<TT
CLASS="LITERAL"
>console</TT
> parameter can be given repeatedly, but
the parameter can only be given once for each console technology.
So <TT
CLASS="LITERAL"
>console=tty0 console=lp0 console=ttyS0</TT
> is
acceptable but <TT
CLASS="LITERAL"
>console=ttyS0 console=ttyS1</TT
> will
not work.</P
><P
>When multiple consoles are listed output is sent to all
consoles and input is taken from the last listed console. The last
<TT
CLASS="LITERAL"
>console</TT
> is the one Linux uses as the <TT
CLASS="FILENAME"
>/dev/console</TT
> device.</P
><P
>The syntax of the <TT
CLASS="LITERAL"
>console</TT
> parameter is
given in <A
HREF="configure-kernel.html#CONFIGURE-KERNEL-SYNTAX"
>Figure 5-1</A
>.</P
><DIV
CLASS="FIGURE"
><A
NAME="CONFIGURE-KERNEL-SYNTAX"
></A
><P
><B
>Figure 5-1. Kernel <TT
CLASS="LITERAL"
>console</TT
> syntax, in EBNF</B
></P
><P
CLASS="LITERALLAYOUT"
><TT
CLASS="LITERAL"
>console=ttyS</TT
><TT
CLASS="REPLACEABLE"
><I
>&#60;serial_port&#62;</I
></TT
>[<TT
CLASS="LITERAL"
>,</TT
><TT
CLASS="REPLACEABLE"
><I
>&#60;mode&#62;</I
></TT
>]<br>
<TT
CLASS="LITERAL"
>console=tty</TT
><TT
CLASS="REPLACEABLE"
><I
>&#60;virtual_terminal&#62;</I
></TT
><br>
<TT
CLASS="LITERAL"
>console=lp</TT
><TT
CLASS="REPLACEABLE"
><I
>&#60;parallel_port&#62;</I
></TT
><br>
<TT
CLASS="LITERAL"
>console=ttyUSB</TT
>[<TT
CLASS="REPLACEABLE"
><I
>&#60;usb_port&#62;</I
></TT
>[<TT
CLASS="LITERAL"
>,</TT
><TT
CLASS="REPLACEABLE"
><I
>&#60;mode&#62;</I
></TT
>]</P
></DIV
><P
><TT
CLASS="REPLACEABLE"
><I
>&#60;serial_port&#62;</I
></TT
> is the number
of the serial port. This is defined in <A
HREF="configure-boot-loader-lilo.html#CONFIGURE-BOOT-LOADER-LILO-EBNF"
>Figure 4-2</A
> and discussed in <A
HREF="preparation-setport.html"
>Section 2.2</A
>. The examples in this
<I
CLASS="CITETITLE"
>HOWTO</I
> use the first serial port, giving
<TT
CLASS="REPLACEABLE"
><I
>&#60;serial_port&#62;</I
></TT
> the value
<TT
CLASS="LITERAL"
>0</TT
>, which in turn gives kernel parameter
<TT
CLASS="LITERAL"
>console=ttyS0</TT
>.</P
><P
>If you are using the <SPAN
CLASS="APPLICATION"
>devfs</SPAN
> device
filesystem with your Linux installation the kernel parameter for the
first serial port is still <TT
CLASS="LITERAL"
>ttyS0</TT
>, even though the
first serial device is no longer known as <TT
CLASS="FILENAME"
>/dev/ttyS0</TT
> but as <TT
CLASS="FILENAME"
>/dev/ttys/0</TT
>.</P
><P
><TT
CLASS="REPLACEABLE"
><I
>&#60;mode&#62;</I
></TT
> is defined in <A
HREF="preparation-setspeed.html#PREPARATION-SETSPEED-MODESYNTAX"
>Figure 2-7</A
> and is discussed in <A
HREF="preparation-setspeed.html"
>Section 2.3</A
>. The examples in this
<I
CLASS="CITETITLE"
>HOWTO</I
> use 9600 bits per second, one start
bit, eight data bits, no parity, one stop bit, and no
<SPAN
CLASS="ACRONYM"
>CTS</SPAN
>/<SPAN
CLASS="ACRONYM"
>RTS</SPAN
> flow control giving
<TT
CLASS="REPLACEABLE"
><I
>&#60;mode&#62;</I
></TT
> the value of
<TT
CLASS="LITERAL"
>9600n8</TT
>. When the current kernel flow control
bugs are corrected this <I
CLASS="CITETITLE"
>HOWTO</I
> will once again
recommend the value <TT
CLASS="LITERAL"
>9600n8r</TT
>.</P
><P
><TT
CLASS="REPLACEABLE"
><I
>&#60;usb_port&#62;</I
></TT
> can specify the
address of a <SPAN
CLASS="ACRONYM"
>USB</SPAN
> dongle containing a serial port
to be used as a serial console.<A
NAME="AEN1301"
HREF="#FTN.AEN1301"
><SPAN
CLASS="footnote"
>[1]</SPAN
></A
>
For example, the serial port <TT
CLASS="LITERAL"
>console=ttyS0,9600n8</TT
>
when moved to a <SPAN
CLASS="ACRONYM"
>USB</SPAN
> serial dongle would be
written as <TT
CLASS="LITERAL"
>console=ttyUSB0,9600n8</TT
>. The
<SPAN
CLASS="ACRONYM"
>USB</SPAN
> subsystem is started rather late in the boot
process, console messages printed during boot before the
<SPAN
CLASS="ACRONYM"
>USB</SPAN
> subsystem is loaded will be lost.</P
><P
>With no <TT
CLASS="LITERAL"
>console</TT
> parameter the kernel will
use the first virtual terminal, which is <TT
CLASS="FILENAME"
>/dev/tty0</TT
>. A user at the keyboard
uses this virtual terminal by pressing
<B
CLASS="KEYCAP"
>Ctrl</B
>-<B
CLASS="KEYCAP"
>Alt</B
>-<B
CLASS="KEYCAP"
>F1</B
>.</P
><P
>If your computer contains a video card then we suggest that
you also configure it as a console. This is done with the kernel
parameter <TT
CLASS="LITERAL"
>console=tty0</TT
>.</P
><P
>For computers with both a video card and a serial console in
the port marked <SPAN
CLASS="QUOTE"
>"<SPAN
CLASS="ACRONYM"
>COM1:</SPAN
>"</SPAN
> this
<I
CLASS="CITETITLE"
>HOWTO</I
> suggests the kernel parameters:</P
><DIV
CLASS="FIGURE"
><A
NAME="CONFIGURE-KERNEL-PARAMETERS-VIDEO"
></A
><P
><B
>Figure 5-2. Recommended kernel parameters, <SPAN
CLASS="ACRONYM"
>PC</SPAN
>s with
video card</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="PROGRAMLISTING"
>console=tty0 console=ttyS0,9600n8</PRE
></FONT
></TD
></TR
></TABLE
></DIV
><P
>Kernel messages will appear on both the first virtual terminal
and the serial port. Messages from the
<SPAN
CLASS="APPLICATION"
>init</SPAN
> system and the system logger will
appear only on the first serial port. This can be slightly
confusing when looking at the attached monitor: the machine will
appear to boot and then hang. Don't panic, the
<SPAN
CLASS="APPLICATION"
>init</SPAN
> system has started but is now
printing messages to the serial port but is printing nothing to the
screen. If a <SPAN
CLASS="APPLICATION"
>getty</SPAN
> has been configured
then a <TT
CLASS="COMPUTEROUTPUT"
>login:</TT
> prompt will
eventually appear on the attached monitor.</P
><P
>For <SPAN
CLASS="ACRONYM"
>PC</SPAN
>s without a video card, this
<I
CLASS="CITETITLE"
>HOWTO</I
> suggests the kernel parameters:</P
><DIV
CLASS="FIGURE"
><A
NAME="CONFIGURE-KERNEL-PARAMETERS-NOVIDEO"
></A
><P
><B
>Figure 5-3. Recommended kernel parameters, <SPAN
CLASS="ACRONYM"
>PC</SPAN
>s
without video card</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="PROGRAMLISTING"
>console=ttyS0,9600n8</PRE
></FONT
></TD
></TR
></TABLE
></DIV
><P
>These parameters are passed to the booting kernel by the boot
loader. Next we will configure the boot loader used by your
<SPAN
CLASS="SYSTEMITEM"
>Linux</SPAN
> installation to pass
the <TT
CLASS="LITERAL"
>console</TT
> parameters to the kernel.</P
></DIV
><H3
CLASS="FOOTNOTES"
>Notes</H3
><TABLE
BORDER="0"
CLASS="FOOTNOTES"
WIDTH="100%"
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
WIDTH="5%"
><A
NAME="FTN.AEN1301"
HREF="configure-kernel.html#AEN1301"
><SPAN
CLASS="footnote"
>[1]</SPAN
></A
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
WIDTH="95%"
><P
>A serial console attached to a <SPAN
CLASS="ACRONYM"
>USB</SPAN
> dongle
is only available in Linux kernel version 2.5.7 and later. The
2.5 series of kernels are developer's kernels and are not ready
for production use.</P
></TD
></TR
></TABLE
><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="configure-boot-loader-syslinux.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="configure-kernel-lilo.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Configure the <SPAN
CLASS="APPLICATION"
>SYSLINUX</SPAN
> boot
loader</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Configure Linux kernel using
<SPAN
CLASS="APPLICATION"
>LILO</SPAN
></TD
></TR
></TABLE
></DIV
></BODY
></HTML
>