The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/Documentation/serial-console.txt

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1                        Linux Serial Console
    2 
    3 To use a serial port as console you need to compile the support into your
    4 kernel - by default it is not compiled in. For PC style serial ports
    5 it's the config option next to "Standard/generic (dumb) serial support".
    6 You must compile serial support into the kernel and not as a module.
    7 
    8 It is possible to specify multiple devices for console output. You can
    9 define a new kernel command line option to select which device(s) to
   10 use for console output.
   11 
   12 The format of this option is:
   13 
   14         console=device,options
   15 
   16         device:         tty0 for the foreground virtual console
   17                         ttyX for any other virtual console
   18                         ttySx for a serial port
   19                         lp0 for the first parallel port
   20 
   21         options:        depend on the driver. For the serial port this
   22                         defines the baudrate/parity/bits of the port,
   23                         in the format BBBBPN, where BBBB is the speed,
   24                         P is parity (n/o/e), and N is bits. Default is
   25                         9600n8. The maximum baudrate is 115200.
   26 
   27 You can specify multiple console= options on the kernel command line.
   28 Output will appear on all of them. The last device will be used when
   29 you open /dev/console. So, for example:
   30 
   31         console=ttyS1,9600 console=tty0
   32 
   33 defines that opening /dev/console will get you the current foreground
   34 virtual console, and kernel messages will appear on both the VGA
   35 console and the 2nd serial port (ttyS1 or COM2) at 9600 baud.
   36 
   37 Note that you can only define one console per device type (serial, video).
   38 
   39 If no console device is specified, the first device found capable of
   40 acting as a system console will be used. At this time, the system
   41 first looks for a VGA card and then for a serial port. So if you don't
   42 have a VGA card in your system the first serial port will automatically
   43 become the console.
   44 
   45 You will need to create a new device to use /dev/console. The official
   46 /dev/console is now character device 5,1.
   47 
   48 Here's an example that will use /dev/ttyS1 (COM2) as the console.
   49 Replace the sample values as needed.
   50 
   51 1. Create /dev/console (real console) and /dev/tty0 (master virtual
   52    console):
   53 
   54    cd /dev
   55    rm -f console tty0
   56    mknod -m 622 console c 5 1
   57    mknod -m 622 tty0 c 4 0
   58 
   59 2. LILO can also take input from a serial device. This is a very
   60    useful option. To tell LILO to use the serial port:
   61    In lilo.conf (global section): 
   62 
   63    serial  = 1,9600n8 (ttyS1, 9600 bd, no parity, 8 bits)
   64 
   65 3. Adjust to kernel flags for the new kernel,
   66    again in lilo.conf (kernel section)
   67 
   68    append = "console=ttyS1,9600" 
   69 
   70 4. Make sure a getty runs on the serial port so that you can login to
   71    it once the system is done booting. This is done by adding a line
   72    like this to /etc/inittab (exact syntax depends on your getty):
   73 
   74    S1:23:respawn:/sbin/getty -L ttyS1 9600 vt100
   75 
   76 5. Init and /etc/ioctl.save
   77 
   78    Sysvinit remembers its stty settings in a file in /etc, called
   79    `/etc/ioctl.save'. REMOVE THIS FILE before using the serial
   80    console for the first time, because otherwise init will probably
   81    set the baudrate to 38400 (baudrate of the virtual console).
   82 
   83 6. /dev/console and X
   84    Programs that want to do something with the virtual console usually
   85    open /dev/console. If you have created the new /dev/console device,
   86    and your console is NOT the virtual console some programs will fail.
   87    Those are programs that want to access the VT interface, and use
   88    /dev/console instead of /dev/tty0. Some of those programs are:
   89 
   90    Xfree86, svgalib, gpm, SVGATextMode
   91 
   92    It should be fixed in modern versions of these programs though.
   93 
   94    Note that if you boot without a console= option (or with
   95    console=/dev/tty0), /dev/console is the same as /dev/tty0. In that
   96    case everything will still work.
   97 
   98 7. Thanks
   99 
  100    Thanks to Geert Uytterhoeven <geert@linux-m68k.org>
  101    for porting the patches from 2.1.4x to 2.1.6x for taking care of
  102    the integration of these patches into m68k, ppc and alpha.
  103 
  104 Miquel van Smoorenburg <miquels@cistron.nl>, 11-Jun-2000

Cache object: 50bb59411a6ef737d267251f3395b813


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.