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