mirror of
https://gitee.com/gfdgd-xi/deep-wine-runner
synced 2025-01-12 17:48:27 +08:00
启动器虚拟机快捷方式支持启动arm32、arm64架构系统
This commit is contained in:
parent
47bdde1eb3
commit
7571a6aafc
1
Makefile
1
Makefile
@ -20,6 +20,7 @@ package:
|
|||||||
cp -rv VM-source/Windows7X64Auto.iso VM
|
cp -rv VM-source/Windows7X64Auto.iso VM
|
||||||
cp -rv VM-source/Windows7X86Auto.iso VM
|
cp -rv VM-source/Windows7X86Auto.iso VM
|
||||||
cp -rv VM-source/test.qcow2 VM
|
cp -rv VM-source/test.qcow2 VM
|
||||||
|
cp -rv VM-source/*.fd VM
|
||||||
cp -rv wine/ deb/opt/apps/deepin-wine-runner/
|
cp -rv wine/ deb/opt/apps/deepin-wine-runner/
|
||||||
cp -rv Test/ deb/opt/apps/deepin-wine-runner/
|
cp -rv Test/ deb/opt/apps/deepin-wine-runner/
|
||||||
cp -rv information.json package-script
|
cp -rv information.json package-script
|
||||||
|
84
StartVM.sh
84
StartVM.sh
@ -7,6 +7,7 @@
|
|||||||
# 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序
|
# 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序
|
||||||
# 基于 Python3 的 tkinter 构建
|
# 基于 Python3 的 tkinter 构建
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
|
cd `dirname $0`
|
||||||
VBoxManage showvminfo Windows
|
VBoxManage showvminfo Windows
|
||||||
if [[ 0 == $? ]]; then
|
if [[ 0 == $? ]]; then
|
||||||
# 检测到虚拟机存在,启动虚拟机
|
# 检测到虚拟机存在,启动虚拟机
|
||||||
@ -22,17 +23,6 @@ if [[ $? == 0 ]] && [[ -f "$HOME/Qemu/Windows/Windows.qcow2" ]]; then
|
|||||||
python3 ./VM/StartQemu.py
|
python3 ./VM/StartQemu.py
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
if [[ -f $HOME/.config/deepin-wine-runner/QEMU-EFI ]]; then
|
|
||||||
echo 使用 UEFI 启动
|
|
||||||
if [[ -f /usr/share/qemu/OVMF.fd ]]; then
|
|
||||||
qemuUEFI="--bios /usr/share/qemu/OVMF.fd"
|
|
||||||
else
|
|
||||||
if [[ -f `dirname $0`/VM/OVMF.fd ]]; then
|
|
||||||
qemuUEFI="--bios `dirname $0`/VM/OVMF.fd"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
echo $qemuUEFI
|
|
||||||
fi
|
|
||||||
# 查看CPU个数
|
# 查看CPU个数
|
||||||
CpuSocketNum=`cat /proc/cpuinfo | grep "cpu cores" | uniq | wc -l`
|
CpuSocketNum=`cat /proc/cpuinfo | grep "cpu cores" | uniq | wc -l`
|
||||||
# 查看CPU核心数
|
# 查看CPU核心数
|
||||||
@ -43,19 +33,77 @@ if [[ $? == 0 ]] && [[ -f "$HOME/Qemu/Windows/Windows.qcow2" ]]; then
|
|||||||
# 总内存大小GB
|
# 总内存大小GB
|
||||||
MemTotal=`awk '($1 == "MemTotal:"){printf "%.2f\n",$2/1024/1024}' /proc/meminfo`
|
MemTotal=`awk '($1 == "MemTotal:"){printf "%.2f\n",$2/1024/1024}' /proc/meminfo`
|
||||||
use=$(echo "scale=4; $MemTotal / 3" | bc)
|
use=$(echo "scale=4; $MemTotal / 3" | bc)
|
||||||
if [[ `arch` == "x86_64" ]]; then
|
|
||||||
echo X86 架构,使用 kvm 加速
|
cat ~/.config/deepin-wine-runner/QEMU-ARCH | grep amd64
|
||||||
kvm -cpu host --hda "$HOME/Qemu/Windows/Windows.qcow2" -soundhw all -smp $CpuCount,sockets=$CpuSocketNum,cores=$(($CpuCoreNum / $CpuSocketNum)),threads=$(($CpuCount / $CpuCoreNum / $CpuSocketNum)) -m ${use}G -net user,hostfwd=tcp::3389-:3389 -display vnc=:5 -display gtk -usb -nic model=rtl8139 $qemuUEFI > /tmp/windows-virtual-machine-installer-for-wine-runner-run.log 2>&1
|
if [[ $? == 0 ]] || [[ ! -e ~/.config/deepin-wine-runner/QEMU-ARCH ]]; then
|
||||||
|
# amd64 架构
|
||||||
|
if [[ -f $HOME/.config/deepin-wine-runner/QEMU-EFI ]]; then
|
||||||
|
echo 使用 UEFI 启动
|
||||||
|
if [[ -f /usr/share/qemu/OVMF.fd ]]; then
|
||||||
|
qemuUEFI="--bios /usr/share/qemu/OVMF.fd"
|
||||||
|
else
|
||||||
|
if [[ -f `dirname $0`/VM/OVMF.fd ]]; then
|
||||||
|
qemuUEFI="--bios `dirname $0`/VM/OVMF.fd"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo $qemuUEFI
|
||||||
|
fi
|
||||||
|
./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" -soundhw all -smp $CpuCount,sockets=$CpuSocketNum,cores=$(($CpuCoreNum / $CpuSocketNum)),threads=$(($CpuCount / $CpuCoreNum / $CpuSocketNum)) -m ${use}G -net user,hostfwd=tcp::3389-:3389 -display vnc=:5 -display gtk -usb -nic model=rtl8139 $qemuUEFI > /tmp/windows-virtual-machine-installer-for-wine-runner-run.log 2>&1
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
echo 不使用 kvm 加速
|
||||||
|
qemu-system-x86_64 --hda "$HOME/Qemu/Windows/Windows.qcow2" -soundhw all -smp $CpuCount,sockets=$CpuSocketNum,cores=$(($CpuCoreNum / $CpuSocketNum)),threads=$(($CpuCount / $CpuCoreNum / $CpuSocketNum)) -m ${use}G -net user,hostfwd=tcp::3389-:3389 -display vnc=:5 -display gtk -usb -nic model=rtl8139 $qemuUEFI > /tmp/windows-virtual-machine-installer-for-wine-runner-run.log 2>&1
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
echo 非 X86 架构,不使用 kvm 加速
|
cat ~/.config/deepin-wine-runner/QEMU-ARCH | grep armhf
|
||||||
qemu-system-x86_64 --hda "$HOME/Qemu/Windows/Windows.qcow2" -soundhw all -smp $CpuCount,sockets=$CpuSocketNum,cores=$(($CpuCoreNum / $CpuSocketNum)),threads=$(($CpuCount / $CpuCoreNum / $CpuSocketNum)) -m ${use}G -net user,hostfwd=tcp::3389-:3389 -display vnc=:5 -display gtk -usb -nic model=rtl8139 $qemuUEFI > /tmp/windows-virtual-machine-installer-for-wine-runner-run.log 2>&1
|
if [[ $? == 0 ]]; then
|
||||||
exit
|
# armhf 架构
|
||||||
|
# 寻找 UEFI 固件
|
||||||
|
if [[ -f /usr/share/AAVMF/AAVMF32_CODE.fd ]]; then
|
||||||
|
qemuUEFI="--bios /usr/share/AAVMF/AAVMF32_CODE.fd"
|
||||||
|
else
|
||||||
|
if [[ -f ./VM/AAVMF32_CODE.fd ]]; then
|
||||||
|
qemuUEFI="--bios ./VM/AAVMF32_CODE.fd"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo $qemuUEFI
|
||||||
|
./VM/kvm-ok
|
||||||
|
if [[ $? == 0 ]] && [[ `arch` == "aarch64" ]]; then
|
||||||
|
qemu-system-arm --enable-kvm --hda "$HOME/Qemu/Windows/Windows.qcow2" -soundhw all -smp $CpuCount,sockets=$CpuSocketNum,cores=$(($CpuCoreNum / $CpuSocketNum)),threads=$(($CpuCount / $CpuCoreNum / $CpuSocketNum)) -m ${use}G -net user,hostfwd=tcp::3389-:3389 -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
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
qemu-system-arm --hda "$HOME/Qemu/Windows/Windows.qcow2" -soundhw all -smp $CpuCount,sockets=$CpuSocketNum,cores=$(($CpuCoreNum / $CpuSocketNum)),threads=$(($CpuCount / $CpuCoreNum / $CpuSocketNum)) -m ${use}G -net user,hostfwd=tcp::3389-:3389 -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
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
cat ~/.config/deepin-wine-runner/QEMU-ARCH | grep aarch64
|
||||||
|
if [[ $? == 0 ]]; then
|
||||||
|
# aarch64 架构
|
||||||
|
# 寻找 UEFI 固件
|
||||||
|
if [[ -f /usr/share/qemu-efi-aarch64/QEMU_EFI.fd ]]; then
|
||||||
|
qemuUEFI="--bios /usr/share/qemu-efi-aarch64/QEMU_EFI.fd"
|
||||||
|
else
|
||||||
|
if [[ -f ./VM/QEMU_AARCH64_EFI.fd ]]; then
|
||||||
|
qemuUEFI="--bios ./VM/QEMU_AARCH64_EFI.fd"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo $qemuUEFI
|
||||||
|
./VM/kvm-ok
|
||||||
|
if [[ $? == 0 ]] && [[ `arch` == "aarch64" ]]; then
|
||||||
|
qemu-system-aarch64 --enable-kvm --hda "$HOME/Qemu/Windows/Windows.qcow2" -soundhw all -smp $CpuCount,sockets=$CpuSocketNum,cores=$(($CpuCoreNum / $CpuSocketNum)),threads=$(($CpuCount / $CpuCoreNum / $CpuSocketNum)) -m ${use}G -net user,hostfwd=tcp::3389-:3389 -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
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
qemu-system-aarch64 --hda "$HOME/Qemu/Windows/Windows.qcow2" -soundhw all -smp $CpuCount,sockets=$CpuSocketNum,cores=$(($CpuCoreNum / $CpuSocketNum)),threads=$(($CpuCount / $CpuCoreNum / $CpuSocketNum)) -m ${use}G -net user,hostfwd=tcp::3389-:3389 -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
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
zenity --question --no-wrap --text="检查到您未创建所指定的虚拟机,是否创建虚拟机并继续?\n如果不创建将无法使用"
|
zenity --question --no-wrap --text="检查到您未创建所指定的虚拟机,是否创建虚拟机并继续?\n如果不创建将无法使用"
|
||||||
if [[ 1 == $? ]]; then
|
if [[ 1 == $? ]]; then
|
||||||
# 用户不想创建虚拟机,结束
|
# 用户不想创建虚拟机,结束
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
cd `dirname $0`
|
|
||||||
./VM/VirtualMachine
|
./VM/VirtualMachine
|
||||||
|
@ -185,7 +185,11 @@ void MainWindow::on_install_clicked()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
QFile file(QDir::homePath() + "/.config/deepin-wine-runner/QEMU-EFI");
|
QFile file(QDir::homePath() + "/.config/deepin-wine-runner/QEMU-EFI");
|
||||||
|
QFile archFile(QDir::homePath() + "/.config/deepin-wine-runner/QEMU-ARCH");
|
||||||
QDir dir(QDir::homePath() + "/.config/deepin-wine-runner");
|
QDir dir(QDir::homePath() + "/.config/deepin-wine-runner");
|
||||||
|
archFile.open(QIODevice::WriteOnly);
|
||||||
|
archFile.write("amd64");
|
||||||
|
archFile.close();
|
||||||
switch (ui->systemVersion->currentIndex()) {
|
switch (ui->systemVersion->currentIndex()) {
|
||||||
case 3:
|
case 3:
|
||||||
if(!QFile::exists("/usr/share/qemu/OVMF.fd") && !QFile::exists(QCoreApplication::applicationDirPath() + "/OVMF.fd") && ui->vmChooser->currentIndex() == 0){
|
if(!QFile::exists("/usr/share/qemu/OVMF.fd") && !QFile::exists(QCoreApplication::applicationDirPath() + "/OVMF.fd") && ui->vmChooser->currentIndex() == 0){
|
||||||
@ -217,12 +221,18 @@ void MainWindow::on_install_clicked()
|
|||||||
QMessageBox::warning(this, "提示", "VirtualBox 不支持该选项!");
|
QMessageBox::warning(this, "提示", "VirtualBox 不支持该选项!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
archFile.open(QIODevice::WriteOnly);
|
||||||
|
archFile.write("armhf");
|
||||||
|
archFile.close();
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
if(ui->vmChooser->currentIndex() == 1){
|
if(ui->vmChooser->currentIndex() == 1){
|
||||||
QMessageBox::warning(this, "提示", "VirtualBox 不支持该选项!");
|
QMessageBox::warning(this, "提示", "VirtualBox 不支持该选项!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
archFile.open(QIODevice::WriteOnly);
|
||||||
|
archFile.write("aarch64");
|
||||||
|
archFile.close();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if(ui->vmChooser->currentIndex() == 0 && QFile::exists(QDir::homePath() + "/.config/deepin-wine-runner/QEMU-EFI")){
|
if(ui->vmChooser->currentIndex() == 0 && QFile::exists(QDir::homePath() + "/.config/deepin-wine-runner/QEMU-EFI")){
|
||||||
|
@ -82,16 +82,16 @@ int qemu::MountMainDisk(QString diskPath){
|
|||||||
int qemu::StartArmhf(){
|
int qemu::StartArmhf(){
|
||||||
qDebug() << commandOption;
|
qDebug() << commandOption;
|
||||||
if(Command().GetCommand("arch").replace("\n", "").replace(" ", "") == "aarch64" && !system((QCoreApplication::applicationDirPath() + "/kvm-ok").toUtf8())){
|
if(Command().GetCommand("arch").replace("\n", "").replace(" ", "") == "aarch64" && !system((QCoreApplication::applicationDirPath() + "/kvm-ok").toUtf8())){
|
||||||
return system(("qemu-system-arm --enable-kvm -cpu host -M virt " + commandOption + " -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 &").toLatin1());
|
return system(("qemu-system-arm -net user,hostfwd=tcp::3389-:3389 -display vnc=:5 -display gtk --enable-kvm -cpu host -M virt " + commandOption + " -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 &").toLatin1());
|
||||||
}
|
}
|
||||||
return system(("qemu-system-arm -cpu max -M virt " + commandOption + " -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 &").toLatin1());
|
return system(("qemu-system-arm -net user,hostfwd=tcp::3389-:3389 -display vnc=:5 -display gtk -cpu max -M virt " + commandOption + " -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 &").toLatin1());
|
||||||
}
|
}
|
||||||
int qemu::StartAarch64(){
|
int qemu::StartAarch64(){
|
||||||
qDebug() << commandOption;
|
qDebug() << commandOption;
|
||||||
if(Command().GetCommand("arch").replace("\n", "").replace(" ", "") == "aarch64" && !system((QCoreApplication::applicationDirPath() + "/kvm-ok").toUtf8())){
|
if(Command().GetCommand("arch").replace("\n", "").replace(" ", "") == "aarch64" && !system((QCoreApplication::applicationDirPath() + "/kvm-ok").toUtf8())){
|
||||||
return system(("qemu-system-aarch64 --enable-kvm -cpu host -M virt " + commandOption + " -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 &").toLatin1());
|
return system(("qemu-system-aarch64 -net user,hostfwd=tcp::3389-:3389 -display vnc=:5 -display gtk --enable-kvm -cpu host -M virt " + commandOption + " -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 &").toLatin1());
|
||||||
}
|
}
|
||||||
return system(("qemu-system-aarch64 -cpu max -M virt " + commandOption + " -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 &").toLatin1());
|
return system(("qemu-system-aarch64 -net user,hostfwd=tcp::3389-:3389 -display vnc=:5 -display gtk -cpu max -M virt " + commandOption + " -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 &").toLatin1());
|
||||||
}
|
}
|
||||||
int qemu::StartLoong64(){
|
int qemu::StartLoong64(){
|
||||||
|
|
||||||
@ -99,9 +99,9 @@ int qemu::StartLoong64(){
|
|||||||
int qemu::Start(bool unShown){
|
int qemu::Start(bool unShown){
|
||||||
qDebug() << commandOption;
|
qDebug() << commandOption;
|
||||||
if(Command().GetCommand("arch").replace("\n", "").replace(" ", "") == "x86_64" && !system((QCoreApplication::applicationDirPath() + "/kvm-ok").toUtf8())){
|
if(Command().GetCommand("arch").replace("\n", "").replace(" ", "") == "x86_64" && !system((QCoreApplication::applicationDirPath() + "/kvm-ok").toUtf8())){
|
||||||
return system(("qemu-system-x86_64 --enable-kvm -cpu host " + commandOption + " > /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 &").toLatin1());
|
return system(("qemu-system-x86_64 -net user,hostfwd=tcp::3389-:3389 -display vnc=:5 -display gtk --enable-kvm -cpu host " + commandOption + " > /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 &").toLatin1());
|
||||||
}
|
}
|
||||||
return system(("qemu-system-x86_64 -nic model=rtl8139 " + commandOption + " > /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 &").toLatin1());
|
return system(("qemu-system-x86_64 -net user,hostfwd=tcp::3389-:3389 -display vnc=:5 -display gtk -nic model=rtl8139 " + commandOption + " > /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 &").toLatin1());
|
||||||
}
|
}
|
||||||
int qemu::Stop(){
|
int qemu::Stop(){
|
||||||
system("killall qemu-system-x86_64 -9");
|
system("killall qemu-system-x86_64 -9");
|
||||||
|
Loading…
Reference in New Issue
Block a user