Skip to content

Commit

Permalink
v0.9.2 - AP screen resolution stage + OC updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Coopydood committed Jul 13, 2023
1 parent 72332da commit 59a5876
Show file tree
Hide file tree
Showing 77 changed files with 815 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.9.1
0.9.2
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.1
### v0.9.2

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-1.md)*
*[What's new?](https://github.com/Coopydood/ultimate-macOS-KVM/blob/main/docs/changelogs/v0-9-2.md)*

![GitHub](https://img.shields.io/github/license/Coopydood/ultimate-macOS-KVM?label=Licence&logo=unlicense&logoColor=white&style=for-the-badge) ![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) ![Discord](https://img.shields.io/discord/574943603466436628?color=7d86ff&label=Discord&logo=discord&logoColor=white&style=for-the-badge)

Expand Down
9 changes: 0 additions & 9 deletions UPGRADEPATH

This file was deleted.

1 change: 0 additions & 1 deletion VERSION

This file was deleted.

1 change: 1 addition & 0 deletions blobs/CDN_CONTROL
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fresh_cdn
46 changes: 46 additions & 0 deletions docs/OpenCore.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
## OpenCore
### Important information about the included OpenCore image

#### Introduction
This project contains several customised OpenCore bootloader disk images, modified from kholia's OSX-KVM repo. The images have been set up in a way that should work out-of-the-box without any user modification.

However, due to this one-size-fits-all configuration shared among all users of the project, you might *want* to manually edit some things.

The default OpenCore image included with **ultimate-macOS-KVM** presents the following system properties:

- **Model**: Mac mini (2018)
- **Identifier**: Macmini8,1
- **Processor**: Dual-Core Intel Core i7 @ 2.9GHz
- **Serial Number**: C07W10D9JYVX

#### Do NOT sign in to your Apple ID yet!
But don't worry, you can after some light tinkering.

The problem lies with the *serial number*. The default Mac serial number that comes with the OpenCore image included in this project is **C07W10D9JYVX**. While this *is* in the correct format for a Mac Mini 2018, it's likely going to be shared by several users.

This becomes a problem when Apple IDs get involved. When you sign in to a Mac with your Apple ID, it becomes associated with it, via the serial number. When many people sign in to their unique Apple IDs on the same shared serial number- ...well, some folks at Apple likely begin to stroke their neckbeards.

Basically, the serial number gets **busted**. Or, less dramatically - blacklisted. This means that any Apple ID that tries to sign into it will be flagged as compromised, prompting the user to perform a mandatory password change. Trust me, this is not a headache you want.

So, in order to sign in to your own Apple ID safely, you need your *own* serial number. Ya dig? Read on.

#### Getting your own serial number
Now that you understand the *"why"*, it's time to learn the *"how"*.

Unless you're booting macOS for the first time *with an already-modified OpenCore image containing a unique serial number*, you **should NOT sign in with your Apple ID during Setup Assistant under ANY CIRCUMSTANCES.**

Create a "local" user account by skipping the Apple ID stage of the Setup Assistant. After you complete the Setup Assistant with a regular local account, you can continue.

Now, check your serial number. Go to **Apple Menu > About this Mac** and look at the **Serial Number** entry. If your serial number is **C07W10D9JYVX**, you still have the shared default, and should change it.

To do this, the easiest method is to use **OpenCore Configurator** from within the macOS VM. This can be obtained here: https://mackie100projects.altervista.org/download-opencore-configurator/

Open it, and in the menu bar, go to **Tools > Mount EFI**. A new window will pop up. There will be a couple of entries called "EFI". The one we want is the entry **without** "Preboot,Recovery,VM" etc.

Click **Mount**, authenticate, and close the popup window. Then, on the menu bar, go to **File > Open**. From here, use the Finder popup window to navigate to **EFI > OC** and select **config.plist**. The main window should reopen with entries already populated.

Now, down the side of the main window, click **PlatformInfo**, then along the tab bar at the top to **SMBIOS**. At the bottom of the page, there is a combo box (select list) to the right of "Check Coverage". Click it, and browse the list of Mac models until you find one that you want (or just choose the 2018 Mac mini again).

The many fields on the page should now be populated with values, including the *serial number* at the top. Under the box, there should be a **Generate** button. Click that and make sure the new serial number is unique. When you've done this, go ahead and go to **File > Save**, and reboot the VM.

Upon reboot, check the serial number again from the **About this Mac** window. If it has been changed - **congratulations**! You now have a unique serial number. This means you can safely log into your Apple ID, with the assurance no one else will use that serial number.
22 changes: 22 additions & 0 deletions docs/changelogs/v0-9-2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## v0.9.2

### Minor update • 13/07/2023

This update includes the following features / fixes / changes:

- Added a screen resolution option stage to AutoPilot
- Updated base config to support user screen resolution
- Better config timestamping
- Added an XHCI USB controller to the base config for USB 3.1 support
- Tidied up the base config layout and marked areas of user concern
- Updated macOS downloader script with vit9696's updates
- OpenCore image update rollup; updated kexts and bootcode
- Removed support for legacy 0.8.x versions, directory structure change
- Fixed an issue where AutoPilot would not accept custom values if project was newly cloned
- Fixed an issue preventing the script backup store on certain upgraded repos
- Added new bugs, according to Eversiege (please report!?)
- *yawns*

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.
Binary file removed ovmf/OVMF_CODE.fd
Binary file not shown.
10 changes: 2 additions & 8 deletions resources/.upgrade
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
0.8.0
0.8.1
0.8.2
0.8.3
0.8.4
0.8.5
0.8.6
0.9.0
0.9.1
0.9.1
0.9.2
3 changes: 3 additions & 0 deletions resources/UPGRADEPATH
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
0.9.0
0.9.1
0.9.2
19 changes: 14 additions & 5 deletions resources/baseConfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# THIS CONFIG FILE SHOULD NOT BE EDITED BY THE USER! #
# #
# It is intended to be used by the automatic setup wizard. #
# To use the wizard, run the included "setup.py" file; #
# To use the wizard, run the included "main.py" file; #
# #
# $ ./setup.py #
# $ ./main.py #
############################################################.

#
Expand All @@ -29,7 +29,9 @@ FILE="$USR_CFG"
IGNORE_FILE=0
REQUIRES_SUDO=0
VFIO_PTA=0
GENEPOCH=000000000
GEN_EPOCH=000000000

SCREEN_RES="$USR_SCREEN_RES"

ALLOCATED_RAM="$USR_ALLOCATED_RAM"
CPU_SOCKETS="$USR_CPU_SOCKS"
Expand All @@ -40,15 +42,16 @@ CPU_FEATURE_ARGS="$USR_CPU_FEATURE_ARGS"

REPO_PATH="$USR_REPO_PATH"
OVMF_DIR="$USR_REPO_PATH/ovmf"

VFIO_ID_0="$USR_VFIO_ID_0"
VFIO_ID_1="$USR_VFIO_ID_1"
VFIO_ROM="$USR_VFIO_ROM"

USB_DEVICES="$USR_USB_DEVICES"

NETWORK_DEVICE="$USR_NETWORK_DEVICE"
MAC_ADDRESS="$USR_MAC_ADDRESS"


# You should not have to touch anything below this line, especially if you
# don't really know what you're doing. It'll probably break something.

Expand All @@ -59,6 +62,7 @@ args=(
-usb -device usb-kbd -device usb-tablet #USB_DEV
-smp "$CPU_THREADS",cores="$CPU_CORES",sockets="$CPU_SOCKETS"
-device usb-ehci,id=ehci
-device qemu-xhci,id=xhci
-device pcie-root-port,bus=pcie.0,slot=1,x-speed=16,x-width=32
#VFIO_DEV_BEGIN
#VFIO_DEV_END
Expand All @@ -79,10 +83,15 @@ args=(
##########################################################################

-netdev user,id=net0 -device "$NETWORK_DEVICE",netdev=net0,id=net0,mac="$MAC_ADDRESS"
-vga qxl
-device qxl-vga,vgamem_mb=128,vram_size_mb=128
-monitor stdio
#-display none
#-vga qxl

################ UNCOMMENT IF YOU WANT TO USE VNC MONITOR ################
#-vnc 0.0.0.0:1,password=on -k en-us
##########################################################################

)

qemu-system-x86_64 "${args[@]}"
1 change: 1 addition & 0 deletions resources/oc_store/compat_new/EFI/BOOT/.contentFlavour
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
OpenCore
1 change: 1 addition & 0 deletions resources/oc_store/compat_new/EFI/BOOT/.contentVisibility
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Disabled
Binary file modified resources/oc_store/compat_new/EFI/BOOT/BOOTx64.efi
Binary file not shown.
1 change: 1 addition & 0 deletions resources/oc_store/compat_new/EFI/OC/.contentFlavour
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
OpenCore
1 change: 1 addition & 0 deletions resources/oc_store/compat_new/EFI/OC/.contentVisibility
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Disabled
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified resources/oc_store/compat_new/EFI/OC/Drivers/OpenCanopy.efi
Binary file not shown.
Binary file modified resources/oc_store/compat_new/EFI/OC/Drivers/OpenHfsPlus.efi
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified resources/oc_store/compat_new/EFI/OC/Drivers/OpenRuntime.efi
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified resources/oc_store/compat_new/EFI/OC/OpenCore.efi
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified resources/oc_store/compat_new/EFI/OC/Tools/ResetSystem.efi
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified resources/oc_store/compat_new/OpenCore.qcow2
Binary file not shown.
Binary file modified resources/oc_store/compat_old/OpenCore.qcow2
Binary file not shown.
Binary file modified resources/ovmf/OVMF_VARS.fd
Binary file not shown.
Binary file added resources/ovmf/OVMF_VARS_1024x768.fd
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added resources/ovmf/OVMF_VARS_1920x1080.fd
Binary file not shown.
Binary file added resources/ovmf/OVMF_VARS_2560x1440.fd
Binary file not shown.
Binary file not shown.
Binary file added resources/ovmf/OVMF_VARS_800x600.fd
Binary file not shown.
123 changes: 113 additions & 10 deletions scripts/autopilot.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def autopilot():
customValue = 0


def stage12():
def stage13():
global USR_CPU_SOCKS
global USR_CPU_CORES
global USR_CPU_THREADS
Expand Down Expand Up @@ -180,7 +180,7 @@ def stage12():
handoff()

elif stageSelect == "2":
stage11()
stage12()

elif stageSelect == "x" or stageSelect == "X":
currentStage = 1
Expand All @@ -194,11 +194,101 @@ def stage12():
os.system('xdg-open https://github.com/Coopydood/ultimate-macOS-KVM/wiki/AutoPilot#review-your-preferences > /dev/null 2>&1')
time.sleep(6)
clear()
stage12()
stage13()

elif stageSelect == "q" or stageSelect == "Q":
exit

def stage12():
global customValue
global currentStage
global USR_SCREEN_RES
defaultValue = "1280x720"

clear()
print("\n "+color.BOLD+"Screen resolution"+color.END)
print(" Step 12")
print("\n Select a compatible booter screen resolution. \n This resolution will apply to both the bootloader and\n macOS, and can be changed later in OVMF Plaform Settings. If you\n intend on using GPU passthrough, your GPU/monitor determines this."+color.END)
print("\n "+color.BOLD+color.CYAN+"DEFAULT:",color.END+color.BOLD+defaultValue+color.END)
if customValue == 1:
# print(color.BOLD+color.PURPLE+"\n FORMAT:"+color.YELLOW+""+color.END+color.BOLD,"<file>"+color.YELLOW+".img"+color.END+"\n Enter a custom value.\n \n ")
print(color.END+"\n 1. 800x600")
print(color.END+" 2. 1024x768")
print(color.BOLD+" 3. 1280x720 (720p)")
print(color.END+" 4. 1280x1024")
print(color.END+" 5. 1440x900")
print(color.END+" 6. 1920x1080 (1080p)")
print(color.END+" 7. 2560x1440 (1440p)")
print(color.END+" 8. 3840x2160 (4K)\n")
customInput = str(input(color.BOLD+"Select> "+color.END))

if customInput == "1":
customInput = "800x600"
elif customInput == "2":
customInput = "1024x768"
elif customInput == "3":
customInput = "1280x720"
elif customInput == "4":
customInput = "1280x1024"
elif customInput == "5":
customInput = "1440x900"
elif customInput == "6":
customInput = "1920x1080"
elif customInput == "7":
customInput = "2560x1440"
elif customInput == "8":
customInput = "3840x2160"
else:
customInput = "1280x720"

USR_SCREEN_RES = customInput #+".sh" #<--- change required prefix/suffix
currentStage = currentStage + 1
customValue = 0
blob = open("./blobs/USR_SCREEN_RES.apb","w")
blob.write(USR_SCREEN_RES)
blob.close()
stage13()
else:
print(color.BOLD+"\n 1. 1280x720")
print(color.END+" 2. More resolutions...")
print(color.END+" 3. Back")
print(color.END+" H. Help...")
print(color.END+" Q. Exit\n ")
stageSelect = str(input(color.BOLD+"Select> "+color.END))

if stageSelect == "1":
USR_SCREEN_RES = "1280x720"
blob = open("./blobs/USR_SCREEN_RES.apb","w")
blob.write(USR_SCREEN_RES)
blob.close()
blob = open("./blobs/CDN_CONTROL","w")
blob.write("fresh_cdn")
blob.close()
currentStage = currentStage + 1
stage13()

elif stageSelect == "2":
customValue = 1
stage12()

elif stageSelect == "3":
currentStage = 1
stage11()

elif stageSelect == "h" or stageSelect == "H":
clear()
print("\n\n "+color.BOLD+color.GREEN+"✔ OPENING STAGE HELP PAGE IN DEFAULT BROWSER"+color.END,"")
print(" Continue in your browser\n")
print("\n I have attempted to open this stage's help page in\n your default browser. Please be patient.\n\n You will be returned to the last screen in 5 seconds.\n\n\n\n\n")
os.system('xdg-open https://github.com/Coopydood/ultimate-macOS-KVM/wiki/AutoPilot#11-macos-recovery-image-file > /dev/null 2>&1')
time.sleep(6)
clear()
stage12()

elif stageSelect == "q" or stageSelect == "Q":
exit


def stage11():
global customValue
global currentStage
Expand Down Expand Up @@ -1083,7 +1173,7 @@ def apcPrepare(): # PREPARE
os.system("cp -R resources/oc_store/compat_new/EFI boot/EFI")

os.system("cp resources/ovmf/OVMF_CODE.fd ovmf/OVMF_CODE.fd")
os.system("cp resources/ovmf/OVMF_VARS.fd ovmf/OVMF_VARS.fd")
os.system("cp resources/ovmf/OVMF_VARS_"+USR_SCREEN_RES+".fd ovmf/OVMF_VARS.fd")

integrityConfig = 1
if os.path.exists("resources/config.sh"):
Expand Down Expand Up @@ -1156,6 +1246,14 @@ def apcBlobCheck(): # CHECK BLOBS
integrity = integrity + 0
else:
integrity = integrity - 1
if os.path.exists("blobs/USR_MAC_ADDRESS.apb"):
integrity = integrity + 0
else:
integrity = integrity - 1
if os.path.exists("blobs/USR_SCREEN_RES.apb"):
integrity = integrity + 0
else:
integrity = integrity - 1

if integrity == 1:
PROC_CHECKBLOBS = 2
Expand Down Expand Up @@ -1240,6 +1338,7 @@ def existingWarning():
configData = configData.replace("baseConfig",str(USR_CFG))
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))
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 @@ -1385,11 +1484,12 @@ def apcApplyPrefs(): # APPLY USER PREFERENCES
configData = configData.replace("# THIS CONFIG FILE SHOULD NOT BE EDITED BY THE USER! #","# APC-RUN_"+str(datetime.today().strftime('%Y-%m-%d_%H-%M-%S'))+"\n#\n# THIS FILE WAS GENERATED USING AUTOPILOT.")
configData = configData.replace("# #\n","")
configData = configData.replace("# It is intended to be used by the automatic setup wizard. #\n","")
configData = configData.replace("# To use the wizard, run the included \"main.py\" file; #\n","")
configData = configData.replace("# To use the wizard, run the included \"main.py\" file; #\n","")
configData = configData.replace("# #","#")
configData = configData.replace("# $ ./main.py #","#\n# To boot this script, run the following command:\n# $ ./"+str(USR_CFG))
configData = configData.replace("# ./main.py","")
configData = configData.replace("# $ ./main.py #","#\n# To boot this script, run the following command:\n# $ ./"+str(USR_CFG))
configData = configData.replace("# ./main.py","")
configData = configData.replace("############################################################.","#")
configData = configData.replace("GEN_EPOCH=000000000","GEN_EPOCH="+str(int(time.time())))

with open ("resources/config.sh","w") as file:
file.write(configData)
Expand Down Expand Up @@ -1491,16 +1591,19 @@ def apcCleanUp(): # CLEAN BLOBS AND TEMP

print(color.BOLD+"\n 1. Boot")
print(color.END+" Run your",USR_CFG,"file now.\n")

print(" "+color.END+" 2. Main menu")
print(" "+color.END+" 2. Open in default editor")
print(" "+color.END+" 3. Main menu")
print(" "+color.END+" Q. Exit\n")
stageSelect = str(input(color.BOLD+"Select> "+color.END))

if stageSelect == "1":
clear()
os.system("./"+USR_CFG)

elif stageSelect == "2":
os.system("xdg-open ./"+USR_CFG)

elif stageSelect == "3":
os.system("python ./main.py")

elif stageSelect == "q" or stageSelect == "Q":
Expand Down
Loading

0 comments on commit 59a5876

Please sign in to comment.