29

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

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
yonigo
  • 987
  • 1
  • 15
  • 30

3 Answers3

48
  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)

user123456
  • 364
  • 1
  • 3
  • 16
Anton
  • 976
  • 8
  • 9
11

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"

Community
  • 1
  • 1
vinay hunachyal
  • 3,781
  • 2
  • 20
  • 31
  • It is not the solution for my trivial problem, the second tty console disappeared in qemu: http://raspberrypi.stackexchange.com/questions/56302/qemu-2-7-0-for-the-raspi2-machine-do-not-show-the-second-tty-console-only-the – 42n4 Oct 13 '16 at 16:27
  • @42n4 https://learningfromyoublog.wordpress.com/ or https://learningfromyoublog.wordpress.com/2016/04/05/131/ – vinay hunachyal Oct 14 '16 at 05:18
  • I used the qemu machine raspi2 and cpu arm1176 and compiled with armv7a-hardfloat the original raspberry kernel sources with bcm2709_defconfig, so all was very "native" and it is vary sad it is not working at once, look at my question makefile: http://raspberrypi.stackexchange.com/questions/56302/qemu-2-7-0-for-the-raspi2-machine-do-not-show-the-second-tty-console-only-the – 42n4 Oct 14 '16 at 11:57
3

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 -curses to experience qemu output on terminal.

rakib_
  • 136,911
  • 4
  • 20
  • 26