![如何更改 qemu 默认机器?](https://linux22.com/image/866475/%E5%A6%82%E4%BD%95%E6%9B%B4%E6%94%B9%20qemu%20%E9%BB%98%E8%AE%A4%E6%9C%BA%E5%99%A8%EF%BC%9F.png)
我使用带有 qemu-kvm 的 Kubuntu 14.04 (x86_64 3.13.0-43-generic #72-Ubuntu)。
$ kvm --version
QEMU emulator version 2.0.0 (Debian 2.0.0+dfsg-2ubuntu1.9)
我怎样才能更改“默认”机器(现在它是下面显示的开箱即用值pc-i440fx-trusty
)?
$ qemu-system-x86_64 -machine help
Supported machines are:
pc-0.13 Standard PC (i440FX + PIIX, 1996)
pc-i440fx-2.0 Standard PC (i440FX + PIIX, 1996)
pc-1.0-qemu-kvm Standard PC (i440FX + PIIX, 1996) (alias of pc-1.0)
pc-1.0 Standard PC (i440FX + PIIX, 1996)
pc-q35-1.7 Standard PC (Q35 + ICH9, 2009)
pc-1.1 Standard PC (i440FX + PIIX, 1996)
q35 Standard PC (Q35 + ICH9, 2009) (alias of pc-q35-2.0)
pc-q35-2.0 Standard PC (Q35 + ICH9, 2009)
pc-i440fx-1.4 Standard PC (i440FX + PIIX, 1996)
pc-i440fx-1.5 Standard PC (i440FX + PIIX, 1996)
pc-0.14 Standard PC (i440FX + PIIX, 1996)
pc-0.15 Standard PC (i440FX + PIIX, 1996)
xenfv Xen Fully-virtualized PC
pc-q35-1.4 Standard PC (Q35 + ICH9, 2009)
isapc ISA-only PC
pc-0.10 Standard PC (i440FX + PIIX, 1996)
pc Ubuntu 14.04 PC (i440FX + PIIX, 1996) (alias of pc-i440fx-trusty)
pc-i440fx-trusty Ubuntu 14.04 PC (i440FX + PIIX, 1996) (default)
pc-1.2 Standard PC (i440FX + PIIX, 1996)
pc-0.11 Standard PC (i440FX + PIIX, 1996)
pc-i440fx-1.7 Standard PC (i440FX + PIIX, 1996)
pc-i440fx-1.6 Standard PC (i440FX + PIIX, 1996)
none empty machine
xenpv Xen Para-virtualized PC
pc-q35-1.5 Standard PC (Q35 + ICH9, 2009)
pc-1.0-precise Standard PC (i440FX + PIIX, 1996) (alias of pc-1.0-qemu-kvm)
pc-1.0-qemu-kvm Standard PC (i440FX + PIIX, 1996)
pc-q35-1.6 Standard PC (Q35 + ICH9, 2009)
pc-0.12 Standard PC (i440FX + PIIX, 1996)
pc-1.3 Standard PC (i440FX + PIIX, 1996)
我在 qemu_2.0.0~rc1 diff 中发现了这一点:
++/* Ubuntu machine types */
++
++static QEMUMachine pc_machine_trusty = {
++ PC_DEFAULT_MACHINE_OPTIONS,
++ .default_machine_opts = "firmware=bios-256k.bin",
++ .hot_add_cpu = pc_hot_add_cpu,
++ .name = "pc-i440fx-trusty",
++ .alias = "pc",
++ .desc = "Ubuntu 14.04 PC (i440FX + PIIX, 1996)",
++ .init = pc_init_pci,
++ .is_default = 1,
++};
——所以我是否应该假设这个值是硬编码的,并且不能通过处理源和重新编译 qemu 来改变?
答案1
可以使用以下选项覆盖默认机器-machine
:
qemu-system-x86_64 -machine pc ...
进行相应更换pc
。