用串口线控制linux主机

内核编译和嵌入式产品的设计与开发
回复
头像
pink_zhuxincong
帖子: 43
注册时间: 2012-02-15 9:57

用串口线控制linux主机

#1

帖子 pink_zhuxincong » 2012-02-20 14:47

今天小白(我)看了一篇关于 用串口线控制linux主机 的文章 大致内容说的是:
在/etc/inittab中能看到
# Run gettys in standard runlevels
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

然后配置一句 T0:23:respawn:/sbin/agetty -L ttyS0 9600 vt100

之后,用win机器上的超级终端,用默认的9600速率连接串口1,可以看到linux的登录提示了。


我也按照这个方法去尝试了下,因为ubuntu11.10版中是没有inittab的,所以我就用root身份去添加了一个inittab,但是里面不知道配置点什么,复制了:
# Run gettys in standard runlevels
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

T0:23:respawn:/sbin/agetty -L ttyS1 9600 vt100(因为我的串口是ttyS1)

之后我重启了Linux,但是在Windows端的超级终端并没有看到Linux的登录提示。

最近在弄的东西,和这个效果一样,想请各位大神们帮助下~应该如果的配置才能到达这个要求~ :em20 :em20 :em20
头像
daf3707
论坛版主
帖子: 12739
注册时间: 2007-06-13 15:57
来自: 在他乡

Re: 用串口线控制linux主机

#2

帖子 daf3707 » 2012-02-20 14:53

好执着啊,纯支持了
头像
pink_zhuxincong
帖子: 43
注册时间: 2012-02-15 9:57

Re: 用串口线控制linux主机

#3

帖子 pink_zhuxincong » 2012-02-20 14:54

daf3707 写了:好执着啊,纯支持了
我只是在学习,然后想弄懂,这样我死了也可以闭眼~ :em03
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

Re: 用串口线控制linux主机

#4

帖子 eexpress » 2012-02-20 15:16

代码: 全选

● cat /etc/init/tty1.conf 
# tty1 - getty
#
# This service maintains a getty on tty1 from the point the system is
# started until it is shut down again.

start on stopped rc RUNLEVEL=[2345] and (
            not-container or
            container CONTAINER=lxc or
            container CONTAINER=lxc-libvirt)

stop on runlevel [!2345]

respawn
exec /sbin/getty -8 38400 tty1
现在是upstart,估计应该改这里。
● 鸣学
头像
pink_zhuxincong
帖子: 43
注册时间: 2012-02-15 9:57

Re: 用串口线控制linux主机

#5

帖子 pink_zhuxincong » 2012-02-20 15:23

eexpress 写了:

代码: 全选

● cat /etc/init/tty1.conf 
# tty1 - getty
#
# This service maintains a getty on tty1 from the point the system is
# started until it is shut down again.

start on stopped rc RUNLEVEL=[2345] and (
            not-container or
            container CONTAINER=lxc or
            container CONTAINER=lxc-libvirt)

stop on runlevel [!2345]

respawn
exec /sbin/getty -8 38400 tty1
现在是upstart,估计应该改这里。

我也查看了下/etc/init/tty1.conf

代码: 全选

# tty1 - getty
#
# This service maintains a getty on tty1 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 -8 38400 tty1
是不是修改的和你的一样?
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

Re: 用串口线控制linux主机

#6

帖子 eexpress » 2012-02-20 15:30

具体的,我可没搞过这。你摸索。只是告诉你,系统机制是变了。
● 鸣学
头像
pink_zhuxincong
帖子: 43
注册时间: 2012-02-15 9:57

Re: 用串口线控制linux主机

#7

帖子 pink_zhuxincong » 2012-02-20 15:31

eexpress 写了:具体的,我可没搞过这。你摸索。只是告诉你,系统机制是变了。
恩,感谢,我去摸索下。希望有懂的人也帮助我下,我走的弯路太多了~
头像
pink_zhuxincong
帖子: 43
注册时间: 2012-02-15 9:57

Re: 用串口线控制linux主机

#8

帖子 pink_zhuxincong » 2012-02-21 8:50

还是不行,求大家帮助
头像
poweroff
帖子: 395
注册时间: 2008-12-13 15:03

Re: 用串口线控制linux主机

#9

帖子 poweroff » 2012-02-21 8:56

在/etc/init/中添加一个文件,ttyS1.conf
内容就是

代码: 全选

# tty1 - getty
#
# This service maintains a getty on tty1 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 ttyS1 9600 vt100
一条狗的马甲!
对不起,我承认我是一只穿着马甲的狗!
头像
pink_zhuxincong
帖子: 43
注册时间: 2012-02-15 9:57

Re: 用串口线控制linux主机

#10

帖子 pink_zhuxincong » 2012-02-21 11:54

poweroff 写了:在/etc/init/中添加一个文件,ttyS1.conf
内容就是

代码: 全选

# tty1 - getty
#
# This service maintains a getty on tty1 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 ttyS1 9600 vt100
我试下,感谢你的帮助
头像
pink_zhuxincong
帖子: 43
注册时间: 2012-02-15 9:57

Re: 用串口线控制linux主机

#11

帖子 pink_zhuxincong » 2012-02-22 9:57

poweroff 写了:在/etc/init/中添加一个文件,ttyS1.conf
内容就是

代码: 全选

# tty1 - getty
#
# This service maintains a getty on tty1 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 ttyS1 9600 vt100
还是没有恩。~~
还请大家多帮助下~我已经要奔溃了
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

Re: 用串口线控制linux主机

#12

帖子 eexpress » 2012-02-22 10:01

/etc/init/tty1.conf
你就改现成的文件试试。

或者

啥都不改。直接使用gtkterm测试下串口先。
● 鸣学
回复