u-boot起来之后,通过网络加载内核、文件系统及设备树,发现加载过程中串口出现乱码,并死机。
串口驱动:/driver/tty/serial.c
打印出自 :/kernel/printk.c
int unregister_console(struct console *console)
{
struct console *a, *b;
int res;
pr_info("%sconsole [%s%d] disabled\n",
(console->flags & CON_BOOT) ? "boot" : "" ,
console->name, console->index);
}
Console_regiseter
{
static int __init serial8250_init(void)
{
int ret;
serial8250_isa_init_ports();
printk(KERN_INFO "Serial: 8250/16550 driver, "
"%d ports, IRQ sharing %sabled\n", nr_uarts,
share_irqs ? "en" : "dis");
串口这块正常打印应该如下
Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
console [ttyS0] disabled
serial8250.0: ttyS0 at MMIO 0xffe11c500 (irq = 36, base_baud = 18750000) is a 16550A_FSL64
console [ttyS0] enabled
console [ttyS0] enabled
bootconsole [udbg0] disabled
bootconsole [udbg0] disabled
serial8250.0: ttyS1 at MMIO 0xffe11c600 (irq = 36, base_baud = 18750000) is a 16550A_FSL64
serial8250.0: ttyS2 at MMIO 0xffe11d500 (irq = 37, base_baud = 18750000) is a 16550A_FSL64
serial8250.0: ttyS3 at MMIO 0xffe11d600 (irq = 37, base_baud = 18750000) is a 16550A_FSL64
ePAPR hypervisor byte channel driver
如果设备树不配置串口,内核加载会是设么情况?
结果:
关于串口驱动
驱动文件
\t1042_linux_src\drivers\tty\serial\of_serial.c
设备树
8250_core中暂时不删除console
串口打印暂时正常了,可以继续往下调试
继续往下执行,死在flash探测的地方
修改设备树,去掉nor和nand设备树描述
执行结果 :
Flash探测不执行,其他继续往下执行,但是串口最后还是死了
真相是console并没有问题,一直以为是console关闭了,导致最后串口死掉了。起始死掉的不是console,而是后面nor flash驱动导致串口死掉