diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2020-10-29 09:55:48 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-10-29 18:02:20 +0100 |
| commit | 475d26a2671e5f5e672bfb8892fea9eb8f48931d (patch) | |
| tree | 848f1111851607ac62dddef479fbfec274b6f4ad | |
| parent | e4e347a24cf3cc90bb4d4a29b092072f828dd274 (diff) | |
vm/qemu: default target dir to /
Everybody except for fuchsia use /.
Does not make sense to repeat for everybody.
| -rw-r--r-- | vm/qemu/qemu.go | 72 |
1 files changed, 32 insertions, 40 deletions
diff --git a/vm/qemu/qemu.go b/vm/qemu/qemu.go index 15b8e0854..d0310219f 100644 --- a/vm/qemu/qemu.go +++ b/vm/qemu/qemu.go @@ -94,7 +94,7 @@ type instance struct { type archConfig struct { Qemu string QemuArgs string - TargetDir string + TargetDir string // "/" by default NetDev string // default network device type (see the full list with qemu-system-x86_64 -device help) // UseNewQemuImageOptions specifies whether the arch uses "new" QEMU image device options. UseNewQemuImageOptions bool @@ -103,9 +103,8 @@ type archConfig struct { var archConfigs = map[string]*archConfig{ "linux/amd64": { - Qemu: "qemu-system-x86_64", - QemuArgs: "-enable-kvm -cpu host,migratable=off", - TargetDir: "/", + Qemu: "qemu-system-x86_64", + QemuArgs: "-enable-kvm -cpu host,migratable=off", // e1000e fails on recent Debian distros with: // Initialization of device e1000e failed: failed to find romfile "efi-e1000e.rom // But other arches don't use e1000e, e.g. arm64 uses virtio by default. @@ -128,53 +127,47 @@ var archConfigs = map[string]*archConfig{ ), }, "linux/386": { - Qemu: "qemu-system-i386", - TargetDir: "/", - NetDev: "e1000", + Qemu: "qemu-system-i386", + NetDev: "e1000", CmdLine: append(linuxCmdline, "root=/dev/sda", "console=ttyS0", ), }, "linux/arm64": { - Qemu: "qemu-system-aarch64", - QemuArgs: "-machine virt,virtualization=on -cpu cortex-a57", - TargetDir: "/", - NetDev: "virtio-net-pci", + Qemu: "qemu-system-aarch64", + QemuArgs: "-machine virt,virtualization=on -cpu cortex-a57", + NetDev: "virtio-net-pci", CmdLine: append(linuxCmdline, "root=/dev/vda", "console=ttyAMA0", ), }, "linux/arm": { - Qemu: "qemu-system-arm", - TargetDir: "/", - NetDev: "virtio-net-pci", + Qemu: "qemu-system-arm", + NetDev: "virtio-net-pci", CmdLine: append(linuxCmdline, "root=/dev/vda", "console=ttyAMA0", ), }, "linux/mips64le": { - Qemu: "qemu-system-mips64el", - TargetDir: "/", - QemuArgs: "-M malta -cpu MIPS64R2-generic -nodefaults", - NetDev: "e1000", + Qemu: "qemu-system-mips64el", + QemuArgs: "-M malta -cpu MIPS64R2-generic -nodefaults", + NetDev: "e1000", CmdLine: append(linuxCmdline, "root=/dev/sda", "console=ttyS0", ), }, "linux/ppc64le": { - Qemu: "qemu-system-ppc64", - TargetDir: "/", - QemuArgs: "-enable-kvm -vga none", - NetDev: "virtio-net-pci", - CmdLine: linuxCmdline, + Qemu: "qemu-system-ppc64", + QemuArgs: "-enable-kvm -vga none", + NetDev: "virtio-net-pci", + CmdLine: linuxCmdline, }, "linux/riscv64": { Qemu: "qemu-system-riscv64", - TargetDir: "/", QemuArgs: "-machine virt", NetDev: "virtio-net-pci", UseNewQemuImageOptions: true, @@ -184,25 +177,22 @@ var archConfigs = map[string]*archConfig{ ), }, "linux/s390x": { - Qemu: "qemu-system-s390x", - TargetDir: "/", - QemuArgs: "-M s390-ccw-virtio -cpu max,zpci=on", - NetDev: "virtio-net-pci", + Qemu: "qemu-system-s390x", + QemuArgs: "-M s390-ccw-virtio -cpu max,zpci=on", + NetDev: "virtio-net-pci", CmdLine: append(linuxCmdline, "root=/dev/vda", ), }, "freebsd/amd64": { - Qemu: "qemu-system-x86_64", - TargetDir: "/", - QemuArgs: "-enable-kvm", - NetDev: "e1000", + Qemu: "qemu-system-x86_64", + QemuArgs: "-enable-kvm", + NetDev: "e1000", }, "netbsd/amd64": { - Qemu: "qemu-system-x86_64", - TargetDir: "/", - QemuArgs: "-enable-kvm", - NetDev: "e1000", + Qemu: "qemu-system-x86_64", + QemuArgs: "-enable-kvm", + NetDev: "e1000", }, "fuchsia/amd64": { Qemu: "qemu-system-x86_64", @@ -215,10 +205,9 @@ var archConfigs = map[string]*archConfig{ }, }, "akaros/amd64": { - Qemu: "qemu-system-x86_64", - QemuArgs: "-enable-kvm -cpu host,migratable=off", - TargetDir: "/", - NetDev: "e1000", + Qemu: "qemu-system-x86_64", + QemuArgs: "-enable-kvm -cpu host,migratable=off", + NetDev: "e1000", }, } @@ -519,6 +508,9 @@ func (inst *instance) targetDir() string { if inst.image == "9p" { return "/tmp" } + if inst.archConfig.TargetDir == "" { + return "/" + } return inst.archConfig.TargetDir } |
