问题遇到的现象和发生背景
linux 移植(boot+kenerl+rootfs),烧录镜像后后串口监控启动信息
1.切换控制台失败;
[ TIME ] Timed out waiting for device dev-ttyS0.device. [DEPEND] Dependency failed for Serial Getty on ttyS0.
问题相关代码,请勿粘贴截图
[ OK ] Stopped Getty on tty1.
[ OK ] Started Getty on tty1.
[ OK ] Stopped Getty on tty1.
[ OK ] Started Getty on tty1.
[ OK ] Stopped Getty on tty1.
[ OK ] Started Getty on tty1.
[ OK ] Stopped Getty on tty1.
[ OK ] Started Getty on tty1.
[ TIME ] Timed out waiting for device dev-ttyS0.device.
[DEPEND] Dependency failed for Serial Getty on ttyS0.
[ OK ] Reached target Login Prompts.
[ OK ] Reached target Multi-User System.
Starting Update UTMP about System Runlevel Changes.
[ OK ] Started Update UTMP about System Runlevel Changes.
我的解答思路和尝试过的方法
尝试过网上推荐的方法,无效果
Steps
- First copy the template:
cp /usr/lib/systemd/system/serial-getty@.service /etc/systemd/system/serial-getty@ttyS0.service
- Then edit the file and modify the agetty line:
[Service]
ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 %I $TERM <-- Change this parameter
Type=idle - Create a symlink:
ln -s /etc/systemd/system/serial-getty@ttyS0.service /etc/systemd/system/getty.target.wants/