如何直接在控制台中启动 qemu(*不是*在curses或SDL中)

ana*_*cat 26 terminal display serial qemu curses

我似乎记得能够仅使用终端仿真器输出启动 qemu,同时禁用图形窗口。在这里我不是说 ncurses 界面,那个界面很好,但我希望输出直接流入我的终端,使剪切和粘贴更容易。

我试过了:

qemu -nographic binary.img # simply no display
qemu -curses binary.img # nice text output, but not directly flowing in the terminal
qemu -noframe -curses binary.img # same as above
qemu -nographic -curses binary.img
Run Code Online (Sandbox Code Playgroud)

我想一个可以接受的解决方法是让我能够调整 curses 控制台的大小以适应我正在使用的终端。现在很烦人,因为它不适合终端尺寸......

qemu -curses  binary.img



           SeaBIOS (version 1.7.0-20120603_194846-gandalf)



           iPXE (http://ipxe.org) 00:03.0 C900 PCI2.10 PnP PMM+07FC86A0+07F886A0 C900


           Booting from Hard Disk...
           [...]
Run Code Online (Sandbox Code Playgroud)

注意显示是如何缩进 12 个空格的?恼人的。:)

小智 27

老问题,但它可能仍然引起人们的兴趣。

简短的回答:

qemu -nographic -serial mon:stdio -append 'console=ttyS0' binary.img
Run Code Online (Sandbox Code Playgroud)

ttyS0在大多数 PC 上有效。在 ARM 系统上会有所不同。

然后串行端口和 QEMU 在您的输出上多路复用。您可以使用 来在它们之间切换ctrl-A + C + ENTER

长答案:检查这个博客,它很棒。


sen*_*nfo 4

安装SGABIOS - ISTR,最新的 Qemu 版本在运行时会自动使用它-nographic