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