1 .. _serial_console: 2 3 Linux Serial Console 4 ==================== 5 6 To use a serial port as console you need to co 7 kernel - by default it is not compiled in. For 8 it's the config option next to menu option: 9 10 :menuselection:`Character devices --> Serial d 11 12 You must compile serial support into the kerne 13 14 It is possible to specify multiple devices for 15 define a new kernel command line option to sel 16 use for console output. 17 18 The format of this option is:: 19 20 console=device,options 21 22 device: tty0 for the foregroun 23 ttyX for any other vir 24 ttySx for a serial por 25 lp0 for the first para 26 ttyUSB0 for the first 27 28 options: depend on the driver. 29 defines the baudrate/p 30 the port, in the forma 31 speed, P is parity (n/ 32 and F is flow control 33 9600n8. The maximum ba 34 35 You can specify multiple console= options on t 36 37 The behavior is well defined when each device 38 In this case, the output will appear on all re 39 the last device will be used when you open ``/ 40 So, for example:: 41 42 console=ttyS1,9600 console=tty0 43 44 defines that opening ``/dev/console`` will get 45 virtual console, and kernel messages will appe 46 console and the 2nd serial port (ttyS1 or COM2 47 48 The behavior is more complicated when the same 49 times. In this case, there are the following t 50 51 1. The output will appear only on the first de 52 53 2. ``/dev/console`` will be associated with th 54 Where the registration order depends on how 55 subsystems. 56 57 This rule is used also when the last consol 58 for other reasons. For example, because of 59 the hardware is not available. 60 61 The result might be surprising. For example, t 62 lines have the same result:: 63 64 console=ttyS1,9600 console=tty0 consol 65 console=tty0 console=ttyS1,9600 consol 66 67 The kernel messages are printed only on ``tty0 68 ``/dev/console`` gets associated with ``tty0`` 69 tries to register graphical consoles before se 70 because of the default behavior when no consol 71 see below. 72 73 Note that the last ``console=tty1`` parameter 74 The kernel command line is used also by system 75 defined ``tty1`` as the login console. 76 77 If no console device is specified, the first d 78 acting as a system console will be used. At th 79 first looks for a VGA card and then for a seri 80 have a VGA card in your system the first seria 81 become the console. 82 83 You will need to create a new device to use `` 84 ``/dev/console`` is now character device 5,1. 85 86 (You can also use a network device as a consol 87 ``Documentation/networking/netconsole.rst`` fo 88 89 Here's an example that will use ``/dev/ttyS1`` 90 Replace the sample values as needed. 91 92 1. Create ``/dev/console`` (real console) and 93 console):: 94 95 cd /dev 96 rm -f console tty0 97 mknod -m 622 console c 5 1 98 mknod -m 622 tty0 c 4 0 99 100 2. LILO can also take input from a serial devi 101 useful option. To tell LILO to use the seri 102 In lilo.conf (global section):: 103 104 serial = 1,9600n8 (ttyS1, 9600 bd, no pa 105 106 3. Adjust to kernel flags for the new kernel, 107 again in lilo.conf (kernel section):: 108 109 append = "console=ttyS1,9600" 110 111 4. Make sure a getty runs on the serial port s 112 it once the system is done booting. This is 113 like this to ``/etc/inittab`` (exact syntax 114 115 S1:23:respawn:/sbin/getty -L ttyS1 9600 v 116 117 5. Init and ``/etc/ioctl.save`` 118 119 Sysvinit remembers its stty settings in a f 120 ``/etc/ioctl.save``. REMOVE THIS FILE befor 121 console for the first time, because otherwi 122 set the baudrate to 38400 (baudrate of the 123 124 6. ``/dev/console`` and X 125 Programs that want to do something with the 126 open ``/dev/console``. If you have created 127 and your console is NOT the virtual console 128 Those are programs that want to access the 129 ``/dev/console instead of /dev/tty0``. Some 130 131 Xfree86, svgalib, gpm, SVGATextMode 132 133 It should be fixed in modern versions of th 134 135 Note that if you boot without a ``console=` 136 ``console=/dev/tty0``), ``/dev/console`` is 137 In that case everything will still work. 138 139 7. Thanks 140 141 Thanks to Geert Uytterhoeven <geert@linux-m6 142 for porting the patches from 2.1.4x to 2.1. 143 the integration of these patches into m68k, 144 145 Miquel van Smoorenburg <miquels@cistron.nl>, 11
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.