QEMU-在“引导内核"之后没有内核输出. [英] QEMU - No kernel output after "Booting kernel"

查看:802
本文介绍了QEMU-在“引导内核"之后没有内核输出.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在QEMU自己创建的机器上引导预编译的内核.

I try to boot precompiled kernel in QEMU self-created machine.

已配置了串行外围设备,我成功地可以为此机器引导预编译的U-boot映像.

Serial peripherial is configured and I sucessfully can boot precompiled U-boot image for this machine.

在U-Boot中,所有串行IO都可以正常工作(在计算机设置程序中还准备了内存地址和UART地址).使用-nographic选项,我可以在UBoot命令提示符下进行读写.

In U-Boot all serial IO works great (memory adressing and UART address is also prepared in machine setup). Using option -nographic i can read and write in UBoot command prompt.

我可以在Uboot中发出bootm命令以将内核加载到RAM并引导它.我看到的最后一个字符串是正在解压缩Linux ...完成.正在启动内核...".

I can issue a bootm command in Uboot to load kernel to RAM and boot it. Last string i see is "Uncompressing Linux...done. Booting kernel...".

我那里有黑屏.

主要区别在于内核的工作原理是因为使用远程GDB会话,我看到它使用printk函数打印输出,例如Banner和更多信息.但是在QEMU屏幕上我什么都没有.

The main difference is that kernel WORKS because using a remote GDB session i see that it prints output like Banner and more information using printk functions. But on a QEMU screen i have none.

问题:早期在内核中的哪里进行console = ttyS0,115200的设置?我试图在内核源中进行搜索,但是找不到调试问题的地方.

Question: Where in kernel in early stage is a setup of console=ttyS0,115200 setup being done? I tried to search in kernel sources and cannot find a place to debug the problem.

在设置内核之前,内核如何知道要传递给串行的内容?有RAM环形缓冲区吗?

How kernel knows what to pass to serial before setting one up? Is there a RAM Ring buffer?

有任何线索吗?

推荐答案

为ARM机器引导预编译的U-Boot映像时,它已经包含:内核,initramfs/initrd文件和已编译的设备树二进制文件(.dtb)文件滚动成一种图像格式,U-Boot可以识别,解压缩,加载到内存中并用于启动启动过程.在这种情况下,console = ttyS0,115200信息包含在原始设备树规范(DTS)文件的.dtb文件中,该文件将包含以下部分:

When you boot your precompiled U-Boot image for an ARM machine, it already includes: a kernel, an initramfs/initrd file, and a compiled device tree binary (.dtb) file rolled into an image format which U-Boot can recognise, unpack, load into memory and use to kick off the booting process. In this case, the console=ttyS0,115200 information is included in the .dtb file from the original device tree specification (DTS) file which will contain a section that looks like:

chosen {
    bootargs = "console=ttyS0,115200n8 maxcpus=2, envaddr = <0xfa0f0000>";
};

最终,U-Boot将二进制.dtb文件加载到内存中,并将指向该文件的指针传递给内核,内核随后可以推断出控制台参数并显示控制台输出.

Ultimately U-Boot loads the binary .dtb file into memory and passes a pointer to it to the kernel, which can then deduce the console parameters and display console output.

相反,当您希望将内核加载到内存中并使用U-Boot bootm命令时,必须自己确保已将initramfs/initrd和.dtb文件加载到内存中(也许通过tftp),并且地址是作为参数传递给bootm.完成此操作后,内核将有机会像在U-Boot映像情况下一样,从.dtb中获取控制台参数,然后您应该会看到控制台输出.用于此操作的内核代码位于4.19内核中的drivers/of/base.c of_console_check()中.

When instead you prefer to load the kernel into memory and use the U-Boot bootm command, you must yourself ensure that the initramfs/initrd and .dtb file have been loaded into memory (perhaps via tftp) and that the addresses are passed as arguments to bootm. Once that has been done, the kernel has the opportunity to fetch the console parameters from the .dtb as it did in the U-Boot image case and you should then see your console output. The kernel code to do this was, in the 4.19 kernel, located in drivers/of/base.c of_console_check().

如果该答案对您有帮助,请考虑将其标记为最终答案-谢谢.祝您好运,启动QEMU并运行控制台输出!

If this answer helps you, please consider marking it as the definitive answer - thanks. Good luck getting your QEMU booted and console output working!

这篇关于QEMU-在“引导内核"之后没有内核输出.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆