Coding Spirit

一位程序员,比较帅的那种

0%

i.MX setup auto login

The default BSP provided by NXP requires login in UART after booting up, which seems “unfriendly” to some users.

In i.MX Yocto BSP, Login is provided by a systemd service called systemd-serialgetty:
sources/poky/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service
This service will execute agetty when system booting up and require login.

So there are two ways to disable login:

Replace agetty with /bin/login

1
ExecStart=/bin/login -f root

Provide username to agetty

Add option -a to provide username to agetty.

1
2
3
4
5
6
7
[Service]
Environment="TERM=xterm"
#ExecStart=-/sbin/agetty -8 -L %I @BAUDRATE@ $TERM
ExecStart=-/sbin/agetty -8 -a root -L %I @BAUDRATE@ $TERM
Type=idle
Restart=always
RestartSec=0