我正在将 linux 移植到使用 ARM Primecell pl011 串行 IP 内核的定制板。
- Linux 版本为 4.7.0-rc1+。
- 我没有使用 DMA 引擎。
- 我正在使用 devtmpfs
- 我指定了引导参数“console=ttyAMA0”
- 在打开/dev/console 之前输出启动日志
- 打开/dev/console后停止输出
init/main.c:kernel_init_freeable()
[...]
printk("open /dev/console\n"); // <- this will be outputted
/* Open the /dev/console on the rootfs, this should never fail */
if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
pr_err("Warning: unable to open an initial console.\n");
printk("opened /dev/console\n"); // <- this will not be outputted
[...]
感谢任何提示...
最佳答案
我找到了罪魁祸首!!! DTS 中的时钟频率设置错误。 我猜驱动程序使用了错误的时钟并且可以偶然看到输出。(我没有在 bootargs 中指定波特率,那只是“console=ttyAMA0”) 当我将 DTS 中的时钟频率更改为正确的频率时。现在一切都很完美!!!
关于linux pl011串口驱动: do not output after open/dev/console,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40518958/