首页 > 代码库 > 如何设置ubuntu系统的串口输出(一)

如何设置ubuntu系统的串口输出(一)

1. 平台:intel X86 baytrail平台

2. 由于开发模式需要查看内核串口输出,所以需要将linux系统从开机到系统引导起来的部分都定向到串口,那么如何设置呢?

安装ubuntu系统后(这里装的是14.10版本的ubuntu系统)

(1)首先设置grub参数:

修改/etc/default/grub文件:

修改如下内容为:

GRUB_CMDLINE_LINUX_DEFAULT="text console=tty0 console=ttyS0,115200n8"

然后增加一行:

GRUB_SERIAL_COMMAND="serial  --unit=0 --speed=115200 --word=8 --parity=no --stop=1"

然后执行update-grub,使配置生效

(2)然后在/etc/init/目录中创建ttyS0.conf,内容如下:

#ttyS0  - getty

start on rc RUNLEVEL=[2345]

stop on runlevel [!2345]

respawn

exec /sbin/getty -L 115200 ttyS0 vt100


遗留问题:

系统起来后,在串口部分只显示到:



 * Starting regular background program processing daemon[ OK ]
 * Starting Signal sysvinit that alsa-utils tasks are complete[ OK ]
 * Starting CPU interrupts balancing daemon[ OK ]
 * Stopping save kernel messages[ OK ]
 * Stopping Restore Sound Card State[ OK ]
 * Starting cups-browsed - Bonjour remote printer browsing daemon[ OK ]
 * Starting automatic crash report generation[ OK ]
 * Starting configure virtual network devices[ OK ]
[ OK ]toring resolver state...        
[ OK ]rting uuid generator uuidd        
 * speech-dispatcher disabled; edit /etc/default/speech-dispatcher
saned disabled; edit /etc/default/saned
 * Stopping System V runlevel compatibility[ OK ]
 * Stopping cold plug devices[ OK ]
 * Stopping log initial device creation[ OK ]
 * Starting save udev log and update rules[ OK ]
[  150.593006] systemd-logind[947]: Failed to start unit user@1000.service: Unknown unit: user@1000.service
[  150.602779] systemd-logind[947]: Failed to start user service: Unknown unit: user@1000.service

然后在VGA上有显示登录,但是串口上没有显示

这里需要进一步研究

不过总算将这一步做出来了,后面的问题就是开机脚本配置的问题了

另外也说明了,之前购买的baytrail主板确实串口硬件有问题,小厂自己做的主板不如品牌主板给力

如何设置ubuntu系统的串口输出(一)