将 QEMU 窗口输出重定向到运行 qemu 的终端 [英] redirect QEMU window output to terminal running qemu
问题描述
我正在尝试使用 qemu 调试 linux 内核的启动顺序,我正在运行的命令是:
Im trying to debug the boot sequence of a linux kernel with qemu, the command i'm running is:
qemu -serial stdio -kernel <path to kernel> -hda <path to rootfs> -append "root=/dev/sda terminal = ttyS0"
在启动期间,所有内核消息都会打印到 QEMU 窗口.只有在启动完成后,我才会将提示返回到我运行 QEMU 的终端.
During boot all the kernel messages are printed to the QEMU window. Only when the boot has finished i get my prompt back to the terminal i ran QEMU in.
现在我可以开始使用我正在运行的内核终端,并在终端而不是 QEMU 窗口中看到输出.
Now i can start using the kernel terminal I'm running and seeing the output in the terminal and not in QEMU window.
如何将包括启动消息在内的所有消息发送到我的终端而不是 QEMU 窗口(因为我无法在该窗口中向上滚动..)?
How do i get all messages including the boot messages to my terminal and not to QEMU window (because i cant scroll up in that window..) ?
推荐答案
- 移除
-serial stdio
参数 - 添加
-nographic
参数 - 并将内核参数
terminal = ttyS0
更改为console=ttyS0
.这应该可以解决问题.
- remove
-serial stdio
parameter - add
-nographic
parameter - and change the kernel parameter
terminal = ttyS0
toconsole=ttyS0
. This should do the trick.
qemu -nographic -kernel ./bzImage -hda ./image.hda -append root=/dev/sda console=ttyS0
您可能想查看我用于内核开发的脚本:https://github.com/arapov/wrap-qemukvm(它不是很生产",但你可以在那里找到有用的 qemu
cli
参数)
You may want to check the script I use for kernel development: https://github.com/arapov/wrap-qemukvm (it's not very "production", but you can find useful qemu
cli
parameters there)
这篇关于将 QEMU 窗口输出重定向到运行 qemu 的终端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!