From c790f0fbfef561c473e04e324db9d0439e38795c Mon Sep 17 00:00:00 2001 From: gfdgd_xi <3025613752@qq.com> Date: Sat, 27 Apr 2024 14:40:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9C=A8=E6=96=B0=E7=89=88?= =?UTF-8?q?=E6=9C=ACQemu=E4=B8=8A=E6=8F=90=E7=A4=BA=E6=97=A0--soundhw?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- StartVM.sh | 54 ++++++++++++++++++++++++++++++++++++++++------ VM-source/qemu.cpp | 2 +- 2 files changed, 49 insertions(+), 7 deletions(-) diff --git a/StartVM.sh b/StartVM.sh index 6ff4e60..26590e7 100755 --- a/StartVM.sh +++ b/StartVM.sh @@ -60,11 +60,19 @@ if [[ $? == 0 ]] && [[ -f "$HOME/Qemu/Windows/Windows.qcow2" ]]; then ./VM/kvm-ok if [[ $? == 0 ]] && [[ `arch` == "x86_64" ]]; then echo X86 架构,使用 kvm 加速 - qemu-system-x86_64 --enable-kvm -cpu host --hda "$HOME/Qemu/Windows/Windows.qcow2" -smp $CpuCount,sockets=$CpuSocketNum,cores=$(($CpuCoreNum / $CpuSocketNum)),threads=$(($CpuCount / $CpuCoreNum / $CpuSocketNum)) -m ${use}G -display vnc=:5 -display gtk -usb -nic model=rtl8139 $qemuUEFI > /tmp/windows-virtual-machine-installer-for-wine-runner-run.log 2>&1 # 最新的 qemu 已经移除参数 -soundhw all + qemu-system-x86_64 --enable-kvm -cpu host --hda "$HOME/Qemu/Windows/Windows.qcow2" \ + -smp $CpuCount,sockets=$CpuSocketNum,cores=$(($CpuCoreNum / $CpuSocketNum)),threads=$(($CpuCount / $CpuCoreNum / $CpuSocketNum)) \ + -m ${use}G -display vnc=:5 -display gtk -usb -nic model=rtl8139 $qemuUEFI \ + -device AC97 -device ES1370 -device intel-hda -device hda-duplex \ + > /tmp/windows-virtual-machine-installer-for-wine-runner-run.log 2>&1 # 最新的 qemu 已经移除参数 -soundhw all exit fi echo 不使用 kvm 加速 - qemu-system-x86_64 --hda "$HOME/Qemu/Windows/Windows.qcow2" -smp $CpuCount,sockets=$CpuSocketNum,cores=$(($CpuCoreNum / $CpuSocketNum)),threads=$(($CpuCount / $CpuCoreNum / $CpuSocketNum)) -m ${use}G -display vnc=:5 -display gtk -usb -nic model=rtl8139 $qemuUEFI > /tmp/windows-virtual-machine-installer-for-wine-runner-run.log 2>&1 # 最新的 qemu 已经移除参数 -soundhw all + qemu-system-x86_64 --hda "$HOME/Qemu/Windows/Windows.qcow2" \ + -smp $CpuCount,sockets=$CpuSocketNum,cores=$(($CpuCoreNum / $CpuSocketNum)),threads=$(($CpuCount / $CpuCoreNum / $CpuSocketNum)) \ + -m ${use}G -display vnc=:5 -display gtk -usb -nic model=rtl8139 $qemuUEFI \ + -device AC97 -device ES1370 -device intel-hda -device hda-duplex \ + > /tmp/windows-virtual-machine-installer-for-wine-runner-run.log 2>&1 # 最新的 qemu 已经移除参数 -soundhw all exit fi cat ~/.config/deepin-wine-runner/QEMU-ARCH | grep armhf @@ -81,10 +89,26 @@ if [[ $? == 0 ]] && [[ -f "$HOME/Qemu/Windows/Windows.qcow2" ]]; then echo $qemuUEFI ./VM/kvm-ok if [[ $? == 0 ]] && [[ `arch` == "aarch64" ]]; then - qemu-system-arm --enable-kvm --hda "$HOME/Qemu/Windows/Windows.qcow2" -smp $CpuCount,sockets=$CpuSocketNum,cores=$(($CpuCoreNum / $CpuSocketNum)),threads=$(($CpuCount / $CpuCoreNum / $CpuSocketNum)) -m ${use}G -display vnc=:5 -display gtk -usb -nic model=rtl8139 $qemuUEFI -cpu max -M virt -device virtio-gpu-pci -device nec-usb-xhci,id=xhci,addr=0x1b -device usb-tablet,id=tablet,bus=xhci.0,port=1 -device usb-kbd,id=keyboard,bus=xhci.0,port=2 > /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 # 最新的 qemu 已经移除参数 -soundhw all + qemu-system-arm --enable-kvm --hda "$HOME/Qemu/Windows/Windows.qcow2" \ + -smp $CpuCount,sockets=$CpuSocketNum,cores=$(($CpuCoreNum / $CpuSocketNum)),threads=$(($CpuCount / $CpuCoreNum / $CpuSocketNum)) \ + -m ${use}G -display vnc=:5 -display gtk -usb -nic model=rtl8139 $qemuUEFI \ + -cpu max -M virt -device virtio-gpu-pci \ + -device nec-usb-xhci,id=xhci,addr=0x1b \ + -device usb-tablet,id=tablet,bus=xhci.0,port=1 \ + -device usb-kbd,id=keyboard,bus=xhci.0,port=2 \ + -device AC97 -device ES1370 -device intel-hda -device hda-duplex \ + > /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 # 最新的 qemu 已经移除参数 -soundhw all exit fi - qemu-system-arm --hda "$HOME/Qemu/Windows/Windows.qcow2" -smp $CpuCount,sockets=$CpuSocketNum,cores=$(($CpuCoreNum / $CpuSocketNum)),threads=$(($CpuCount / $CpuCoreNum / $CpuSocketNum)) -m ${use}G -display vnc=:5 -display gtk -usb -nic model=rtl8139 $qemuUEFI -cpu max -M virt -device virtio-gpu-pci -device nec-usb-xhci,id=xhci,addr=0x1b -device usb-tablet,id=tablet,bus=xhci.0,port=1 -device usb-kbd,id=keyboard,bus=xhci.0,port=2 > /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 # 最新的 qemu 已经移除参数 -soundhw all + qemu-system-arm --hda "$HOME/Qemu/Windows/Windows.qcow2" \ + -smp $CpuCount,sockets=$CpuSocketNum,cores=$(($CpuCoreNum / $CpuSocketNum)),threads=$(($CpuCount / $CpuCoreNum / $CpuSocketNum)) \ + -m ${use}G -display vnc=:5 -display gtk -usb -nic model=rtl8139 $qemuUEFI \ + -cpu max -M virt -device virtio-gpu-pci \ + -device nec-usb-xhci,id=xhci,addr=0x1b \ + -device usb-tablet,id=tablet,bus=xhci.0,port=1 \ + -device usb-kbd,id=keyboard,bus=xhci.0,port=2 \ + -device AC97 -device ES1370 -device intel-hda -device hda-duplex \ + > /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 # 最新的 qemu 已经移除参数 -soundhw all exit fi cat ~/.config/deepin-wine-runner/QEMU-ARCH | grep aarch64 @@ -101,10 +125,28 @@ if [[ $? == 0 ]] && [[ -f "$HOME/Qemu/Windows/Windows.qcow2" ]]; then echo $qemuUEFI ./VM/kvm-ok if [[ $? == 0 ]] && [[ `arch` == "aarch64" ]]; then - qemu-system-aarch64 --enable-kvm --hda "$HOME/Qemu/Windows/Windows.qcow2" -smp $CpuCount,sockets=$CpuSocketNum,cores=$(($CpuCoreNum / $CpuSocketNum)),threads=$(($CpuCount / $CpuCoreNum / $CpuSocketNum)) -m ${use}G -display vnc=:5 -display gtk -usb -nic model=rtl8139 $qemuUEFI -cpu max -M virt -device virtio-gpu-pci -device nec-usb-xhci,id=xhci,addr=0x1b -device usb-tablet,id=tablet,bus=xhci.0,port=1 -device usb-kbd,id=keyboard,bus=xhci.0,port=2 > /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 # 最新的 qemu 已经移除参数 -soundhw all + qemu-system-aarch64 --enable-kvm --hda "$HOME/Qemu/Windows/Windows.qcow2" \ + -smp $CpuCount,sockets=$CpuSocketNum,cores=$(($CpuCoreNum / $CpuSocketNum)),threads=$(($CpuCount / $CpuCoreNum / $CpuSocketNum)) \ + -m ${use}G -display vnc=:5 -display gtk -usb -nic model=rtl8139 $qemuUEFI \ + -cpu max -M virt \ + -device virtio-gpu-pci \ + -device nec-usb-xhci,id=xhci,addr=0x1b \ + -device usb-tablet,id=tablet,bus=xhci.0,port=1 \ + -device usb-kbd,id=keyboard,bus=xhci.0,port=2 \ + -device AC97 -device ES1370 -device intel-hda -device hda-duplex \ + > /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 # 最新的 qemu 已经移除参数 -soundhw all exit fi - qemu-system-aarch64 --hda "$HOME/Qemu/Windows/Windows.qcow2" -smp $CpuCount,sockets=$CpuSocketNum,cores=$(($CpuCoreNum / $CpuSocketNum)),threads=$(($CpuCount / $CpuCoreNum / $CpuSocketNum)) -m ${use}G -display vnc=:5 -display gtk -usb -nic model=rtl8139 $qemuUEFI -cpu max -M virt -device virtio-gpu-pci -device nec-usb-xhci,id=xhci,addr=0x1b -device usb-tablet,id=tablet,bus=xhci.0,port=1 -device usb-kbd,id=keyboard,bus=xhci.0,port=2 > /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 # 最新的 qemu 已经移除参数 -soundhw all + qemu-system-aarch64 --hda "$HOME/Qemu/Windows/Windows.qcow2" \ + -smp $CpuCount,sockets=$CpuSocketNum,cores=$(($CpuCoreNum / $CpuSocketNum)),threads=$(($CpuCount / $CpuCoreNum / $CpuSocketNum)) \ + -m ${use}G -display vnc=:5 -display gtk -usb -nic model=rtl8139 $qemuUEFI \ + -cpu max -M virt \ + -device virtio-gpu-pci \ + -device nec-usb-xhci,id=xhci,addr=0x1b \ + -device usb-tablet,id=tablet,bus=xhci.0,port=1 \ + -device usb-kbd,id=keyboard,bus=xhci.0,port=2 \ + -device AC97 -device ES1370 -device intel-hda -device hda-duplex \ + > /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 # 最新的 qemu 已经移除参数 -soundhw all exit fi diff --git a/VM-source/qemu.cpp b/VM-source/qemu.cpp index 27455a6..5d05757 100644 --- a/VM-source/qemu.cpp +++ b/VM-source/qemu.cpp @@ -120,7 +120,7 @@ int qemu::InstallGuessAdditions(QString controlName, int port, int device){ return 0; } int qemu::EnabledAudio(){ - commandOption += "-soundhw all "; + commandOption += "-device AC97 -device ES1370 -device intel-hda -device hda-duplex "; return 0; } int qemu::EnabledClipboardMode(){