virtme-run: Add --console

This doesn't work.  It's a demonstration of how to crash some kernels.

Signed-off-by: Andy Lutomirski <luto@amacapital.net>
diff --git a/virtme-run b/virtme-run
index 92d9fe7..d6ab9dd 100755
--- a/virtme-run
+++ b/virtme-run
@@ -35,6 +35,10 @@
 #    g.add_argument('--kernel-build-dir', action='store', metavar='KDIR',
 #                   help='Use a compiled kernel source directory')
 
+    g = parser.add_argument_group(title='Canned settings')
+    g.add_argument('--console', action='store_true',
+                   help='Run headless -- use ctrl-A, x to exit')
+
     g = parser.add_argument_group(title='Virtualizer settings')
     g.add_argument('--qemu-opts', action='store', nargs=argparse.REMAINDER,
                    metavar='OPTS...', help='Additional arguments for QEMU.  This will consume all remaining arguments, so it must be specified last.')
@@ -124,6 +128,16 @@
     qemuargs.extend(['-parallel', 'none'])
     qemuargs.extend(['-net', 'none'])
 
+    if args.console:
+        qemuargs.extend(['-echr', '1'])
+        qemuargs.extend(['-chardev', 'stdio,id=hvc0,signal=off,mux=on'])
+        qemuargs.extend(['-device', 'virtio-serial-pci'])
+        qemuargs.extend(['-device',
+                         'virtconsole,chardev=hvc0,name=virtme_console'])
+        qemuargs.extend(['-append', 'console=hvc0 console=tty0'])
+#        qemuargs.extend(['-vga', 'none'])
+#        qemuargs.extend(['-display', 'none'])
+
     # Handle --qemu-opts
     if args.qemu_opts is not None:
         qemuargs.extend(args.qemu_opts)