https://whycan.cn/t_542.html
找到 /etc/inittab 文件的

console::respawn:/sbin/getty -L  console 0 vt100 # GENERIC_SERIAL

修改为:

console::respawn:-/bin/sh

重启后就没有恼人的 login 提示了.


1. 一个绕过getty 的login的方法

  1. Change the symbolic link to point to the busybox's getty:

    # ln -s /bin/busybox /sbin/getty

2.In board's /etc/inittab change the getty line to:

S:2345:respawn:/sbin/getty 115200 ttyO2 -n -l /bin/autologin
  1. Create executable /bin/autologin script with the following content:

    #!/bin/sh
    exec /bin/login -f root

此法能正常进入shell。 登陆用户 和 tty 连接都正常。
Autologin on serial consoles 介绍了同样的方法,多讲了 sulogin。

2、"2:2345:respawn:/bin/login -f root" 可以登陆,可以执行 /etc/profile.d ,也就是保存了登陆用户身份,但是丢失了 tty2 的连接。

3、 ::respawn:/sbin/getty -n -L ttySA0 115200 vt100 -n -l /bin/sh

-n(含)之后的部分确实可以跳过 login,进入一个交互界面。但是没有执行 /etc/profile.d下的文件。进一步测试表明,只是进入了一个shell交互界面,并没有登陆任何用户。但是保持了 tty 的连接。

4、http://wiki.gumstix.org/index.php?title=AutoLogin 介绍了写一个 autologin 程序的方法,与上述1类似。

5、在uboot的bootargs中添加 init=/bin/sh,不管用

6、ttySA0::askfirst:-/bin/sh 或者 ttySA0::respawn:-/bin/sh 。系统能运行,但是没有交互界面,也没有执行 /etc/profile.d下的文件。

相关项目在 /opt/petalinux-v2014.2-final/components/rootfs/petalinux-rootfs/sys_init/Makefile 中

来源: http://blog.sina.com.cn/s/blog_735da7ae0102v2o0.html

标签: none

添加新评论