Origin of question:
When porting linux in imx27ads, uart serial port is usually used as console. I would like to know if I can have kernel booting message output on both of serial console and framebuffer console or switch from serial console to framebuffer console.
The way to Rome:
1. Configure the kernel and enable the framebuffer as console device like this (take imx27ads kernel for example):
CONFIG_FB=y
CONFIG_FB_CFB_FILLRECT=y
CONFIG_FB_CFB_COPYAREA=y
CONFIG_FB_CFB_IMAGEBLIT=y
CONFIG_FB_MXC=y
CONFIG_FB_MXC_SYNC_PANEL=y
CONFIG_DUMMY_CONSOLE=y
CONFIG_FRAMEBUFFER_CONSOLE=y
CONFIG_FONT_8x8=y
CONFIG_FONT_8x16=y
CONFIG_LOGO=y
CONFIG_LOGO_LINUX_CLUT224=y
CONFIG_VT=y
CONFIG_VT_CONSOLE=y
2. Pass right console parameters to kernel by kernel command line
1) Only the uart1 as console
console=ttymxc0,115200
2) Only the framebuffer device as console
console=tty0
3) Both the framebuffer device and the uart1 as consoles and the uart1 takes input console
console=tty0 console=ttymxc0,115200
Actually, this will ensure that the boot messages are displayed on both the framebuffer (/dev/tty0) and the serial console (/dev/ttyS0); the last device named in a console= option will be the one that takes input, too, so with the settings above you can use the serial console to enter commands etc. For a more detailed description see http://www.tldp.org/HOWTO/Remote-Serial-
配置选项设置了:
Virtual terminal
Support for console on virtual terminal
之后,就能够在液晶屏上看到小企鹅和控制台输出的启动信息了。这时超级终端上就看不到任何输出,也不能通过计算机的键盘输入任何东西了。
因为fb0已经取代了ttyS0设备作为console的。 但是此时fb0设备是不能够进行输入, 怎样用fb0作为virtual terminal的输出设备同时用ttyS0作为virtual terminal的输入设备呢?
我在做lcd驱动的时候正好碰到这个问题作个总结:
首先我想把从ttyS0接受到的东东show到lcd上面上去,这样不就可以用我的pc键盘实现控制lcd的控制台了吗,于是我在init里面写了,sh < /dev/ttyS0 ,不幸的是我的sh根本不解析<啊,sash的功能不全啊,把这句话直接就打印出来了,晕!于是我换了busybox,现编的,以前没用过,鼓求了半天,在busybox执行的脚本中我还忘了加上#!/bin/sh 了,同事提醒了我,因为我一直用sash的init,所以习惯了,呵呵,修改了之后加上msh < /dev/ttyS0,就一且ok了。现在lcd驱动写好了,console的问题也差不多了:)