armlinux开发板用户自动登录

开发板:AM335
虚拟机:ubuntu 14.04
编译器:gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf
开发板内核:linux 4.4.12

设置开发板自动登录目前而言就两种方法
1.修改/etc/inittab文件
2.systemd方法

1.要是文件系统有/etc/inittab文件的话就可以修改/etc/inittab文件
找到如下两行代码,并在其前面添加#,将这两行代码注释掉,代码如下:
O0:12345:respawn:/sbin/getty 115200 ttyO0
1:2345:respawn:/sbin/getty 38400 tty1
在文件最后添加如下代码:
0:12345:respawn:/sbin/mingetty –autologin=root –noclear ttyO0

2.我开发板Am335使用的是systemd,systemd 不使用 /etc/inittab 文件。

root@am335x-evm:~# /sbin/agetty    

Usage:
 agetty [options] <line> [<baud_rate>,...] [<termtype>]
 agetty [options] <baud_rate>,... <line> [<termtype>]

Open a terminal and set its mode.

Options:
 -8, --8bits                assume 8-bit tty
 -a, --autologin <user>     login the specified user automatically
 -c, --noreset              do not reset control mode
 -E, --remote               use -r <hostname> for login(1)
 -f, --issue-file <file>    display issue file
 -h, --flow-control         enable hardware flow control
 -H, --host <hostname>      specify login host
 -i, --noissue              do not display issue file
 -I, --init-string <string> set init string
 -J  --noclear              do not clear the screen before prompt
 -l, --login-program <file> specify login program
 -L, --local-line[=<mode>]  control the local line flag
 -m, --extract-baud         extract baud rate during connect
 -n, --skip-login           do not prompt for login
 -N  --nonewline            do not print a newline before issue
 -o, --login-options <opts> options that are passed to login
 -p, --login-pause          wait for any key before the login
 -r, --chroot <dir>         change root to the directory
 -R, --hangup               do virtually hangup on the tty
 -s, --keep-baud            try to keep baud rate after break
 -t, --timeout <number>     login process timeout
 -U, --detect-case          detect uppercase terminal
 -w, --wait-cr              wait carriage-return
     --nohints              do not print hints
     --nohostname           no hostname at all will be shown
     --long-hostname        show full qualified hostname
     --erase-chars <string> additional backspace chars
     --kill-chars <string>  additional kill chars
     --chdir <directory>    chdir before the login
     --delay <number>       sleep seconds before prompt
     --nice <number>        run login with this priority
     --reload               reload prompts on running agetty instances
     --help                 display this help and exit
     --version              output version information and exit
For more details see agetty(8).

可以看到有个参数是可以设置自动登录的 所以只要在对应的文件里加入这个参数就能自动登录了
修改/etc/systemd/system/getty.target.wants/serial-getty@ttyS3.service文件
在里面把ExecStart修改为如下所示
ExecStart=-/sbin/agetty -8 -L %I 115200 $TERM –autologin root
然后重启开发板就重启就可以发现自动登录了

Arago Project http://arago-project.org am335x-evm ttyS3

Arago 2016.05 am335x-evm ttyS3

am335x-evm login: root (automatic login)

Last login: Wed Jul 12 02:20:59 UTC 2017 on tty1
root@am335x-evm:~# 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值