Welcome 微信登录

首页 / 操作系统 / Linux / 在引导期间配置 Linux 进行串行重定向

“SysRq key” 是允许将基本命令直接传递给内核进行调试的键序列。 在有些情况下,还可以用来重新引导远程管理系统。 串行控制台使用 RS-232 中断函数,比如 SysRq 键。 “中断”是在串行线上不进行传输的一段时间。 要在运行 Linux 的系统中配置 “Sysrq” 键,应遵守以下指令:注:以下指令特定于 Linux GRand Unified Bootloader (GRUB)。 使用其他启动装载程序时,也有必要进行类似更改。
注:在配置客户端 VT100 仿真窗口时,必须将显示重定向控制台的窗口或应用程序设置为 25 行 x 80 列以确保正确的文本显示;否则,有些文本屏幕会显示混乱。 如下编辑文件 /etc/grub.conf。 请参阅后面的示例文件,其中显示了本步骤中所述的更改。将以下两行新内容添加到文件的常规设置部分:
serial --unit=0 --speed=19200
terminal --timeout=10 serial将两个选项附加到内核行:
kernel ............. console=ttyS0,19200如果 /etc/grub.conf 包含 splashimage 指令,必须将其注释掉。
这个使用波特率 19200 的示例文件是一个例子。以下是 BMC 串行通信和 SOL 允许的最大波特率:对于 PowerEdge 1425SC 和 其他 PowerEdge x8xx 系统为 19200。
对于不带 Dell Remote Access Controller (DRAC 5) 的 PowerEdge x9xx 系统为 57600。
对于带 DRAC 5 的 PowerEdge x9xx 系统为 115200。 表 D-1. 示例文件:/etc/grub.con# 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 /, e.g.#           root (hd0,0)
#           kernel /boot/vmlinuz-version ro root=/dev/sdal
#           initrd /boot/initrd-version.img
#boot=/dev/sda
default=0
timeout=10
#splashimage=(hd0,2)/grub/splash.xpm.gzserial --unit=0 --speed=19200
terminal --timeout=10 serialtitle Red Hat Linux Advanced Server (2.4.9-e.3smp)
    root (hd0,0)
    kernel /boot/vmlinuz-2.4.9-e.3smp ro root=/dev/sda1 hda=ide-scsi console=tty0 console=ttyS0,19200
    initrd /boot/initrd-2.4.9-e.3smp.img
title Red Hat Linux Advanced Server-up (2.4.9-e.3
    root (hd0,00)
    kernel /boot/vmlinuz-2.4.9-e.3 ro root=/dev/sda1 s
    initrd /boot/initrd-2.4.9-e.3.im有关编辑 grub.conf 的其它信息:可能需要禁用 GRUB 的图形界面并转而使用www.linuxidc.com基于文本的界面;否则,GRUB 屏幕将不会在 BMU 控制台重定向中显示。 要做到这一点,注释掉以 splashimage 开头的行。如果在 GRUB 中有多个选项并且希望所有选项都通过 BMU 串行连接启动控制台会话,则为所有选项添加 console=ttyS1,19200。 以上示例只显示将 console=ttyS0,19200 添加到第一个选项。
在引导后启用登录到控制台
如下编辑文件 /etc/inittab:添加新行在 COM1 串行端口上配置 getty:co:2345:respawn:/sbin/agetty -h -L 19200 ttyS0 vt100请参阅示例文件,其中显示添加了新行。表 D-2. 示例文件:/etc/innitab ## inittab      This file describes how the INIT process should set up
#               the system in a certain run-level.#
# Author:      Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org
#              Modified for RHS Linux by Marc Ewing and Donnie Barnes
## Default runlevel. The runlevels used by RHS are:
#    0 - halt (Do NOT set initdefault to this)
#    1 - Single user mode
#    2 - Multiuser, without NFS (The same as 3, if you do not have
#        networking)
#    3 - Full multiuser mode
#    4 - unused
#    5 - X11
#    6 - reboot (Do NOT set initdefault to this)
#
id:3:initdefault:# System initialization.
si::sysinit:/etc/rc.d/rc.sysinit
 l0:0:wait:/etc/rc.d/rc 0
l1:1:wait:/etc/rc.d/rc 1
l2:2:wait:/etc/rc.d/rc 2
l3:3:wait:/etc/rc.d/rc 3
l4:4:wait:/etc/rc.d/rc 4
l5:5:wait:/etc/rc.d/rc 5
l6:6:wait:/etc/rc.d/rc 6
 # Things to run in every runlevel.
ud::once:/sbin/update# Trap CTRL-ALT-DELETE
ca::ctrlaltdel:/sbin/shutdown -t3 -r now# When our UPS tells us power has failed, assume we have a few
# minutes of power left. Schedule a shutdown for 2 minutes from now.
# This does, of course, assume you have power installed and your
# UPS is connected and working correctly.
pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down"
# If power was restored before the shutdown kicked in, cancel it.
pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled"
 # Run gettys in standard runlevels
co:2345:respawn:/sbin/agetty -h -L 19200 ttyS0 vt100
1:2345:respawn:/sbin/mingetty tty1
2:2345:respawn:/sbin/mingetty tty2
3:2345:respawn:/sbin/mingetty tty3
4:2345:respawn:/sbin/mingetty tty4
5:2345:respawn:/sbin/mingetty tty5
6:2345:respawn:/sbin/mingetty tty6# Run xdm in runlevel 5
# xdm is now a separate service
x:5:respawn:/etc/X11/prefdm -nodaemon
如下编辑文件 /etc/securetty:添加新行,为 COM1 使用串行 tty 名称:ttyS0Linux Telnet设定Linux下串口连接的简单测试相关资讯      Linux教程 
  • Linux教程:如何在命令行中查看目  (07/28/2014 12:22:23)
  • Linux 修改root密码  (11/03/2012 07:53:38)
  • su - root 与su root的区别  (06/06/2012 00:39:40)
  • Linux进程间通信:消息队列  (01/28/2013 09:43:00)
  • U盘安装Linux开机无法启动解决方法  (10/07/2012 08:55:52)
  • Windows 7/Linux 同步时间  (05/15/2012 06:17:55)
本文评论 查看全部评论 (0)
表情: 姓名: 字数