@@ -35,13 +35,16 @@ func main() {
35
35
for ctx .Err () == nil {
36
36
cmd := windows10Cmd (* windows10Path )
37
37
log .Printf ("Starting VM: %s" , cmd .String ())
38
+ cmd .Stdout = os .Stdout
39
+ cmd .Stderr = os .Stderr
38
40
if err := cmd .Start (); err != nil {
39
41
log .Printf ("cmd.Start() = %v. Retrying in 10 seconds." , err )
40
42
time .Sleep (10 * time .Second )
41
43
continue
42
44
}
43
45
if err := internal .WaitOrStop (ctx , cmd , os .Interrupt , time .Minute ); err != nil {
44
- log .Printf ("waitOrStop(_, %v, %v, %v) = %v" , cmd , os .Interrupt , time .Minute , err )
46
+ log .Printf ("waitOrStop(_, %v, %v, %v) = %v. Retrying in 10 seconds." , cmd , os .Interrupt , time .Minute , err )
47
+ time .Sleep (10 * time .Second )
45
48
}
46
49
}
47
50
}
@@ -63,29 +66,29 @@ func defaultWindowsDir() string {
63
66
// to be started.
64
67
func windows10Cmd (base string ) * exec.Cmd {
65
68
c := exec .Command (filepath .Join (base , "sysroot-macos-arm64/bin/qemu-system-aarch64" ),
66
- fmt . Sprintf ( "-L %s " , filepath .Join (base , "UTM.app/Contents/Resources/qemu" ) ),
67
- "-device ramfb " ,
68
- "-cpu max" ,
69
- "-smp cpus=8,sockets=1,cores=8,threads=1" , // This works well with M1 Mac Minis.
70
- "-machine virt,highmem=off " ,
71
- "-accel hvf " ,
72
- "-accel tcg,tb-size=1536 " ,
73
- "-boot menu=on " ,
74
- "-m 12288 " ,
75
- `-name "Virtual Machine"` ,
76
- "-device qemu-xhci,id=usb-bus " ,
77
- "-device usb-tablet,bus=usb-bus.0" ,
78
- "-device usb-mouse,bus=usb-bus.0" ,
79
- "-device usb-kbd,bus=usb-bus.0" ,
80
- fmt . Sprintf ( "-bios %s " , filepath . Join ( base , "Images/QEMU_EFI.fd" )) ,
81
- "-device nvme,drive=drive0,serial=drive0,bootindex=0 " ,
82
- fmt . Sprintf ( `-drive "if=none,media=disk,id=drive0,file=%s,cache=writethrough"` , filepath .Join (base , "Images/win10.qcow2" ) ),
83
- "-device usb-storage ,drive=drive2,removable=true ,bootindex=1 " ,
84
- fmt .Sprintf (`-drive "if=none,media=cdrom ,id=drive2 ,file=%s,cache=writethrough"` , filepath .Join (base , "Images/virtio.iso " )),
85
- "-device virtio-net-pci,netdev=net0 " ,
86
- "-netdev user, id=net0" ,
69
+ "-L" , filepath .Join (base , "UTM.app/Contents/Resources/qemu" ),
70
+ "-cpu" , "max " ,
71
+ "-smp" , "cpus=8,sockets=1,cores=8,threads=1" , // This works well with M1 Mac Minis.
72
+ "-machine" , "virt,highmem=off" ,
73
+ "-accel" , "hvf " ,
74
+ "-accel" , "tcg,tb-size=1536 " ,
75
+ "-boot" , "menu=on " ,
76
+ "-m" , "12288 " ,
77
+ "-name" , "Virtual Machine " ,
78
+ "-device" , "qemu-xhci,id=usb-bus" ,
79
+ "-device" , "ramfb " ,
80
+ "-device" , " usb-tablet,bus=usb-bus.0" ,
81
+ "-device" , " usb-mouse,bus=usb-bus.0" ,
82
+ "-device" , " usb-kbd,bus=usb-bus.0" ,
83
+ "-device " , "virtio-net-pci,netdev=net0" ,
84
+ "-netdev" , "user,id=net0 " ,
85
+ "-bios" , filepath .Join (base , "Images/QEMU_EFI.fd" ),
86
+ "-device" , "nvme ,drive=drive0,serial=drive0 ,bootindex=0 " ,
87
+ "-drive" , fmt .Sprintf ("if=none,media=disk ,id=drive0 ,file=%s,cache=writethrough" , filepath .Join (base , "Images/win10.qcow2 " )),
88
+ "-device" , "usb-storage,drive=drive2,removable=true,bootindex=1 " ,
89
+ "-drive" , fmt . Sprintf ( "if=none,media=cdrom, id=drive2,file=%s,cache=writethrough" , filepath . Join ( base , "Images/virtio.iso" )) ,
87
90
"-snapshot" , // critical to avoid saving state between runs.
88
- "-vnc :3" ,
91
+ "-vnc" , " :3" ,
89
92
)
90
93
c .Env = append (os .Environ (),
91
94
fmt .Sprintf ("DYLD_LIBRARY_PATH=%s" , filepath .Join (base , "sysroot-macos-arm64/lib" )),
0 commit comments