您的位置:首页 > 运维架构 > Linux

How to configure the kernel parameter "console"

2015-12-31 00:44 441 查看
The Linux kernel is configured to select the console by passing it theconsole parameter. The
console parameter can be given repeatedly, but the parameter can only be given once for each console technology. Soconsole=tty0 console=lp0 console=ttyS0 is acceptable butconsole=ttyS0 console=ttyS1
will not work.

When multiple consoles are listed output is sent to all consoles and input is taken from the last listed console. The lastconsole is the one Linux uses as the
/dev/console device.

The syntax of the console parameter is given in
Figure 5-1.

Figure 5-1. Kernel console syntax, in EBNF

console=ttyS<serial_port>[,<mode>]
console=tty<virtual_terminal>
console=lp<parallel_port>
console=ttyUSB[<usb_port>[,<mode>]

<serial_port> is the number of the serial port. This is defined inFigure
4-2 and discussed in
Section 2.2. The examples in this HOWTO use the first serial port, giving<serial_port> the value
0, which in turn gives kernel parameter
console=ttyS0.

If you are using the devfs device filesystem with your Linux installation the kernel parameter for the first serial port is stillttyS0, even though the first serial device is no longer known as/dev/ttyS0
but as /dev/ttys/0.

<mode> is defined in
Figure 2-7 and is discussed in
Section 2.3. The examples in this HOWTO use 9600 bits per second, one start bit, eight data bits, no parity, one stop bit, and noCTS/RTS flow control giving<mode>
the value of 9600n8. When the current kernel flow control bugs are corrected thisHOWTO will once again recommend the value
9600n8r.

<usb_port> can specify the address of a
USB dongle containing a serial port to be used as a serial console.[1]
For example, the serial port console=ttyS0,9600n8 when moved to a
USB serial dongle would be written as
console=ttyUSB0,9600n8. TheUSB subsystem is started rather late in the boot process, console messages printed during boot before theUSB subsystem is loaded will be lost.

With no console parameter the kernel will use the first virtual terminal, which is/dev/tty0. A user at the keyboard uses this virtual terminal by pressingCtrl-Alt-F1.

If your computer contains a video card then we suggest that you also configure it as a console. This is done with the kernel parameterconsole=tty0.

For computers with both a video card and a serial console in the port marked
"COM1:" this HOWTO suggests the kernel parameters:

Figure 5-2. Recommended kernel parameters, PCs with video card

console=tty0 console=ttyS0,9600n8

Kernel messages will appear on both the first virtual terminal and the serial port. Messages from theinit 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, theinit system has started but is now printing messages to the serial port but is printing nothing to the screen. If agetty
has been configured then a login: prompt will eventually appear on the attached monitor.

For PCs without a video card, this
HOWTO suggests the kernel parameters:

Figure 5-3. Recommended kernel parameters, PCs without video card

console=ttyS0,9600n8

These parameters are passed to the booting kernel by the boot loader. Next we will configure the boot loader used by yourLinux installation to pass the
console parameters to the kernel.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息