Chinaunix首页 | 论坛 | 博客
  • 博客访问: 183786
  • 博文数量: 64
  • 博客积分: 1451
  • 博客等级: 上尉
  • 技术积分: 665
  • 用 户 组: 普通用户
  • 注册时间: 2009-08-24 10:07
文章分类

全部博文(64)

文章存档

2010年(7)

2009年(57)

我的朋友

分类: LINUX

2009-09-08 14:48:55

Linux Serial Console

Linux support for a serial console is a very useful feature. It allows running a Linux box in a headless configuration without a monitor or keyboard. This is very common in server rooms where there are racks of servers.

It also can come in handy at home. Since I have two computers and only one monitor, it really helps. My main computer runs Windows 2000 and my lesser computer runs Linux. Normally, the Linux computer is accessed completely through the network. But every one in a while, it needs administration help. Then, a serial console comes in handy. Only in true emergencies or when reinstalling the operating system do I need to connect a monitor and keyboard.

I use as a boot loader. GRUB supports sending its messages to the serial console. The following lines should be added to the top of the

/boot/grub/grub.conf

file.

serial --unit=0 --speed=9600terminal --timeout=10 serial console

The following parameters need to be passed to each instance of the linux kernel. They should be added to the

kernel

line. It would be helpful if GRUB supported variable substitution so that the parameters only needed to be defined in one place.

console=tty0 console=ttyS0,9600

Linux needs to be told to listen for logins on the serial port. This is done by adding the following line to

/etc/inittab

. The

115200,9600

part indicates it should start at 115200 and then downgrade to 9600 if it receives junk indicating a speed mismatch.

s0:2345:respawn:/sbin/agetty ttyS0 115200,9600 linux

To connect another computer to the serial port, you need a null modem cable. Or a null modem adapter and regular serial.

On Windows, I use SecureCRT as the terminal program. Unluckily, the excellent open source doesn't support serial ports.

It is also possible to connect a Palm handheld to a serial port using a serial HotSync cable. Unluckily, the newer Palms use USB HotSync cables instead of serial cables. It is possible to buy serial HotSync cable for most models but I haven't yet tried it. It is also possible to get IrDA to serial adapters to communicate through the Palm's IR port. Use a terminal application like on the Palm. The usability is poor because of the small screen size and lack of keyboard but you can't beat the portability.

简单来说,就是

1.修改/boot/Grub/menu.lst文件,在文件中添加
  serial --unit=0 --speed=9600
  terminal --timeout=0 serial console
  (--timeout设置为零,启动直接进入grub,不用再等了)
   2.修改/boot/Grub/menu.lst文件,在kernel=*** root=*** 后面添加console=tty0 console=ttyS0 , 9600
   3.修改inittab.
   添加一行:s0:2345:respawn:/sbin/agetty ttyS0 9600

通过windows的超级终端进入系统,系统提示输入用户名和密码,之前需要先按键盘Scroll Lock键,否则键盘不能用。

当然,内核也要支持串口才行。

Device Drivers-->Character devices-->Serial drivers

阅读(1499) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~