QEMU options for debugging kernel
Tags: bsd, kernel, linux, qemu
Published: 2018-11-22 15:50:31

---
title: QEMU options for debugging kernel
published: true
description: 
tags: bsd, kernel, linux, qemu
---

Sec.: sections in [qemu-doc(1)](https://qemu.weilnetz.de/doc/qemu-doc.html)

| Sec.   | Option                                                              | Details                                                                                                                                      |
| ---    | ---                                                                 | ---                                                                                                                                          |
| 2.3.1  | `-smp 4`                                                            | Simulate an SMP system with 4 CPUs                                                                                                           |
| 2.3.1  | `-m 256`                                                            | Memory 256MiB                                                                                                                                |
| 2.3.2  | `-hda netbsd.qcow2`                                                 | Use `netbsd.qcow2` as hard disk 0                                                                                                            |
| 2.3.3  | `-cdrom netbsd.iso`                                                 | Use `netbsd.iso` as CD-ROM image                                                                                                             |
| 2.3.4  | `-display curses`                                                   | Use curses display instead of VGA output; Connect QEMU monitor and `q` to quit                                                               |
| 2.3.4  | `-display none`                                                     | Don't show VGA display                                                                                                                       |
| 2.3.4  | `-nographic`                                                        | `-display none` + `-parallel null`(if `-parallel` not specified) + `-serial mon:stdio`(if `-serial` and `-monitor` not specified); undocumented, investigated by [debugging QEMU][vl.c]         |
| 2.3.6  | `-netdev user,id=n1,hostfwd=tcp::10022-:22 -device e1000,netdev=n1` | User mode network stack ([NAT Network in VirtualBox][vbox]); forwarding localhost:10022 to guest's port 22                                   |
| 2.3.6  | `-nic user,hostfwd=tcp::10022-:22`                                  | Shorthand for above; [requires QEMU (>= 2.12)][qemu212]                                                                                      |
| 2.3.11 | `-serial telnet::5555,server,nowait`                                | `telnet localhost 5555` to get serial I/O                                                                                                    |
| 2.3.11 | `-monitor telnet::5556,server,nowait`                               | `telnet localhost 5556` to connect QEMU monitor                                                                                              |
| 2.3.11 | `-serial mon:telnet::5555,server,nowait`                            | Serves both serial and monitor via `telnet localhost 5555`; <kbd>Ctrl-a h</kbd> to see help                                                  |
| 2.3.11 | `-serial mon:stdio`                                                 | Serves both serial and monitor on the terminal; <kbd>Ctrl-a h</kbd> to see help                                                              |
| 2.3.11 | `-S`                                                                | Stop running machine until gdbserver accepts a connection                                                                                    |
| 2.3.11 | `-gdb tcp::1234`                                                    | Listen gdb connection on port 1234                                                                                                           |
| 2.3.11 | `-s`                                                                | Shorthand for `-gdb tcp::1234`                                                                                                               |
| 2.3.11 | `-enable-kvm`                                                       | (Linux only) Enable KVM support                                                                                                              |
| 2.3.11 | `-no-reboot`                                                        | `reboot` コマンドで再起動せずにQEMUを終了する                                                                                                |
| 2.3.11 | `-daemonize`                                                        | Daemonize QEMU; Useful when QEMU runs long time since QEMU won't killed (SIGHUP'ed) on the terminal closed                                   |
| 2.3.11 | `-rtc base=utc`                                                     | To correct timezone                                                                                                                          |

[qemu212]: https://wiki.qemu.org/ChangeLog/2.12#Network
[vbox]: https://www.google.co.jp/search?tbm=isch&q=virtualbox+nat+network
[vl.c]: https://github.com/qemu/qemu/blob/f8c3db33a5e863291182f8862ddf81618a7c6194/vl.c#L3081-L3086

I'll add Linux-specific options (such as `-kernel`)