将Qemu控制台重定向到文件或主机终端?
我的系统是基于x86的内核,并且是 ramfs 的根文件系统.我已经基于cpio归档文件制作了基于ramfs的文件(它将使用boot =/dev/ram0作为RAM设备),并且在初始化方面遇到了一些问题.整个目的是将ramfs优化到最小,以适合非常小的系统.我正在尝试在init中调试问题.我在
My system is an x86-based kernel and ramfs-based root filesystem. I have made the ramfs-based on the cpio archive (which will use boot=/dev/ram0 as the RAM device), and I am having some issues with the init. The whole intention is to optimise the ramfs to the minimum to fit in a really small system. I am trying to debug the problem in the init. I start QEMU in Ubuntu 12.10 (Quantal Quetzal) using the command:
qemu-system-x86_64 -kernel linux-3.9.2/arch/x86/boot/bzImage -serial stdio \
-append "root=/dev/ram0 console=tty1"
按照预期,系统将转到OOPS.
And as expected the system goes to OOPS.
我想查看日志以调查崩溃的原因,但是我无法使用 Shift 键和 Page Up / Page Down .因此,我尝试通过以下命令使用curses将输出重定向到主机终端:
I would like to see the logs to investigate the reason for the crash, but I cannot navigate in the QEMU console using the Shift key and Page Up/Page Down. So I tried redirecting the output to the host terminal using curses by the command:
qemu-system-x86_64 -kernel linux-3.9.2/arch/x86/boot/bzImage -serial stdio \
-append "root=/dev/ram0 console=tty1" -curses
但是在这里我无法导航并找到问题.
But here again I am unable to navigate and find the problem.
P.S.如果我的系统正常运行(使用正确的rootfs),则可以导航并查看消息.
P.S. If my system boots fine (using the correct rootfs) then I am able to navigate and see the messages.
如何将消息重定向到终端或文件?
How do I redirect the messages to the terminal or to a file?
添加以下命令: console = ttyAMA0 console = ttyS0
qemu-system-x86_64 -kernel linux-3.9.2/arch/x86/boot/bzImage -serial stdio \
-append "root=/dev/ram0 console=ttyAMA0 console=ttyS0"
现在,所有dmesg日志都将重定向到您的控制台.
Now all dmesg logs will be redirected to your console.
另一件事:从上述命令中我观察到,您的初始RAM磁盘在哪里?即- -initrd(initrdimage)
One more thing: I observed from above command, where is your initial RAM disk? i.e - -initrd (initrdimage)
要启动系统,您需要两个映像,1)zImage或bZimage(对于x86)2)rootfs-根文件系统
To boot the system you need two images, 1) zImage or bZimage (in case of x86) 2) rootfs -root file system
在您的情况下,缺少的组件是rootfs.
The missing component is rootfs in your case.