Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

redirect QEMU window output to terminal running qemu

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" 

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.

Now i can start using the kernel terminal I'm running and seeing the output in the terminal and not in QEMU window.

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..) ?

like image 489
yonigo Avatar asked Oct 24 '13 11:10

yonigo


People also ask

How do I exit QEMU window?

Shutting down QEMU: If you are running in graphics mode, then from the ctrl-alt-2 qemu window, type "quit" after "Power down" to exit the qemu process.

How do I connect to QEMU console?

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.

How do I exit QEMU from command line?

make qemu. Build everything and start qemu with the VGA console in a new window and the serial console in your terminal. To exit, either close the VGA window or press Ctrl-c or Ctrl-a x in your terminal.


2 Answers

  1. remove -serial stdio parameter
  2. add -nographic parameter
  3. and change the kernel parameter terminal = ttyS0 to console=ttyS0. This should do the trick.

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 qemu cli parameters there)

like image 179
Anton Avatar answered Sep 20 '22 05:09

Anton


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"

like image 23
vinay hunachyal Avatar answered Sep 20 '22 05:09

vinay hunachyal