linux serial console 设置

| No Comments | No TrackBacks

环境:

使用命令:

dmesg | grep serial

看看机器对串口的支持是否OK,如果输出类似下面,就没问题了

[ 54.831740] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[ 54.853271] serial8250: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A

其中ttyS0是COM1,ttyS1是COM2

配置过程:

在grub里打开对serial console 的支持. 在menu.lst中加入:

serial --unit=0 --speed=57600 --word=8 --parity=no --stop=1
terminal --timeout=10 serial console

速度,校验,停止位设置好,连接时候用.第一行是打开串口支持,第二行是让grub也能使用串口

在kernel参数里加入 "console=ttyS0, 57600n8 console=tty",比如:

kernel /boot/vmlinuz-2.6.20-jianingy-server root=/dev/hda1 ro console=tty console=ttyS0,57600n8

console=tty是为了在本机建立一个tty,console=ttyS0,57600n8是在串口建立一个speed=57600, 无校验,8位的tty。如果只有ttyS0,那么本机在启动时候就不输出了。

ubuntu用户把/etc/event.d/tty6,最后一行改为

respawn /sbin/getty -L ttyS0 57600 vt100

其他linux用户可以在/etc/inittab里改

只此一切OK了,在另外一台机器上设置好minicom或者gtkterm,reboot机器等来来自console的信息吧

如果需要root能从console登录,需要在/etc/securetty里加入ttyS0

No TrackBacks

TrackBack URL: http://mtblog.jianingy.com/mt-tb.cgi/166

Leave a comment

October 2008

Sun Mon Tue Wed Thu Fri Sat
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  

Friends' Links

Archives

Powered by Movable Type 4.21-en