由于有的linux系统没有在启动时打开串口,在调试死机问题时不是很方便,所以需要在开机时打开串口。
另外由于我笔记本没有真实的串口,需要虚拟串口。
虚拟串口软件:Configure Virtual Serial Port Driver 6.9.1.134
操作系统:win7
vmware安装系统:fedroa12
首先,在/boot/grub/menu.list 中加入(注意红色部分)
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a /boot partition. This means that
# all kernel and initrd paths are relative to /, eg.
# root (hd0,0)
# kernel /boot/vmlinuz-version ro root=/dev/sda1
# initrd /boot/initrd-version.img
#boot=/dev/sda
default=0
timeout=1
serial --unit=0 --speed=9600 --word=8 --parity=no --stop=1
terminal --timeout=10 serial console
#splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title Fedora (2.6.25-14.fc9.i686)
root (hd0,0)
kernel /boot/vmlinuz-2.6.25-14.fc9.i686 ro root=LABEL=/ console=ttyS0 #root=UUID=cad119c5-5164-40fa-8600-653d6f0671b4
initrd /boot/initrd-2.6.25-14.fc9.i686.img
#title Fedora (2.6.25.14)
# root (hd0,0)
# kernel /vmlinuz-2.6.25.14 ro root=LABEL=/ console=ttyS0 #rhgb quiet
# initrd /initrd-2.6.25.14.img
然后,在/etc/inittab 中加入
s0:2345:respawn:/sbin/agetty -L 9600 ttyS0 vt100
最后,在/etc/securetty设置加入:
ttyS0
启动就可以了。
另外虚拟软件需要设置两个虚拟端口,比如我的是com1<--->com3
虚拟机设置com1,超级终端(或者别的软件)监听com3
重启虚拟机就会看到串口打印信息了。