Linux 将 QEMU 窗口输出重定向到运行 qemu 的终端

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19565116/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-07 01:11:06  来源:igfitidea点击:

redirect QEMU window output to terminal running qemu

linuxdebugginglinux-kernelqemu

提问by yonigo

Im trying to debug the boot sequence of a linux kernel with qemu, the command i'm running is:

我试图用 qemu 调试 linux 内核的启动顺序,我正在运行的命令是:

  qemu -serial stdio -kernel <path to kernel> -hda <path to rootfs> -append "root=/dev/sda terminal = ttyS0"

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 窗口。只有在启动完成后,我才会将提示返回到我运行 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..) ?

我如何将包括启动消息在内的所有消息发送到我的终端而不是 QEMU 窗口(因为我无法在该窗口中向上滚动..)?

采纳答案by Anton

  1. remove -serial stdioparameter
  2. add -nographicparameter
  3. and change the kernel parameter terminal = ttyS0to console=ttyS0. This should do the trick.
  1. 删除-serial stdio参数
  2. 添加-nographic参数
  3. 并将内核参数更改terminal = ttyS0console=ttyS0. 这应该可以解决问题。

qemu -nographic -kernel ./bzImage -hda ./image.hda -append root=/dev/sda console=ttyS0

qemu -nographic -kernel ./bzImage -hda ./image.hda -append root=/dev/sda console=ttyS0

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 qemucliparameters there)

您可能想检查我用于内核开发的脚本:https: //github.com/arapov/wrap-qemukvm(它不是很“生产”,但您可以在qemucli那里找到有用的参数)

回答by rakib_

Redirecting Qemu output to terminal might cause some problem (personally i don't like it). You can using options like -noframe(this will create new window but won't any window frame) or -cursesto experience qemu output on terminal.

将 Qemu 输出重定向到终端可能会导致一些问题(我个人不喜欢它)。您可以使用类似的选项-noframe(这将创建新窗口但不会创建任何窗口框架)或-curses在终端上体验 qemu 输出。

回答by vinay hunachyal

refer this Redirect Qemu console to a file or the host terminal?to get the log on both qemu and your terminal .use "console=ttyAMA0,115200 console=tty highres=off console=ttyS0"

将此重定向 Qemu 控制台引用到文件或主机终端?获取 qemu 和终端上的日志 .use "console=ttyAMA0,115200 console=tty highres=off console=ttyS0"