中国IT动力,最新最全的IT技术教程
最新100篇 | 推荐100篇 | 专题100篇 | 排行榜 | 搜索 | 在线API文档
首 页 | 程序开发 | 操作系统 | 软件应用 | 图形图象 | 网络应用 | 精文荟萃 | 教育认证 | 硬件维护 | 未整理篇 | 站长教程
ASP JS PHP工程 ASP.NET 网站建设 UML J2EESUN .NET VC VB VFP 网络维护 数据库 DB2 SQL2000 Oracle Mysql
服务器 Win2000 Office C DreamWeaver FireWorks Flash PhotoShop 上网宝典 CorelDraw 协议大全 网络安全 微软认证
硬件维护  CPU  主板  硬盘  内存  显卡  显示器  键盘鼠标  声卡音箱  打印机  机箱电源  BIOS  网卡  C#  Java  Delphi  vs.net2005
  当前位置:> 操作系统 > Linux > Linux综合
vmware 4.5.2 下测试 linux console 重定向到串口的功能
作者:未知 时间:2005-09-13 22:05 出处:Blog.ChinaUnix.net 责编:chinaitpower
              摘要:vmware 4.5.2 下测试 linux console 重定向到串口的功能
今天作的有意义的一件事就是测试了在 vmware 4.5.2 下测试 linux console 重定向到串口的功能

测试环境:
Host OS: SUSE Pro 9.3
vmware: 4.5.2 for linux (any-any-update89)
Virtual OS: SLES9 两台 (SLES9serv1, SLES9serv2)

关键词:
Linux, console, serial, vmware, console loglevel

Linux 的系统的 console 可以重定向到串口,系统的 console 消息可以通过终端软件记录下来,对分析系统的故障
很有帮助。 由于没有串口线,所以只好借助 vmware 来测试这个功能了。

vmware 4.5.2 支持将串口创建为命名管道(在 linux 下实际是socket)
具体的做法如 vmware 文档 file:///usr/lib/vmware/help-manual/devices_serial_ws.htm 所介绍的方法

In the server virtual machine

  1. Open the virtual machine settings editor (VM > Settings).
  2. Click Add to start the Add Hardware Wizard.
  3. Select Serial Port, then click Next.
  4. Select Output to named pipe, then click Next.
  5. In the Path field, enter /tmp/ or another Unix socket name of your choice.
  6. Select This end is the server.
  7. Select The other end is a virtual machine.
  8. By default, the device status setting is Connect at power on. You may deselect this setting if you wish.

In the client virtual machine

  1. Open the virtual machine settings editor (VM > Settings).
  2. Click Add to start the Add Hardware Wizard.
  3. Select Serial Port, then click Next.
  4. Select Output to named pipe, then click Next.
  5. In the Path field, enter /tmp/ or another Unix socket name of your choice. The pipe name must be the same on both server and client.
  6. Select This end is the client.
  7. Select The other end is a virtual machine.
  8. By default, the device status setting is Connect at power on. You may deselect this setting if you wish.

别忘了保存相应的配置。:-)

启动虚拟机之后,VM SLES9serv1 作为串口使用中的服务器端,它的终端会重定向到串口
1) 在 VM SLES9serv1 的 /boot/grub/menu.lst 文件 kernel 对应的行上添加 console=ttyS0,9600 console=tty0,要令它生效需要重启系统。

2) 如果希望在另外一台 VM SLES9serv2 上登录这台 VM SLES9serv1,
在 VM SLES9serv1 的 /etc/inittab 中添加行:

S0:2345:respawn:/sbin/agetty -L 9600 ttyS0 vt102

然后运行命令: # init q

3)在 VM SLES9serv2 上配置 minicom 设置串口为 /dev/ttyS0 参数为 9600 8N1
然后连接上去,应该一切ok了

4) 如果希望把尽可能多的消息通过串口发送出去,需要调整 VM SLES9serv1 的 console loglevel
# echo 8 > /proc/sys/kernel/printk

5) 在 VM SLES9serv1 上插入会产生 kernel msg 的内核模块,测试内核消息发送是否正常


参见:
1. /usr/src/linux/Documentation/serial-console.txt
2. /usr/src/linux/Documentation/sysctl/kernel.txt
3. vmware/help-manual/devices_serial_ws.htm
4. man 1 minicom
5. man 8 init


关闭本页
 
首页 | 投资与合作 | 服务条款 | 隐私政策 | 收藏本站 | 设为首页 | 新用户注册 | 免责声明 | 使用帮助
Copyright ©2005-2008 chinaitpower.com All rights reserved. www.chinaitpower.com 版权所有