diff --git a/VM-source/mainwindow.ui b/VM-source/mainwindow.ui index 3d3277e..3b22fb0 100755 --- a/VM-source/mainwindow.ui +++ b/VM-source/mainwindow.ui @@ -245,7 +245,7 @@ hr { height: 1px; border-width: 0; } li.unchecked::marker { content: "\2610"; } li.checked::marker { content: "\2612"; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Noto Sans CJK SC'; font-size:11pt;">UOS 3a4000 用户在使用 Qemu 时可能会出现虚拟机无法正常开机的问题,需要安装/降级到以下链接的版本:</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Noto Sans CJK SC'; font-size:11pt;">UOS 3a4000 用户在使用 Qemu 时可能会出现虚拟机无法正常开机的问题,如果出现上述问题需要安装/降级到以下链接的版本:</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Noto Sans CJK SC'; font-size:11pt;">蓝奏云:</span><a href="https://gfdgdxi.lanzoue.com/b01rk9wza"><span style=" font-family:'Noto Sans CJK SC'; font-size:11pt; text-decoration: underline; color:#0082fa;">https://gfdgdxi.lanzoue.com/b01rk9wza</span></a><span style=" font-family:'Noto Sans CJK SC'; font-size:11pt;"> 密码:6wvf</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Noto Sans CJK SC'; font-size:11pt;">诚通网盘:</span><a href="http://ctfile.gfdgdxi.top/d/31540479-58662214-c46520?p=2061"><span style=" font-family:'Noto Sans CJK SC'; font-size:11pt; text-decoration: underline; color:#0082fa;">http://ctfile.gfdgdxi.top/d/31540479-58662214-c46520?p=2061</span></a><span style=" font-family:'Noto Sans CJK SC'; font-size:11pt;"> (访问密码: 2061)</span></p> <hr /> diff --git a/VM-source/qemu.cpp b/VM-source/qemu.cpp index 9b2f559..bd93310 100644 --- a/VM-source/qemu.cpp +++ b/VM-source/qemu.cpp @@ -141,6 +141,7 @@ int qemu::StartLoong64() int qemu::Start(bool unShown) { QString newCommandOption = commandOption; + QString qemuPath = "qemu-system-x86_64"; qDebug() << GetBootLogoPath(); if(isUEFI) { newCommandOption += " -vga none -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 "; @@ -148,11 +149,20 @@ int qemu::Start(bool unShown) else { newCommandOption += " -vga virtio -device nec-usb-xhci,id=xhci,addr=0x1b -device usb-tablet,id=tablet,bus=xhci.0,port=1 "; } + // UOS 3a4000 使用程序自带的 qemu + QString info = SystemInfo().toLower(); + if(!info.contains("uos") || info.contains("unio")) { + // 判断架构 + QString arch = GetArch(); + if(arch != "mips64" || arch == "mipsel64") { + qemuPath = "bwrap --dev-bind / / --bind '" + QCoreApplication::applicationDirPath() + "/MipsQemu/usr/lib/mips64el-linux-gnuabi64/qemu/ui-gtk.so' /usr/lib/mips64el-linux-gnuabi64/qemu/ui-gtk.so qemu-system-x86_64"; + } + } qDebug() << commandOption; if(Command().GetCommand("arch").replace("\n", "").replace(" ", "") == "x86_64" && !system((QCoreApplication::applicationDirPath() + "/kvm-ok").toUtf8())){ - return system(("qemu-system-x86_64 --boot 'splash=" + GetBootLogoPath() + ",order=d,menu=on,splash-time=2000' -display vnc=:5 -display gtk --enable-kvm -cpu host " + newCommandOption + " > /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 &").toLatin1()); + return system((qemuPath + " --boot 'splash=" + GetBootLogoPath() + ",order=d,menu=on,splash-time=2000' -display vnc=:5 -display gtk --enable-kvm -cpu host " + newCommandOption + " > /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 &").toLatin1()); } - return system(("qemu-system-x86_64 --boot 'splash=" + GetBootLogoPath() + ",order=d,menu=on,splash-time=2000' -display vnc=:5 -display gtk -nic model=rtl8139 " + newCommandOption + " > /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 &").toLatin1()); + return system((qemuPath + " --boot 'splash=" + GetBootLogoPath() + ",order=d,menu=on,splash-time=2000' -display vnc=:5 -display gtk -nic model=rtl8139 " + newCommandOption + " > /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 &").toLatin1()); } int qemu::Stop() { @@ -305,3 +315,23 @@ QString qemu::GetBootLogoPath() } return bootScreenLogo; } + +QString qemu::SystemInfo() +{ + QFile file("/etc/os-version"); + file.open(QFile::ReadOnly); + QString data = file.readAll(); + file.close(); + return data; +} + +QString qemu::GetArch() +{ + QProcess process; + process.start("uname", QStringList() << "-m"); + process.waitForStarted(); + process.waitForFinished(); + QString data = process.readAllStandardError(); + process.close(); + return data.replace("\n", "").replace(" ", ""); +} diff --git a/VM-source/qemu.h b/VM-source/qemu.h index 9f00003..968b6ad 100644 --- a/VM-source/qemu.h +++ b/VM-source/qemu.h @@ -54,6 +54,8 @@ private: QString commandOption = ""; bool isUEFI = false; QString GetBootLogoPath(); + QString SystemInfo(); + QString GetArch(); };