Wednesday, June 10, 2015

GSoc: Configure a serial console for the Qemu Virtual Machine

As I am stuck in the dark when I boot up, so I asked for help on the mailing list. And got some help from Gerd Hoffmann, here is what he said:
With fbdev enabled a lot initialization happens with some important console lock taken, which has the effect that you don't see any kernel messages until it succeeded. 
He suggested me to configure a serial console for the virtual machine.

Following is what I did configuring the serial console:

  1. In the virtual machine, add a parament to the grub menuentry something like "console=ttyS0,9600n8"
  2. Add a parameter when start the qemu virtual machine, the command now looks like:
    • qemu-system-x86_64 -m 1024 -smp 2 -hda ./linux-bochs.img -no-acpi -vga std -k en-us -serial pty
    • and get the redirected device: "char device redirected to /dev/pts/2"
  3. Now I can see the kernel messages from the the virtual machine using the following command:
    • cat /dev/pts/2

This is trivial, post it here if anyone came across the same problem.

2015/06/11
After email with Gred, here is what he suggested:

  • use 115200 as line speed to speedup the console a bit
  • -serial stdio might be more convenient, so that we don't need the "cat /dev/pts/2" step, the messages from the virtual machine serial console will display to the qemu terminal of the host machine.
  • on modern linux distros (anything systemd-based) you should automatically get a login prompt on the serial line in case it is configured as console. Try adding "ignore_loglevel" and "drm.debug=0x07" to the kernel command line.
  • we can blacklist the module in modprobe.conf (or /etc/modprobe.d) to prevent it from autoloading.

No comments:

Post a Comment