Ubuntu设置RS-232串口登陆终端(译文,节选)
原文地址:http://2stech.ca/index.php/linux/linuxtutotials/tutorials/207-ubuntu-serial-console-login
?
如果你有一臺服務器(不論大小),保留一個可以用來登陸系統的串口終端,通常來說是一件非常好的事情。這篇短文將展示如何配置服務器或PC上的串口,使其可以用作登陸終端。
前提
- 你已經在BIOS中啟用了串口;
- 機器上第一個串口(在Linux系統中稱作/dev/ttyS0)使用的連接模式為“115200 8n1”,即:模特率115200,8個數據位,1個停止位,無奇偶校驗。若串口不支持這種通訊方式,一般而言會使用“9600 8n1”模式;
- 你有足夠的能力及自信,去編輯和修改關鍵的系統文件(如/etc/inittab, /boot/grub/menu.lst等);?
- You are using a serial (null modem) cable. It is also possible to use a USB to Serial adaptor, but the tty* must be changed to reflect your hardware.
配置終端登陸過程
較新版本的 Ubuntu 系統使用 Upstart 來啟動。這就是我們要修改的第一個東西。
如果你查看 /etc/init 目錄下的文件,你會發現一些已有的終端服務配置文件,如 tty1.conf 等。很簡單,我們可以復制其中一個文件:
$ cp /etc/init/tty1.conf /etc/init/ttyS0.conf然后我們對新建的 ttyS0.conf 進行修改:
將:
# tty1 - getty
改為:
# ttyS0 - getty
將:
# This service maintains a getty on tty1 from the point the system is
改為:
# This service maintains a getty on ttyS0 from the point the system is
將:
exec /sbin/getty -8 38400 tty1
改為:
exec /sbin/getty -L 115200 ttyS0 vt102
理論上講,文件的注釋部分是不需要修改的。但為了可讀性及后期維護,我們仍舊修改它。?
當你完成了以上修改, ttyS0.conf 文件應該差不多是以下這個樣子:
# ttyS0 - getty?
#?
# This service maintains a getty on ttyS0 from the point the system is?
# started until it is shut down again.
start on stopped rc RUNLEVEL=[2345]?
stop on runlevel [!2345]
respawn?
exec /sbin/getty -L 115200 ttyS0 vt1022
此時,你就可以開啟這個服務了:
$ sudo start ttyS0搞定!現在你就可以嘗試用串口進行登陸了~
轉載于:https://www.cnblogs.com/Ricky-Gong/p/4437928.html
總結
以上是生活随笔為你收集整理的Ubuntu设置RS-232串口登陆终端(译文,节选)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 为app录制展示gif
- 下一篇: Android 程序打包及签名