我正在尝试使用early printk
用于arm64
架构但是没有这样的功能。在arm64中有一种叫做earlycon
的东西取代了earlyprintk
,但它的用法并不为我所知。我需要在初始化真正的控制台之前将消息打印到串行控制台。有没有办法在arm64
使用earlycon
做到这一点。我将一个名为arm64: Add simple earlyprintk support
的补丁应用于kernel 3.18
,但它没有成功应用。什么在arm64
而不是printch
使用?
可以使用设备树选择的节点或使用引导参数来链接功能性uart驱动程序。
在开始使用它之前,您应该检查平台UART驱动程序是否支持EARLYCON。例如,直接从owl-uart.c复制
static int __init
owl_uart_early_console_setup(struct earlycon_device *device, const char *opt)
{
if (!device->port.membase)
return -ENODEV;
device->con->write = owl_uart_early_console_write;
return 0;
}
OF_EARLYCON_DECLARE(owl, "actions,owl-uart",
owl_uart_early_console_setup);
在这里,您可以看到UART驱动程序注册了它的早期控制台功能,它将由ARCH init代码调用(在start_kernel之前运行)。
两个选项,
uart3: serial@e0126000 {
compatible = "actions,s900-uart", "actions,owl-uart";
reg = <0x0 0xe0126000 0x0 0x2000>;
interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
status = "okay";
};
aliases {
serial3 = &uart3;
};
chosen {
stdout-path = "serial3:115200n8";
};
这个例子再次来自here的Actions SoC。有了这个条目,就需要从u-boot或使用相同的选择节点“bootargs”选项将bootargs作为“earlycon”。
你可以找到更多细节here。