Phytec中国的wiki
support@phytec.cn
热线:0755-61802110-803
内核的终端口修改
开发板linux kernel log 控制台串口输出是在commandline中设置的, am335x默认串口输出是ttyO0
commandline: consoleblank=0 console=ttyO0,115200n8 root=/dev/mmcblk0p2 rootflags=data=journal rootwait ro fsck.repair=yes
如果要禁止kernel log在串口输出, 可在barebox中设置
barebox@Phytec phyCORE AM335x:/ nv linux.bootargs.console=console=off nv variable modified, will save nv variables on shutdown barebox@Phytec phyCORE AM335x:/ saveenv saving environment
此时commandline已经修改为
commandline: consoleblank=0 console=off root=/dev/mmcblk0p2 rootflags=data=journal rootwait ro fsck.repair=yes
kernel log也不会在串口输出了, 如果kernel log需要更改为其他串口输出, 也是按照上诉方法把commandline 的console设为其他串口.
linux 登录界面串口终端修改
按照上诉方法kernel log在串口禁止输出设置后, 启动完成后, 串口终端仍有以下登录界面
Loading ARM Linux zImage '/mnt/mmc0.0/linuximage' Loading devicetree from '/mnt/mmc0.0/oftree' commandline: consoleblank=0 console=off root=/dev/mmcblk0p2 rootflags=data=journal rootwait ro fsck.repair=yes ____ _ _ __ __ _____ _____ ____ | _ \ | | | |\ \ / /|_ _|| ____| / ___| | |_) || |_| | \ V / | | | _| | | | __/ | _ | | | | | | |___ | |___ |_| |_| |_| |_| |_| |_____| \____| __ __ ___ ____ _ _ ____ _____ \ \ / / / _ \ / ___|| | | || _ \ |_ _| \ V / | | | || | _ | | | || |_) | | | | | | |_| || |_| || |_| || _ < | | |_| \___/ \____| \___/ |_| \_\ |_| Yogurt (Phytec Example Distribution) BSP-Yocto-AM335x-PD17.2.2 phycore-am335x-1 ttyO0 phycore-am335x-1 login: root root@phycore-am335x-1:~#
通过systemctl查找该服务名称
root@phycore-am335x-1:~# systemctl | grep getty getty@tty1.service loaded active running Getty on tty1 serial-getty@ttyO0.service loaded active running Serial Getty on ttyO0 system-getty.slice loaded active active system-getty.slice system-serial\x2dgetty.slice loaded active active system-serial\x2dgetty.slice getty.target loaded active active Login Prompts
如果需要禁止这个登录界面串口输出的话, 可禁止该服务
root@phycore-am335x-1:~# systemctl disable serial-getty@ttyO0.service Removed /etc/systemd/system/getty.target.wants/serial-getty@ttyO0.service. root@phycore-am335x-1:~# sync
重启之后, 该服务已经被禁止了, 串口0终端就不会再有登录界面了.
如果需要将该登录界面改为在其他串口中显示, 可使能对应串口的getty服务.
root@phycore-am335x-1:~# systemctl enable serial-getty@ttyO1.service
Linux串口终端root用户自动登陆
修改/lib/systemd/system/serial-getty@.service文件,
将service 文件中的
ExecStart=-/sbin/agetty -8 -L %I 115200 $TERM
修改为
ExecStart=-/sbin/agetty -8 -L -a root %I 115200 $TERM
保存后执行sync命令, 重启命令串口终端就会自动登陆root用户.
关闭显示在LCD上的终端口
lcd 关闭qt程序时, 也会显示一个控制台终端界面
____ _ _ __ __ _____ _____ ____ | _ \ | | | |\ \ / /|_ _|| ____| / ___| | |_) || |_| | \ V / | | | _| | | | __/ | _ | | | | | | |___ | |___ |_| |_| |_| |_| |_| |_____| \____| __ __ ___ ____ _ _ ____ _____ \ \ / / / _ \ / ___|| | | || _ \ |_ _| \ V / | | | || | _ | | | || |_) | | | | | | |_| || |_| || |_| || _ < | | |_| \___/ \____| \___/ |_| \_\ |_| Yogurt (Phytec Example Distribution) BSP-Yocto-AM335x-PD17.2.2 phycore-am335x-1 tty1 phycore-am335x-1 login:
如果需要关闭该控制台终端界面, 可禁止该服务
root@phycore-am335x-1:~# systemctl disable getty@tty1.service Removed /etc/systemd/system/getty.target.wants/getty@tty1.service. root@phycore-am335x-1:~# sync
编译好的镜像默认不开启这个终端, 可以在BSP包中自定义的layer上增加recipes-core/systemd/systemd_%.bbappend文件, 内容如下
[meta-custom]/recipes-core/systemd/systemd_%.bbappend
do_install_append() { rm ${D}${sysconfdir}/systemd/system/getty.target.wants/getty@tty1.service }
Overview
Content Tools
Tasks