国产宅男网站在线|亚洲A级性爱免费视频|亚洲中精品级在线|午夜福利AA毛

  • <dd id="gf5jf"><th id="gf5jf"></th></dd>

    <cite id="gf5jf"><label id="gf5jf"></label></cite>
  • <div id="gf5jf"><listing id="gf5jf"></listing></div>
    學(xué)習(xí)啦>學(xué)習(xí)電腦>操作系統(tǒng)>Linux教程>

    LINUX控制臺(tái)怎么定向到串口終端

    時(shí)間: 春健736 分享

      利用串口終端作為Linux控制臺(tái),可以免去額外的鍵盤,顯示卡和顯示器,同時(shí)可將Linux主機(jī)作為一個(gè)任意用途的嵌入式黑匣。那么LINUX控制臺(tái)怎么定向到串口終端?下面跟著學(xué)習(xí)啦小編一起來了解一下吧。

      LINUX控制臺(tái)怎么定向到串口終端

      目的: 臺(tái)機(jī)已經(jīng)裝好Linux,顯示器有問題,平時(shí)一般都SSH控制,當(dāng)Linux網(wǎng)絡(luò)掛的時(shí)候,想通過串口來管理。

      硬件:臺(tái)機(jī)自帶兩個(gè)串口(上面的是COM1)[under Windows] or ttyS0[under Linux)),筆記本T61p沒有串口,買了個(gè)USB轉(zhuǎn)串口(具體見下圖)。同時(shí)需要串口交叉線一根(NULL modem Cable),母對(duì)母(公的是針),都是凹口那種。

      目標(biāo)機(jī)器:安裝的CentOS 5.2 Linux 內(nèi)核2.6.18-92.1.22.el5和2.6.18-92.1.22.el5xen

      客戶端: Windows XP SP3 IBM OEM. 安裝USB轉(zhuǎn)串口驅(qū)動(dòng)。

      需要把輸出定向到串口,一般有下面幾處:

      BIOS中的設(shè)置

      GRUB設(shè)置

      /etc/inittab 設(shè)置

      /etc/securetty 設(shè)置

      BIOS中的設(shè)置

      BIOS設(shè)置的作用我沒嘗試過,如果是可以連BIOS設(shè)置都可以定向到串口,那個(gè)強(qiáng)大了。也不知道如何去掉機(jī)器需要連鍵盤的限制。沒拿出顯示器所以沒看我臺(tái)機(jī)的BIOS,不過這個(gè)功能一般只有服務(wù)器級(jí)別的機(jī)器有。【注1】臺(tái)機(jī)一般沒有串口重定向功能。

      GRUB設(shè)置

      這里的配置是為了把grub菜單定向到串口,這樣你就可以在串口操作grub,選擇啟動(dòng)項(xiàng),使用single mode等等。

      同時(shí)也要給kernel參數(shù)加上console選項(xiàng)。

      [root@CentOS5 ~]# cat /boot/grub/menu.lst

      # grub.conf generated by anaconda

      #

      # Note that you do not have to rerun grub after making changes to this file

      # NOTICE: You have a /boot partition. This means that

      # all kernel and initrd paths are relative to /boot/, eg.

      # root (hd0,0)

      # kernel /vmlinuz-version ro root=/dev/vg00/lv_root

      # initrd /initrd-version.img

      #boot=/dev/hdb1

      serial --unit=0 --speed=9600 --word=8 --parity=no --stop=1

      terminal --timeout=10 serial console

      default=2

      timeout=20

      #splashimage=(hd0,0)/grub/splash.xpm.gz =>這些在console下會(huì)工作不正常,注釋掉。

      #hiddenmenu

      title CentOS (2.6.18-92.1.22.el5)

      root (hd0,0)

      kernel /vmlinuz-2.6.18-92.1.22.el5 ro root=/dev/vg00/lv_root rhgb quiet

      initrd /initrd-2.6.18-92.1.22.el5.img

      title CentOS Serial[ttyS0] - Console (2.6.18-92.1.22.el5)

      root (hd0,0)

      kernel /vmlinuz-2.6.18-92.1.22.el5 ro root=/dev/vg00/lv_root console=ttyS0,9600 console=tty0

      initrd /initrd-2.6.18-92.1.22.el5.img

      title CentOS Console - serial[ttyS0] (2.6.18-92.1.22.el5) [get more output in serial console]

      root (hd0,0)

      kernel /vmlinuz-2.6.18-92.1.22.el5 ro root=/dev/vg00/lv_root console=tty0 console=ttyS0,9600

      initrd /initrd-2.6.18-92.1.22.el5.img

      title CentOS Xen (2.6.18-92.1.22.el5xen)

      root (hd0,0)

      kernel /xen.gz-2.6.18-92.1.22.el5

      module /vmlinuz-2.6.18-92.1.22.el5xen ro root=/dev/vg00/lv_root rhgb quiet xencons=off

      module /initrd-2.6.18-92.1.22.el5xen.img

      title CentOS Xen Serial[ttyS0] - Console (2.6.18-92.1.22.el5xen)

      root (hd0,0)

      kernel /xen.gz-2.6.18-92.1.22.el5

      module /vmlinuz-2.6.18-92.1.22.el5xen ro root=/dev/vg00/lv_root xencons=off console=ttyS0,9600 console=tty0

      module /initrd-2.6.18-92.1.22.el5xen.img

      title CentOS Xen Console - serial[ttyS0] (2.6.18-92.1.22.el5xen)

      root (hd0,0)

      kernel /xen.gz-2.6.18-92.1.22.el5

      module /vmlinuz-2.6.18-92.1.22.el5xen ro root=/dev/vg00/lv_root xencons=off console=tty0 console=ttyS0,9600

      module /initrd-2.6.18-92.1.22.el5xen.img

      title Other

      rootnoverify (hd0,0)

      chainloader +1

      后面的console有順序關(guān)系,詳見下文【注2】,我常用串口所以console=tty0 console=ttyS0,9600這個(gè)順序的輸出信息比較多。

      因?yàn)槲业臋C(jī)器有xen的內(nèi)核,xen默認(rèn)情況下會(huì)把串口做為xencons,所以這里設(shè)置xencons=off.

      When multiple consoles are listed output is sent to all consoles and input is taken from the last listed console. The last console is the one Linux uses as the /dev/consoledevice.

      /etc/inittab 設(shè)置

      系統(tǒng)系統(tǒng)后,需要在串口上監(jiān)聽請(qǐng)求,所以要有個(gè)類似服務(wù)器的程序(agetty, mgetty etc)。

      /etc/inittab中添加

      s0:2345:respawn:/sbin/agetty -L -f /etc/issue.serial 9600 ttyS0 vt100

      #s1:2345:respawn:/sbin/agetty -L -f /etc/issue.serial 9600 ttyS1 vt100

      #S0:2345:respawn:/sbin/mgetty -r -x 9 ttyS0 ==> mgetty 用來調(diào)試比較好,log也豐富。

      What is a getty?

      A getty is is a program that opens a tty port, prompts for a login name, and runs the /bin/login command. It is normally invoked by init.

      所以其他程序就不能再來占用ttyS0了,串口是獨(dú)占模式的吧。

      vt100:

      vt100 is the terminal emulation. You can use others, but VT100 is the most common or "standard". Another widely used termial type is VT102.

      OK都可以了,可以重啟server了。這里如果想測(cè)試下串口線,推薦先在Linux啟動(dòng)下mgetty,因?yàn)樗膁ebug信息和log比較豐富,適合排錯(cuò)和測(cè)試。

      #mgetty –r –x 9 ttyS0

      Log在/var/log/mgetty*中。

      /etc/securetty設(shè)置

      因?yàn)橐话阄覀兌际鞘褂胷oot登陸串口來維護(hù),所以需要設(shè)置root可以在COM1和COM2登陸。

      在/etc/securetty中添加:

      ttyS0

      ttyS1

      Windows客戶端連接可以用超級(jí)終端或者Putty。

      注意啟動(dòng)server的時(shí)候,putty就應(yīng)該去連接串口了,這樣才可以看到所有信息。

      本來正常情況下,接下去kernel的boot信息應(yīng)該也會(huì)打到串口的。但是沒有,確定是Xen內(nèi)核的關(guān)系。

      系統(tǒng)啟動(dòng)起來后,過了init,agetty就起來了,這個(gè)時(shí)候就可以通過串口登陸了。(在/etc/securetty中需要添加ttyS0)

    看過“ LINUX控制臺(tái)怎么定向到串口終端 ”的人還看了:

    1.Linux使用Tmux怎么提高終端操作效率

    2.LINUX終端定制的方法

    3.busybox的缺省init模式介紹

    4.分析Linux系統(tǒng)rc.sysinit腳本

    5.如何在Linux下安裝fcitx輸入法

    6.Linux在CPAN中安裝Perl模塊的技巧

    LINUX控制臺(tái)怎么定向到串口終端

    利用串口終端作為Linux控制臺(tái),可以免去額外的鍵盤,顯示卡和顯示器,同時(shí)可將Linux主機(jī)作為一個(gè)任意用途的嵌入式黑匣。那么LINUX控制臺(tái)怎么定向到串口終端?下面跟著學(xué)習(xí)啦小編一起來了解一下吧。 LINUX控制臺(tái)怎么定向到串口終端 目的:
    推薦度:
    點(diǎn)擊下載文檔文檔為doc格式

    精選文章

    • Linux Top命令解析
      Linux Top命令解析

      top命令提供了實(shí)時(shí)的對(duì)系統(tǒng)處理器的狀態(tài)監(jiān)視.它將顯示系統(tǒng)中CPU最敏感的任務(wù)列表.學(xué)習(xí)啦小編為大家分享了Linux Top 命令解析,希望大家喜歡。 Linux命令工

    • Linux系統(tǒng)中文本操作命令tr怎么使用
      Linux系統(tǒng)中文本操作命令tr怎么使用

      tr命令可以用來對(duì)文本進(jìn)行壓縮刪除以及替換等多種操作,十分強(qiáng)大,下面學(xué)習(xí)啦小編介紹了Linux系統(tǒng)中文本操作命令tr的使用講解,希望大家喜歡。 Linux系統(tǒng)

    • linux文件系統(tǒng)備份
      linux文件系統(tǒng)備份

      系統(tǒng)備份是系統(tǒng)管理工作中十分重要的一個(gè)環(huán)切,備份是一項(xiàng)重要的工作,但是很多人沒有去做。那么如何備份linux系統(tǒng)呢?下面跟著學(xué)習(xí)啦小編一起來了解

    • 修改linux系統(tǒng)時(shí)間的方法
      修改linux系統(tǒng)時(shí)間的方法

      拿linux虛擬機(jī)做實(shí)驗(yàn)的朋友會(huì)知道。當(dāng)你把linux還原到某個(gè)點(diǎn)的時(shí)候,vmware幫不了你把系統(tǒng)時(shí)間也給重設(shè)了。那么修改linux系統(tǒng)時(shí)間的方法是什么呢?下面跟著

    645133