修复QEMU安装XP无网络的问题

This commit is contained in:
gfdgd xi 2023-04-29 08:57:35 +08:00
parent 0d3e798644
commit 5443654791
4 changed files with 7 additions and 7 deletions

View File

@ -29,11 +29,11 @@ if [[ -f "$HOME/Qemu/Windows/Windows.qcow2" ]]; then
use=$(echo "scale=4; $MemTotal / 3" | bc)
if [[ `arch` == "x86_64" ]]; then
echo X86 架构,使用 kvm 加速
kvm --hda "$HOME/Qemu/Windows/Windows.qcow2" -soundhw all -smp $CpuCount -m ${use}G -net user,hostfwd=tcp::3389-:3389 -display vnc=:5 -display gtk -usb
kvm --hda "$HOME/Qemu/Windows/Windows.qcow2" -soundhw all -smp $CpuCount -m ${use}G -net user,hostfwd=tcp::3389-:3389 -display vnc=:5 -display gtk -usb -nic model=rtl8139
exit
fi
echo 非 X86 架构,不使用 kvm 加速
qemu-system-x86_64 --hda "$HOME/Qemu/Windows/Windows.qcow2" -soundhw all -smp $CpuCount -m ${use}G -net user,hostfwd=tcp::3389-:3389 -display vnc=:5 -display gtk -usb
qemu-system-x86_64 --hda "$HOME/Qemu/Windows/Windows.qcow2" -soundhw all -smp $CpuCount -m ${use}G -net user,hostfwd=tcp::3389-:3389 -display vnc=:5 -display gtk -usb -nic model=rtl8139
exit
fi
zenity --question --no-wrap --text="检查到您未创建所指定的虚拟机,是否创建虚拟机并继续?\n如果不创建将无法使用"

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.8.2, 2023-04-22T21:23:25. -->
<!-- Written by QtCreator 4.8.2, 2023-04-28T23:27:18. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>

View File

@ -72,7 +72,7 @@ int qemu::Start(bool unShown){
if(Command().GetCommand("arch").replace("\n", "").replace(" ", "") == "x86_64"){
return system(("kvm " + commandOption + " &").toLatin1());
}
return system(("qemu-system-x86_64 " + commandOption + " &").toLatin1());
return system(("qemu-system-x86_64 -nic model=rtl8139 " + commandOption + " &").toLatin1());
}
int qemu::Stop(){
system("killall qemu-system-x86_64 -9");

View File

@ -21,7 +21,7 @@ except:
print("无法读取配置")
traceback.print_exc()
sys.exit(1)
option = f"--hda \"$HOME/Qemu/Windows/Windows.qcow2\" -usb -m {setting['Memory']}M -smp {setting['CPU']} "
option = f"-nic model=rtl8139 --hda \"$HOME/Qemu/Windows/Windows.qcow2\" -usb -m {setting['Memory']}M -smp {setting['CPU']} "
if setting["EnableKVM"]:
command = "kvm"
if setting["EnableRDP"]: