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"
And as expected the system goes to OOPS.
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. 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?
You can access the monitor console from QEMU window either by a keyboard shortcut—press Ctrl–Alt–2 (to return to QEMU, press Ctrl–Alt–1)—or alternatively by clicking View in the QEMU GUI window, then compatmonitor0. The most convenient way is to show the QEMU window tabs with View › Show Tabs.
Qemu is a machine emulator that can run operating systems and programs for one machine on a different machine. Mostly it is not used as emulator but as virtualizer in collaboration with KVM kernel components. In that case it utilizes the virtualization technology of the hardware to virtualize guests.
The monitor is accessed from within QEMU by holding down the Ctrl and Alt keys (or whatever the "mouse grab" keystrokes are), and pressing Ctrl-Alt-2 . Once in the monitor, Ctrl-Alt-1 switches back to the guest OS. Typing help or ? in the monitor brings up a list of all commands.
Add the below command: 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"
Now all dmesg logs will be redirected to your console.
One more thing: I observed from above command, where is your initial RAM disk? i.e - -initrd (initrdimage)
To boot the system you need two images, 1) zImage or bZimage (in case of x86) 2) rootfs -root file system
The missing component is rootfs in your case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With