Skip to content

Commit

Permalink
v0.9.6 - Patch rollup, Ventura support + PT fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Coopydood committed Aug 17, 2023
1 parent 46526d6 commit 6c5987a
Show file tree
Hide file tree
Showing 15 changed files with 137 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.9.5
0.9.6
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# ultimate-macOS-KVM

### v0.9.5
### v0.9.6

Helping you build the ultimate macOS virtual machine, powered by KVM.

*[What's new?](https://github.com/Coopydood/ultimate-macOS-KVM/blob/main/docs/changelogs/v0-9-5.md)*
*[What's new?](https://github.com/Coopydood/ultimate-macOS-KVM/blob/main/docs/changelogs/v0-9-6.md)*

[![GitHub](https://img.shields.io/github/license/Coopydood/ultimate-macOS-KVM?label=Licence&logo=unlicense&logoColor=white&style=for-the-badge)](https://github.com/Coopydood/ultimate-macOS-KVM/blob/main/LICENSE) [![GitHub repo size](https://img.shields.io/github/repo-size/Coopydood/ultimate-macOS-KVM?label=Size&logo=envoy-proxy&logoColor=white&style=for-the-badge)](https://github.com/Coopydood/ultimate-macOS-KVM) [![Discord](https://img.shields.io/discord/574943603466436628?color=7d86ff&label=Discord&logo=discord&logoColor=white&style=for-the-badge)](https://sl.coopydood.com/discord)

Expand Down
18 changes: 18 additions & 0 deletions docs/Gotchas.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,24 @@ If you'd like to help the investigation, any and all testing is greatly apprecia

</details>

<details><summary><h5>No disks available during macOS installation</h5></summary>

If you're in macOS Recovery and trying to use the installer, you'll get to a screen asking you to select a disk.

If this screen only shows "macOS Base System" (greyed out), then it simply means you have not formatted the virtual disk yet.

This can be done by using **Disk Utility** from the macOS Recovery menu.

Select the ``QEMU HARDDISK`` entry from the sidebar with the storage capacity corresponding to what you chose during AutoPilot - be careful not to erase the small OpenCore partition.

When selected, click "Erase" from the centre-top header, and enter a name for the new disk; this can be whatever you want. The default is ``Untitled``, so you can be classy and call it ``Titled``, or if you want to emulate a real Mac, call it ``Macintosh HD``. It's up to you.

For the filesystem, leave ``APFS`` as the selected option, unless you particularly want to use Mac OS Extended.

Then, simply quit Disk Utility and return to the macOS installer. On the disk selection screen, your newly-formatted disk should appear as a selectable option. Click it, and then click ``Install``. Done!

</details>

<details><summary><h5>Who the hell is Eversiege?</h5></summary>

You may have seen the name ``Eversiege`` pop up throughout the project. Who is it you ask?
Expand Down
21 changes: 21 additions & 0 deletions docs/changelogs/v0-9-6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## v0.9.6

### Minor update • 17/08/2023

This update includes the following features / fixes / changes:

- AutoPilot target OS stage made easier to select macOS version
- macOS Ventura support has been partially fixed; change CPU model from `Penryn` to `Skylake-Client`
- Fixed some USB XHCI issues
- Fixed an issue with OVMF files when using VFIO-PCI passthrough assistant
- Fixed restoration tools from using wrong blobs folder
- Various VFIO-PCI passthrough patches
- Minor AutoPilot UI improvements
- Small repo updater tool patch
- Config files now use sudo flagging when adding VFIO-PCI arguments
- Main menu now intelligently runs scripts as sudo if they have VFIO-PCI arguments
- *happy dying sounds*

To see individual code changes, visit the project's commits page at <https://github.com/Coopydood/ultimate-macOS-KVM/commits/main>

Remember, commits by Coopydood will always be signed as **4CD28348A3DD016F** or GitHub's public key.
58 changes: 45 additions & 13 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@
"""

# WELCOME TO ULTMOS! *waves like an idiot*

# THIS IS THE MAIN FILE! RUN THIS FILE FIRST!
# ./main.py
##################################################
# THIS IS THE MAIN FILE! RUN THIS FILE FIRST! #
# #
# $ ./main.py #
##################################################


import os
Expand All @@ -33,6 +37,8 @@
args = parser.parse_args()

global apFilePath
global VALID_FILE
global REQUIRES_SUDO

detectChoice = 1
latestOSName = "Sonoma"
Expand Down Expand Up @@ -97,23 +103,45 @@ def startup():
if int(macOSVer) >= 999:
macOSVer = str(int(macOSVer) / 100)
if os.path.exists("./"+apFilePath):
global REQUIRES_SUDO
global VALID_FILE

apFile = open("./"+apFilePath,"r")




if "REQUIRES_SUDO=1" in apFile.read():
REQUIRES_SUDO = 1
else:
REQUIRES_SUDO = 0

apFile.close()

apFile = open("./"+apFilePath,"r")

if "APC-RUN" in apFile.read():
print(color.BOLD+"\n B. Boot macOS "+macOSVer+"")
print(color.END+" Start macOS using the detected\n "+apFilePath+" script file.")
VALID_FILE = 1

#REQUIRES_SUDO = 1 # UNCOMMENT FOR DEBUGGING

if REQUIRES_SUDO == 1:
print(color.BOLD+"\n B. Boot macOS "+macOSVer+color.YELLOW,"⚠"+color.END)
print(color.END+" Start macOS using the detected\n "+apFilePath+" script file."+color.YELLOW,"Requires superuser."+color.END)
else:
print(color.BOLD+"\n B. Boot macOS "+macOSVer+"")
print(color.END+" Start macOS using the detected\n "+apFilePath+" script file.")
print(color.END+"\n 1. AutoPilot")

else:
print(color.BOLD+"\n 1. AutoPilot (Experimental)")
print(color.END+" Quickly and easily set up a macOS VM in just a few steps\n")
print(color.BOLD+"\n 1. AutoPilot")
print(color.END+" Quickly and easily set up a macOS\n virtual machine in just a few steps\n")

else:
print(color.BOLD+"\n 1. AutoPilot (Experimental)")
print(color.END+" Quickly and easily set up a macOS VM in just a few steps\n")
print(color.BOLD+"\n 1. AutoPilot")
print(color.END+" Quickly and easily set up a macOS\n virtual machine in just a few steps\n")
else:
print(color.BOLD+"\n 1. AutoPilot (Experimental)")
print(color.END+" Quickly and easily set up a macOS VM in just a few steps\n")
print(color.BOLD+"\n 1. AutoPilot")
print(color.END+" Quickly and easily set up a macOS\n virtual machine in just a few steps\n")


#print(color.END+" 2. Download and convert macOS image")
Expand Down Expand Up @@ -255,8 +283,12 @@ def clear(): print("\n" * 150)
os.system('./scripts/repo-update.py')
elif detectChoice == "q" or detectChoice == "Q":
exit
elif detectChoice == "b" or detectChoice == "B":
elif detectChoice == "b" and VALID_FILE == 1 or detectChoice == "B" and VALID_FILE == 1:
clear()
os.system("./"+apFilePath)
if REQUIRES_SUDO == 1:
print(color.YELLOW+color.BOLD+"\n ⚠ "+color.END+color.BOLD+"SUPERUSER PRIVILEGES"+color.END+"\n This script uses physical PCI passthrough,\n and needs superuser priviledges to run.\n\n Press CTRL+C to cancel.\n"+color.END)
os.system("sudo ./"+apFilePath)
else:
os.system("./"+apFilePath)
else:
startup()
3 changes: 2 additions & 1 deletion resources/baseConfig
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ ID="$USR_ID"
NAME="$USR_NAME"
FILE="$USR_CFG"

ULTMOS_VERSION=0.0.0
IGNORE_FILE=0
REQUIRES_SUDO=0
VFIO_PTA=0
Expand Down Expand Up @@ -83,7 +84,7 @@ args=(
##########################################################################

-netdev user,id=net0 -device "$NETWORK_DEVICE",netdev=net0,id=net0,mac="$MAC_ADDRESS"
-device qxl-vga,vgamem_mb=128,vram_size_mb=128
-device qxl-vga,vgamem_mb=128,vram_size_mb=128
-monitor stdio
#-display none
#-vga qxl
Expand Down
2 changes: 2 additions & 0 deletions resources/baseDomain
Original file line number Diff line number Diff line change
Expand Up @@ -193,5 +193,7 @@
<qemu:arg value="type=2"/>
<qemu:arg value="-cpu"/>
<qemu:arg value="$USR_CPU_MODEL,kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,$USR_CPU_ARGS"/>
<qemu:arg value="-global"/>
<qemu:arg value="nec-usb-xhci.msi=off"/>
</qemu:commandline>
</domain>
Binary file added resources/ovmf/OVMF_VARS_PT.fd
Binary file not shown.
24 changes: 18 additions & 6 deletions scripts/autopilot.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,16 @@ class color:
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
END = '\033[0m'
GRAY = '\u001b[38;5;245m'

def startup():
global detectChoice
print("\n\n Welcome to"+color.BOLD+color.PURPLE,"AutoPilot"+color.END,"")
print(" Created by",color.BOLD+"Coopydood\n"+color.END)
print("\n The purpose of this script is to automatically guide you through \n the process of",color.BOLD+"creating and running a basic macOS VM",color.END+"using settings \n based on answers to a number of questions. \n\n Many of the values can be left to default - especially if you are unsure.\n It won't be perfect, but it's supposed to make it as"+color.BOLD,"easy as possible.\n"+color.END)
print(" The purpose of this script is to automatically guide you through \n the process of",color.BOLD+"creating and running a basic macOS VM",color.END+"using settings \n based on answers to a number of questions. \n\n Many of the values can be left to default - especially if you are unsure.\n It won't be perfect, but it's supposed to make it as"+color.BOLD,"easy as possible."+color.END)
#print(color.BOLD+"\n"+" Profile:"+color.END,"https://github.com/Coopydood")
#print(color.BOLD+" Repo:"+color.END,"https://github.com/Coopydood/ultimate-macOS-KVM") # no shameless plugs anymore :[
print(" Continue whenever you're ready, or return to the main menu.")
#print(" Continue whenever you're ready, or return to the main menu.")
print(color.BOLD+"\n 1. Start")
print(color.END+" Begin creating a new QEMU-based macOS config file \n")
print(color.END+" 2. Main menu")
Expand Down Expand Up @@ -183,8 +184,8 @@ def stage14():
print(" "+"\n "+color.BOLD+"Ready to generate files"+color.END)
else:
print(" "+"\n "+color.BOLD+"Ready to generate config file"+color.END)
print(" "+"Review your preferences")
print(" "+"\n The config wizard is complete.\n Review your preferences below and continue when ready."+color.END)
#print(" "+"Review your preferences")
print(" "+"The config wizard is complete.\n Review your preferences below and continue when ready."+color.END)
print(" "+"\n "+color.BOLD+"──────────────────────────────────────────────────────────────",color.END)
if USR_CREATE_XML == "True":
print(" "+color.BOLD+color.PURPLE+"FILES ",color.END+color.END+USR_CFG+", "+USR_CFG_XML)
Expand Down Expand Up @@ -1400,6 +1401,8 @@ def refreshStatusGUI():
print(" "+color.BOLD+color.YELLOW+"● ",color.END+color.BOLD+"Creating virtual hard disk"+color.END)
elif PROC_GENHDD == 2:
print(" "+color.BOLD+color.GREEN+"● ",color.END+color.END+"Creating virtual hard disk"+color.END)
elif PROC_GENHDD == 3:
print(" "+color.BOLD+color.CYAN+"● ",color.END+color.END+"Creating virtual hard disk"+color.END)

if PROC_APPLYPREFS == 0:
print(" "+color.BOLD+color.RED+"● ",color.END+color.END+"Applying preferences"+color.END)
Expand Down Expand Up @@ -1632,6 +1635,9 @@ def existingWarning():
configData = configData.replace("$USR_CFG",str(USR_CFG))
configData = configData.replace("$USR_MAC_ADDRESS",str(USR_MAC_ADDRESS))
configData = configData.replace("$USR_SCREEN_RES",str(USR_SCREEN_RES))

configData = configData.replace("0.0.0",version)

if USR_BOOT_FILE == "-2":
configData = configData.replace("-drive id=BaseSystem,if=none,file=\"$REPO_PATH/BaseSystem.img\",format=raw","#-drive id=BaseSystem,if=none,file=\"$REPO_PATH/BaseSystem.img\",format=raw")
configData = configData.replace("-device ide-hd,bus=sata.4,drive=BaseSystem","#-device ide-hd,bus=sata.4,drive=BaseSystem")
Expand Down Expand Up @@ -1817,14 +1823,20 @@ def existingWarning1():
stageSelect = str(input(color.BOLD+"Select> "+color.END))

if stageSelect == "1":
global PROC_GENHDD

os.system("mv ./HDD.qcow2"+" ./"+str(datetime.today().strftime('%d-%m-%Y_%H-%M-%S'))+"_HDD.qcow2")
PROC_GENHDD = 2
apcGenHDD()

elif stageSelect == "2":

PROC_GENHDD = 3
refreshStatusGUI()

elif stageSelect == "x" or stageSelect == "X":
os.system("rm HDD.qcow2")
PROC_GENHDD = 2
apcGenHDD()

elif stageSelect == "q" or stageSelect == "Q":
Expand All @@ -1835,14 +1847,14 @@ def existingWarning1():
else:
os.system("qemu-img create -f qcow2 HDD.qcow2 "+USR_HDD_SIZE+" > /dev/null 2>&1")
time.sleep(3)

PROC_GENHDD = 2

# Hard disk creation error catcher - thanks Cyber!
if not os.path.exists("./HDD.qcow2"):
errorMessage = "The virtual hard disk file could not be created.\n Did you install QEMU + tools?"
throwError()

PROC_GENHDD = 2

refreshStatusGUI()
time.sleep(2)

Expand Down
4 changes: 2 additions & 2 deletions scripts/extras/kvm-check.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ def clear(): print("\n" * 150)


# vfcConfig
if os.path.exists("./blobs/USR_CFG.apb"):
apFilePath = open("./blobs/USR_CFG.apb")
if os.path.exists("./blobs/user/USR_CFG.apb"):
apFilePath = open("./blobs/user/USR_CFG.apb")
apFilePath = apFilePath.read()
if os.path.exists("./"+apFilePath):
apFile = open("./"+apFilePath,"r")
Expand Down
4 changes: 2 additions & 2 deletions scripts/extras/vfio-check.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ def clear(): print("\n" * 150)
print("Checking your system... (7/7)")

# vfcConfig
if os.path.exists("./blobs/USR_CFG.apb"):
apFilePath = open("./blobs/USR_CFG.apb")
if os.path.exists("./blobs/user/USR_CFG.apb"):
apFilePath = open("./blobs/user/USR_CFG.apb")
apFilePath = apFilePath.read()
if os.path.exists("./"+apFilePath):
apFile = open("./"+apFilePath,"r")
Expand Down
27 changes: 20 additions & 7 deletions scripts/extras/vfio-passthrough.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
latestOSVer = "13"
runs = 0

global USR_SCREEN_RES

USR_SCREEN_RES = open("./blobs/user/USR_SCREEN_RES.apb")
USR_SCREEN_RES = USR_SCREEN_RES.read()

class color:
PURPLE = '\033[95m'
CYAN = '\033[96m'
Expand Down Expand Up @@ -134,10 +139,14 @@ def manualAPSelect():
currentDispVal = currentDispVal - 1
devLineF = str(deviceLines[currentDispVal])
apFileM = apFileM.replace("#VFIO_DEV_BEGIN","#VFIO_DEV_BEGIN\n"+devLineF)
apFileM = apFileM.replace("-vga qxl","-vga none")
apFileM = apFileM.replace("-monitor stdio","-monitor none")
apFileM = apFileM.replace("#-vga qxl","-vga none")
#apFileM = apFileM.replace("-monitor stdio","-monitor none")
apFileM = apFileM.replace("#-display none","-display none")
os.system("cp ./resources/ovmf/* ./ovmf/")
apFileM = apFileM.replace("REQUIRES_SUDO=0","REQUIRES_SUDO=1")
apFileM = apFileM.replace("VFIO_PTA=0","VFIO_PTA=1")
apFileM = apFileM.replace("-device qxl-vga,vgamem_mb=128,vram_size_mb=128 ","#-device qxl-vga,vgamem_mb=128,vram_size_mb=128 # DISABLED BY VFIO-PCI PASSTHROUGH ASSISTANT")
os.system("cp resources/ovmf/OVMF_CODE.fd ovmf/OVMF_CODE.fd")
os.system("cp resources/ovmf/OVMF_VARS_PT.fd ovmf/OVMF_VARS.fd")
file1.close

with open(apFilePath,"w") as file:
Expand Down Expand Up @@ -256,10 +265,14 @@ def manualAPSelect():
currentDispVal = currentDispVal - 1
devLineF = str(deviceLines[currentDispVal])
apFileM = apFileM.replace("#VFIO_DEV_BEGIN","#VFIO_DEV_BEGIN\n"+devLineF)
apFileM = apFileM.replace("-vga qxl","-vga none")
apFileM = apFileM.replace("-monitor stdio","-monitor none")
apFileM = apFileM.replace("#-vga qxl","-vga none")
#apFileM = apFileM.replace("-monitor stdio","-monitor none")
apFileM = apFileM.replace("#-display none","-display none")
os.system("cp ./resources/ovmf/* ./ovmf/")
apFileM = apFileM.replace("REQUIRES_SUDO=0","REQUIRES_SUDO=1")
apFileM = apFileM.replace("VFIO_PTA=0","VFIO_PTA=1")
apFileM = apFileM.replace("-device qxl-vga,vgamem_mb=128,vram_size_mb=128","#-device qxl-vga,vgamem_mb=128,vram_size_mb=128 # DISABLED BY VFIO-PCI PASSTHROUGH ASSISTANT")
os.system("cp resources/ovmf/OVMF_CODE.fd ovmf/OVMF_CODE.fd")
os.system("cp resources/ovmf/OVMF_VARS_PT.fd ovmf/OVMF_VARS.fd")
file1.close

with open("./"+apFilePath,"w") as file:
Expand Down Expand Up @@ -623,7 +636,7 @@ def stage1():
stage1()
elif detectChoice == "2":
clear()
os.system('./scripts/gpu-check.py')
os.system('./scripts/extras/gpu-check.py')

elif detectChoice == "B" or detectChoice == "b":
os.system('./main.py')
Expand Down
2 changes: 1 addition & 1 deletion scripts/extras/xml-convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def importXML():

if detectChoice1 == "1":
clear()
print(color.YELLOW+color.BOLD+"\n ⚠ "+color.END+color.BOLD+"SUPERUSER PRIVILEGES"+color.END+"\n To define the domain, virsh needs superuser to continue.\n"+color.END)
print(color.YELLOW+color.BOLD+"\n ⚠ "+color.END+color.BOLD+"SUPERUSER PRIVILEGES"+color.END+"\n To define the domain, virsh needs superuser to continue.\n\n Press CTRL+C to cancel.\n"+color.END)
os.system("sudo virsh define "+apFilePathNoExt+".xml")
time.sleep(4)
clear()
Expand Down
4 changes: 2 additions & 2 deletions scripts/repo-update.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

# INTERNAL VERSION OF THIS UTILITY
# May be used in the future
updaterVersion = "2.0"
updaterVersion = "2.1"

if os.path.exists("./.version"):
version = open("./.version")
Expand Down Expand Up @@ -217,7 +217,7 @@ def updateBrains():
os.system("git reset --hard tags/v"+targetVersion)
else:
os.system("git pull -f -q")
os.system("git merge origin/main")
os.system("git merge --autostash origin/main")
clear()
clear()
print("\n\n "+color.BOLD+color.BLUE+"⧖ UPDATING..."+color.END,"")
Expand Down
2 changes: 1 addition & 1 deletion scripts/vfio-menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def startup():
#print(color.BOLD+" Repo:"+color.END,"https://github.com/Coopydood/ultimate-macOS-KVM")
print(" Select an option to continue.")
print(color.BOLD+"\n 1. VFIO-PCI passthrough assistant")
print(color.END+" Automatically configure PCI passthrough with ease\n using an existing AutoPilot config file.\n")
print(color.END+" Automatically configure PCI passthrough with ease\n using an existing AutoPilot config file\n")
print(color.END+" 2. Check if your system is ready...")
print(color.END+" 3. Display system IOMMU grouping")
print(color.END+" 4. Get and display vfio-pci device IDs")
Expand Down

0 comments on commit 6c5987a

Please sign in to comment.