From cdf6ceed4b54274f9e7276d48993d43f6ddd9544 Mon Sep 17 00:00:00 2001 From: Steffen70 Date: Wed, 12 Jun 2024 18:39:38 +0200 Subject: [PATCH 1/3] Updated OpenCore-Boot.sh for macOS Sonoma support and added OpenCore-Boot-NoUI.sh for background VM startup. --- OpenCore-Boot-NoUI.sh | 50 + OpenCore-Boot.sh | 16 +- OpenCore/Boot-NoUI/config.plist | 1940 +++++++++++++++++++++++++++++++ README-NoUI.md | 106 ++ fetch-macOS-v2.py | 4 +- 5 files changed, 2110 insertions(+), 6 deletions(-) create mode 100755 OpenCore-Boot-NoUI.sh create mode 100755 OpenCore/Boot-NoUI/config.plist create mode 100644 README-NoUI.md diff --git a/OpenCore-Boot-NoUI.sh b/OpenCore-Boot-NoUI.sh new file mode 100755 index 0000000..26320c1 --- /dev/null +++ b/OpenCore-Boot-NoUI.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash + +MY_OPTIONS="+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check" + +ALLOCATED_RAM="12288" # MiB +CPU_SOCKETS="1" +CPU_CORES="2" +CPU_THREADS="4" + +REPO_PATH="." +OVMF_DIR="." + +args=( + -enable-kvm -m "$ALLOCATED_RAM" + + # Set the CPU model and options + # Use Haswell-noTSX for Sonoma and Penryn for older versions + -cpu Haswell-noTSX,kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,"$MY_OPTIONS" + + -machine q35 + -device qemu-xhci,id=xhci + -device usb-kbd,bus=xhci.0 -device usb-tablet,bus=xhci.0 + -smp "$CPU_THREADS",cores="$CPU_CORES",sockets="$CPU_SOCKETS" + -device usb-ehci,id=ehci + -device isa-applesmc,osk="ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc" + -drive if=pflash,format=raw,readonly=on,file="$REPO_PATH/$OVMF_DIR/OVMF_CODE.fd" + -drive if=pflash,format=raw,file="$REPO_PATH/$OVMF_DIR/OVMF_VARS-1920x1080.fd" + -smbios type=2 + -device ich9-intel-hda -device hda-duplex + -device ich9-ahci,id=sata + + # Add the OpenCore bootloader drive with boot priority + -drive id=OpenCoreBoot,if=none,snapshot=on,format=qcow2,file="$REPO_PATH/OpenCore/OpenCore.qcow2" + -device ide-hd,bus=sata.2,drive=OpenCoreBoot,bootindex=1 + + # Add the macOS hard drive + -drive id=MacHDD,if=none,file="$REPO_PATH/mac_hdd_ng.img",format=qcow2 + -device ide-hd,bus=sata.4,drive=MacHDD + + # Configure network with port forwarding for SSH access + -netdev user,id=net0,hostfwd=tcp::2222-:22 + -device virtio-net-pci,netdev=net0,id=net0,mac=52:54:00:c9:18:27 + + # Disable the QEMU monitor interface and graphical output + -monitor none + -nographic +) + +# Start the QEMU virtual machine in the background and disown the process +qemu-system-x86_64 "${args[@]}" > /dev/null 2>&1 & disown diff --git a/OpenCore-Boot.sh b/OpenCore-Boot.sh index e027851..30b05b9 100755 --- a/OpenCore-Boot.sh +++ b/OpenCore-Boot.sh @@ -13,7 +13,7 @@ # NOTE: Tweak the "MY_OPTIONS" line in case you are having booting problems! ############################################################################### # -# Change `Penryn` to `Haswell-noTSX` in OpenCore-Boot.sh file for macOS Sonoma! +# Change `Haswell-noTSX` to `Penryn` in OpenCore-Boot.sh file for macOS Ventura and older versions! # ############################################################################### @@ -23,7 +23,7 @@ MY_OPTIONS="+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check" # This script works for Big Sur, Catalina, Mojave, and High Sierra. Tested with # macOS 10.15.6, macOS 10.14.6, and macOS 10.13.6. -ALLOCATED_RAM="4096" # MiB +ALLOCATED_RAM="12288" # MiB CPU_SOCKETS="1" CPU_CORES="2" CPU_THREADS="4" @@ -33,7 +33,12 @@ OVMF_DIR="." # shellcheck disable=SC2054 args=( - -enable-kvm -m "$ALLOCATED_RAM" -cpu Penryn,kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,"$MY_OPTIONS" + -enable-kvm -m "$ALLOCATED_RAM" + + # Set the CPU model and options + # Use Haswell-noTSX for Sonoma and Penryn for older versions + -cpu Haswell-noTSX,kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,"$MY_OPTIONS" + -machine q35 -device qemu-xhci,id=xhci -device usb-kbd,bus=xhci.0 -device usb-tablet,bus=xhci.0 @@ -53,9 +58,12 @@ args=( -device ich9-intel-hda -device hda-duplex -device ich9-ahci,id=sata -drive id=OpenCoreBoot,if=none,snapshot=on,format=qcow2,file="$REPO_PATH/OpenCore/OpenCore.qcow2" - -device ide-hd,bus=sata.2,drive=OpenCoreBoot + -device ide-hd,bus=sata.2,drive=OpenCoreBoot,bootindex=1 + + # **IMPORTANT:** Make sure to comment out the following two lines after macOS installation -device ide-hd,bus=sata.3,drive=InstallMedia -drive id=InstallMedia,if=none,file="$REPO_PATH/BaseSystem.img",format=raw + -drive id=MacHDD,if=none,file="$REPO_PATH/mac_hdd_ng.img",format=qcow2 -device ide-hd,bus=sata.4,drive=MacHDD # -netdev tap,id=net0,ifname=tap0,script=no,downscript=no -device virtio-net-pci,netdev=net0,id=net0,mac=52:54:00:c9:18:27 diff --git a/OpenCore/Boot-NoUI/config.plist b/OpenCore/Boot-NoUI/config.plist new file mode 100755 index 0000000..1f218ea --- /dev/null +++ b/OpenCore/Boot-NoUI/config.plist @@ -0,0 +1,1940 @@ + + + + + ACPI + + Add + + + Comment + My custom DSDT + Enabled + + Path + DSDT.aml + + + Comment + My custom SSDT + Enabled + + Path + SSDT-1.aml + + + Comment + Read the comment in dsl sample + Enabled + + Path + SSDT-ALS0.aml + + + Comment + Read the comment in dsl sample + Enabled + + Path + SSDT-AWAC-DISABLE.aml + + + Comment + Read the comment in dsl sample + Enabled + + Path + SSDT-BRG0.aml + + + Comment + Read the comment in dsl sample + Enabled + + Path + SSDT-EC-USBX.aml + + + Comment + Fake EC and USBX Power + Enabled + + Path + SSDT-EC.aml + + + Comment + Read the comment in dsl sample + Enabled + + Path + SSDT-EHCx-DISABLE.aml + + + Comment + Read the comment in dsl sample + Enabled + + Path + SSDT-IMEI.aml + + + Comment + CPU AGPM Plugin=1 + Enabled + + Path + SSDT-PLUG.aml + + + Comment + Read the comment in dsl sample + Enabled + + Path + SSDT-PMC.aml + + + Comment + Read the comment in dsl sample + Enabled + + Path + SSDT-PNLF.aml + + + Comment + Read the comment in dsl sample + Enabled + + Path + SSDT-RTC0-RANGE.aml + + + Comment + Read the comment in dsl sample + Enabled + + Path + SSDT-RTC0.aml + + + Comment + Read the comment in dsl sample + Enabled + + Path + SSDT-SBUS-MCHC.aml + + + Comment + Read the comment in dsl sample + Enabled + + Path + SSDT-UNC.aml + + + Comment + add DTGP method + Enabled + + Path + SSDT-DTGP.aml + + + Comment + USB 2.0 Injection + Enabled + + Path + SSDT-EHCI.aml + + + Delete + + + All + + Comment + Delete CpuPm + Enabled + + OemTableId + + Q3B1UG0AAAA= + + TableLength + 0 + TableSignature + + U1NEVA== + + + + All + + Comment + Delete Cpu0Ist + Enabled + + OemTableId + + Q3B1MElzdAA= + + TableLength + 0 + TableSignature + + U1NEVA== + + + + Patch + + + Base + + BaseSkip + 0 + Comment + Replace one byte sequence with another + Count + 0 + Enabled + + Find + + ESIzRA== + + Limit + 0 + Mask + + + OemTableId + + + Replace + + RDMiEQ== + + ReplaceMask + + + Skip + 0 + TableLength + 0 + TableSignature + + + + + Base + \_SB.PCI0.LPCB.HPET + BaseSkip + 0 + Comment + HPET _CRS to XCRS + Count + 1 + Enabled + + Find + + X0NSUw== + + Limit + 0 + Mask + + + OemTableId + + + Replace + + WENSUw== + + ReplaceMask + + + Skip + 0 + TableLength + 0 + TableSignature + + + + + Quirks + + FadtEnableReset + + NormalizeHeaders + + RebaseRegions + + ResetHwSig + + ResetLogoStatus + + SyncTableIds + + + + Booter + + MmioWhitelist + + Patch + + Quirks + + AllowRelocationBlock + + AvoidRuntimeDefrag + + DevirtualiseMmio + + DisableSingleUser + + DisableVariableWrite + + DiscardHibernateMap + + EnableSafeModeSlide + + EnableWriteUnprotector + + FixupAppleEfiImages + + ForceBooterSignature + + ForceExitBootServices + + ProtectMemoryRegions + + ProtectSecureBoot + + ProtectUefiServices + + ProvideCustomSlide + + ProvideMaxSlide + 0 + RebuildAppleMemoryMap + + ResizeAppleGpuBars + -1 + SetupVirtualMap + + SignalAppleOS + + SyncRuntimePermissions + + + + DeviceProperties + + Add + + PciRoot(0x1)/Pci(0x1F,0x0) + + compatible + pci8086,2916 + device-id + + FikA + + name + pci8086,2916 + + + Delete + + + Kernel + + Add + + + Arch + Any + BundlePath + Lilu.kext + Comment + Patch engine + Enabled + + ExecutablePath + Contents/MacOS/Lilu + MaxKernel + + MinKernel + 8.0.0 + PlistPath + Contents/Info.plist + + + Arch + Any + BundlePath + VirtualSMC.kext + Comment + SMC emulator + Enabled + + ExecutablePath + Contents/MacOS/VirtualSMC + MaxKernel + + MinKernel + 8.0.0 + PlistPath + Contents/Info.plist + + + Arch + x86_64 + BundlePath + WhateverGreen.kext + Comment + Video patches + Enabled + + ExecutablePath + Contents/MacOS/WhateverGreen + MaxKernel + + MinKernel + 10.0.0 + PlistPath + Contents/Info.plist + + + Arch + Any + BundlePath + AppleALC.kext + Comment + Audio patches + Enabled + + ExecutablePath + Contents/MacOS/AppleALC + MaxKernel + + MinKernel + 8.0.0 + PlistPath + Contents/Info.plist + + + Arch + x86_64 + BundlePath + IntelMausi.kext + Comment + Intel Ethernet LAN + Enabled + + ExecutablePath + Contents/MacOS/IntelMausi + MaxKernel + + MinKernel + 13.0.0 + PlistPath + Contents/Info.plist + + + Arch + x86_64 + BundlePath + Legacy_USB3.kext + Comment + XHC ports configuration + Enabled + + ExecutablePath + + MaxKernel + + MinKernel + 15.0.0 + PlistPath + Contents/Info.plist + + + Arch + x86_64 + BundlePath + MCEReporterDisabler.kext + Comment + AppleMCEReporter disabler + Enabled + + ExecutablePath + + MaxKernel + + MinKernel + 19.0.0 + PlistPath + Contents/Info.plist + + + Arch + x86_64 + BundlePath + VoodooPS2Controller.kext + Comment + + Enabled + + ExecutablePath + Contents/MacOS/VoodooPS2Controller + MaxKernel + + MinKernel + 15.0.0 + PlistPath + Contents/Info.plist + + + Arch + x86_64 + BundlePath + VoodooPS2Controller.kext/Contents/PlugIns/VoodooPS2Keyboard.kext + Comment + + Enabled + + ExecutablePath + Contents/MacOS/VoodooPS2Keyboard + MaxKernel + + MinKernel + 15.0.0 + PlistPath + Contents/Info.plist + + + Arch + x86_64 + BundlePath + VoodooPS2Controller.kext/Contents/PlugIns/VoodooPS2Mouse.kext + Comment + + Enabled + + ExecutablePath + Contents/MacOS/VoodooPS2Mouse + MaxKernel + + MinKernel + 15.0.0 + PlistPath + Contents/Info.plist + + + Arch + x86_64 + BundlePath + VoodooPS2Controller.kext/Contents/PlugIns/VoodooPS2Trackpad.kext + Comment + + Enabled + + ExecutablePath + Contents/MacOS/VoodooPS2Trackpad + MaxKernel + + MinKernel + 15.0.0 + PlistPath + Contents/Info.plist + + + Arch + x86_64 + BundlePath + VoodooPS2Controller.kext/Contents/PlugIns/VoodooInput.kext + Comment + + Enabled + + ExecutablePath + Contents/MacOS/VoodooInput + MaxKernel + + MinKernel + 15.0.0 + PlistPath + Contents/Info.plist + + + Arch + x86_64 + BundlePath + USBPorts.kext + Comment + + Enabled + + ExecutablePath + + MaxKernel + + MinKernel + + PlistPath + Contents/Info.plist + + + Arch + x86_64 + BundlePath + AGPMInjector.kext + Comment + + Enabled + + ExecutablePath + + MaxKernel + + MinKernel + + PlistPath + Contents/Info.plist + + + Arch + x86_64 + BundlePath + BrcmFirmwareData.kext + Comment + Bluetooth firmware + Enabled + + ExecutablePath + Contents/MacOS/BrcmFirmwareData + MaxKernel + + MinKernel + + PlistPath + Contents/Info.plist + + + Arch + x86_64 + BundlePath + BrcmNonPatchRAM2.kext + Comment + Bluetooth support for macOS 10.11-10.14 + Enabled + + ExecutablePath + Contents/MacOS/BrcmNonPatchRAM2 + MaxKernel + 18.99.99 + MinKernel + 15.0.0 + PlistPath + Contents/Info.plist + + + Arch + x86_64 + BundlePath + BrcmPatchRAM2.kext + Comment + Bluetooth support for macOS 10.11-10.14 + Enabled + + ExecutablePath + Contents/MacOS/BrcmPatchRAM2 + MaxKernel + 18.99.99 + MinKernel + 15.0.0 + PlistPath + Contents/Info.plist + + + Arch + x86_64 + BundlePath + BrcmPatchRAM3.kext + Comment + Bluetooth support for macOS 10.15- + Enabled + + ExecutablePath + Contents/MacOS/BrcmPatchRAM3 + MaxKernel + + MinKernel + 19.0.0 + PlistPath + Contents/Info.plist + + + Arch + x86_64 + BundlePath + BrcmBluetoothInjector.kext + Comment + Bluetooth support for macOS 10.15-11 + Enabled + + ExecutablePath + + MaxKernel + 20.99.99 + MinKernel + 19.0.0 + PlistPath + Contents/Info.plist + + + Arch + x86_64 + BundlePath + BlueToolFixup.kext + Comment + Bluetooth support for macOS 12- + Enabled + + ExecutablePath + Contents/MacOS/BlueToolFixup + MaxKernel + + MinKernel + 21.0.0 + PlistPath + Contents/Info.plist + + + Arch + x86_64 + BundlePath + CryptexFixup.kext + Comment + Support for non-AVX2 CPUs in Ventura/Sonoma + Enabled + + ExecutablePath + Contents/MacOS/CryptexFixup + MaxKernel + 23.99.99 + MinKernel + 22.1.0 + PlistPath + Contents/Info.plist + + + Block + + + Arch + Any + Comment + + Enabled + + Identifier + com.apple.driver.AppleTyMCEDriver + MaxKernel + + MinKernel + + Strategy + Disable + + + Emulate + + Cpuid1Data + + VAYFAAAAAAAAAAAAAAAAAA== + + Cpuid1Mask + + ////AAAAAAAAAAAAAAAAAA== + + DummyPowerManagement + + MaxKernel + + MinKernel + + + Force + + + Arch + Any + BundlePath + System/Library/Extensions/IONetworkingFamily.kext + Comment + + Enabled + + ExecutablePath + Contents/MacOS/IONetworkingFamily + Identifier + com.apple.iokit.IONetworkingFamily + MaxKernel + 13.99.99 + MinKernel + + PlistPath + Contents/Info.plist + + + Patch + + + Arch + x86_64 + Base + + Comment + algrey - cpuid_set_cpufamily - force CPUFAMILY_INTEL_PENRYN + Count + 1 + Enabled + + Find + + MduAPQAAAAAGdQA= + + Identifier + kernel + Limit + 0 + Mask + + /////wAAAP///wA= + + MaxKernel + 20.3.99 + MinKernel + 17.0.0 + Replace + + u7xP6njpXQAAAJA= + + ReplaceMask + + + Skip + 0 + + + Arch + x86_64 + Base + + Comment + algrey - thenickdude - cpuid_set_cpufamily - force CPUFAMILY_INTEL_PENRYN (Big Sur 11.3+, Monterey, Ventura, Sonoma) + Count + 1 + Enabled + + Find + + MdKzAYA9AAAAAAZ1 + + Identifier + kernel + Limit + 0 + Mask + + ////////AAAAAP// + + MaxKernel + 23.99.99 + MinKernel + 20.4.0 + Replace + + urxP6nizAJCQkJDr + + ReplaceMask + + + Skip + 0 + + + Arch + x86_64 + Base + _early_random + Comment + SurPlus v1 - PART 1 of 2 - Patch read_erandom (inlined in _early_random) + Count + 1 + Enabled + + Find + + AHQjSIs= + + Identifier + kernel + Limit + 800 + Mask + + + MaxKernel + 21.1.0 + MinKernel + 20.4.0 + Replace + + AOsjSIs= + + ReplaceMask + + + Skip + 0 + + + Arch + x86_64 + Base + _register_and_init_prng + Comment + SurPlus v1 - PART 2 of 2 - Patch register_and_init_prng + Count + 1 + Enabled + + Find + + ukgBAAAx9g== + + Identifier + kernel + Limit + 256 + Mask + + + MaxKernel + 21.1.0 + MinKernel + 20.4.0 + Replace + + ukgBAADrBQ== + + ReplaceMask + + + Skip + 0 + + + Arch + x86_64 + Base + _apfs_filevault_allowed + Comment + Force FileVault on Broken Seal (from OCLP project, for non-AVX2 Ventura/Sonoma) + Count + 0 + Enabled + + Find + + + Identifier + com.apple.filesystems.apfs + Limit + 0 + Mask + + + MaxKernel + 23.99.99 + MinKernel + 22.1.0 + Replace + + uAEAAADD + + ReplaceMask + + + Skip + 0 + + + Quirks + + AppleCpuPmCfgLock + + AppleXcpmCfgLock + + AppleXcpmExtraMsrs + + AppleXcpmForceBoost + + CustomPciSerialDevice + + CustomSMBIOSGuid + + DisableIoMapper + + DisableIoMapperMapping + + DisableLinkeditJettison + + DisableRtcChecksum + + ExtendBTFeatureFlags + + ExternalDiskIcons + + ForceAquantiaEthernet + + ForceSecureBootScheme + + IncreasePciBarSize + + LapicKernelPanic + + LegacyCommpage + + PanicNoKextDump + + PowerTimeoutKernelPanic + + ProvideCurrentCpuInfo + + SetApfsTrimTimeout + 0 + ThirdPartyDrives + + XhciPortLimit + + + Scheme + + CustomKernel + + FuzzyMatch + + KernelArch + Auto + KernelCache + Auto + + + Misc + + BlessOverride + + Boot + + ConsoleAttributes + 0 + HibernateMode + Auto + HibernateSkipsPicker + + HideAuxiliary + + InstanceIdentifier + + LauncherOption + Disabled + LauncherPath + Default + PickerAttributes + 64 + PickerAudioAssist + + PickerMode + External + PickerVariant + Auto + PollAppleHotKeys + + ShowPicker + + TakeoffDelay + 0 + Timeout + 45 + + Debug + + AppleDebug + + ApplePanic + + DisableWatchDog + + DisplayDelay + 0 + DisplayLevel + 0 + LogModules + * + SysReport + + Target + 0 + + Entries + + Security + + AllowSetDefault + + ApECID + 0 + AuthRestart + + BlacklistAppleUpdate + + DmgLoading + Signed + EnablePassword + + ExposeSensitiveData + 6 + HaltLevel + 2147483648 + PasswordHash + + + PasswordSalt + + + ScanPolicy + 257 + SecureBootModel + Disabled + Vault + Optional + + Serial + + Init + + Override + + + Tools + + + Arguments + + Auxiliary + + Comment + Not signed for security reasons + Enabled + + Flavour + OpenShell:UEFIShell:Shell + FullNvramAccess + + Name + UEFI Shell + Path + Shell.efi + RealPath + + TextMode + + + + Arguments + + Auxiliary + + Comment + Memory testing utility + Enabled + + Flavour + MemTest + FullNvramAccess + + Name + memtest86 + Path + memtest86/BOOTX64.efi + RealPath + + TextMode + + + + Arguments + Shutdown + Auxiliary + + Comment + Perform shutdown + Enabled + + Flavour + Auto + FullNvramAccess + + Name + Shutdown + Path + ResetSystem.efi + RealPath + + TextMode + + + + + NVRAM + + Add + + 4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14 + + DefaultBackgroundColor + + AAAAAA== + + + 4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102 + + rtc-blacklist + + + + 7C436110-AB2A-4BBB-A880-FE41995C9F82 + + #INFO (prev-lang:kbd) + en:252 (ABC), set 656e3a323532 + ForceDisplayRotationInEFI + 0 + SystemAudioVolume + + Rg== + + boot-args + keepsyms=1 amfi_get_out_of_my_way=1 tlbto_us=0 vti=9 + csr-active-config + + Jg8= + + prev-lang:kbd + + ZW4tVVM6MA== + + run-efi-updater + No + + + Delete + + 4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14 + + DefaultBackgroundColor + + 4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102 + + rtc-blacklist + + 7C436110-AB2A-4BBB-A880-FE41995C9F82 + + boot-args + ForceDisplayRotationInEFI + + + LegacyOverwrite + + LegacySchema + + 7C436110-AB2A-4BBB-A880-FE41995C9F82 + + EFILoginHiDPI + EFIBluetoothDelay + LocationServicesEnabled + SystemAudioVolume + SystemAudioVolumeDB + SystemAudioVolumeSaved + bluetoothActiveControllerInfo + bluetoothInternalControllerInfo + flagstate + fmm-computer-name + fmm-mobileme-token-FMM + fmm-mobileme-token-FMM-BridgeHasAccount + nvda_drv + prev-lang:kbd + backlight-level + BootCampHD + + 8BE4DF61-93CA-11D2-AA0D-00E098032B8C + + Boot0080 + Boot0081 + Boot0082 + BootNext + BootOrder + + + WriteFlash + + + PlatformInfo + + Automatic + + CustomMemory + + Generic + + AdviseFeatures + + MLB + C02119700QXJG36JC + ProcessorType + 0 + ROM + 0022412e3d4a + SpoofVendor + + SystemMemoryStatus + Auto + SystemProductName + iMacPro1,1 + SystemSerialNumber + C02FPBZPHX87 + SystemUUID + 213FA768-A62C-4299-8598-47AA666E436F + + UpdateDataHub + + UpdateNVRAM + + UpdateSMBIOS + + UpdateSMBIOSMode + Create + UseRawUuidEncoding + + + UEFI + + APFS + + EnableJumpstart + + GlobalConnect + + HideVerbose + + JumpstartHotPlug + + MinDate + -1 + MinVersion + -1 + + AppleInput + + AppleEvent + Builtin + CustomDelays + + GraphicsInputMirroring + + KeyInitialDelay + 50 + KeySubsequentDelay + 5 + PointerDwellClickTimeout + 0 + PointerDwellDoubleClickTimeout + 0 + PointerDwellRadius + 0 + PointerPollMask + -1 + PointerPollMax + 80 + PointerPollMin + 10 + PointerSpeedDiv + 1 + PointerSpeedMul + 1 + + Audio + + AudioCodec + 0 + AudioDevice + + AudioOutMask + 1 + AudioSupport + + DisconnectHda + + MaximumGain + -15 + MinimumAssistGain + -30 + MinimumAudibleGain + -55 + PlayChime + Auto + ResetTrafficClass + + SetupDelay + 0 + + ConnectDrivers + + Drivers + + + Arguments + + Comment + + Enabled + + LoadEarly + + Path + OpenVariableRuntimeDxe.efi + + + Arguments + + Comment + + Enabled + + LoadEarly + + Path + OpenRuntime.efi + + + Arguments + + Comment + HFS+ Driver + Enabled + + LoadEarly + + Path + OpenHfsPlus.efi + + + Arguments + + Comment + + Enabled + + LoadEarly + + Path + OpenCanopy.efi + + + Arguments + + Comment + + Enabled + + LoadEarly + + Path + AudioDxe.efi + + + Arguments + + Comment + + Enabled + + LoadEarly + + Path + OpenPartitionDxe.efi + + + Arguments + + Comment + + Enabled + + LoadEarly + + Path + OpenUsbKbDxe.efi + + + Arguments + + Comment + + Enabled + + LoadEarly + + Path + UsbMouseDxe.efi + + + Arguments + + Comment + + Enabled + + LoadEarly + + Path + Ps2KeyboardDxe.efi + + + Arguments + + Comment + + Enabled + + LoadEarly + + Path + Ps2MouseDxe.efi + + + Arguments + + Comment + + Enabled + + LoadEarly + + Path + HiiDatabase.efi + + + Arguments + + Comment + + Enabled + + LoadEarly + + Path + NvmExpressDxe.efi + + + Arguments + + Comment + + Enabled + + LoadEarly + + Path + XhciDxe.efi + + + Arguments + + Comment + + Enabled + + LoadEarly + + Path + ExFatDxe.efi + + + Arguments + + Comment + + Enabled + + LoadEarly + + Path + CrScreenshotDxe.efi + + + Arguments + + Comment + + Enabled + + LoadEarly + + Path + Ext4Dxe.efi + + + Arguments + + Comment + + Enabled + + LoadEarly + + Path + DpcDxe.efi + + + Arguments + + Comment + + Enabled + + LoadEarly + + Path + SnpDxe.efi + + + Arguments + + Comment + + Enabled + + LoadEarly + + Path + MnpDxe.efi + + + Arguments + + Comment + + Enabled + + LoadEarly + + Path + ArpDxe.efi + + + Arguments + + Comment + + Enabled + + LoadEarly + + Path + Dhcp4Dxe.efi + + + Arguments + + Comment + + Enabled + + LoadEarly + + Path + Ip4Dxe.efi + + + Arguments + + Comment + + Enabled + + LoadEarly + + Path + Udp4Dxe.efi + + + Arguments + + Comment + + Enabled + + LoadEarly + + Path + TcpDxe.efi + + + Arguments + + Comment + + Enabled + + LoadEarly + + Path + DnsDxe.efi + + + Arguments + + Comment + + Enabled + + LoadEarly + + Path + HttpDxe.efi + + + Arguments + + Comment + + Enabled + + LoadEarly + + Path + HttpUtilitiesDxe.efi + + + Arguments + + Comment + + Enabled + + LoadEarly + + Path + HttpBootDxe.efi + + + Arguments + + Comment + + Enabled + + LoadEarly + + Path + OpenLinuxBoot.efi + + + Arguments + + Comment + + Enabled + + LoadEarly + + Path + ResetNvramEntry.efi + + + Arguments + + Comment + + Enabled + + LoadEarly + + Path + ToggleSipEntry.efi + + + Arguments + + Comment + + Enabled + + LoadEarly + + Path + FirmwareSettingsEntry.efi + + + Input + + KeyFiltering + + KeyForgetThreshold + 5 + KeySupport + + KeySupportMode + Auto + KeySwap + + PointerSupport + + PointerSupportMode + ASUS + TimerResolution + 50000 + + Output + + ClearScreenOnModeSwitch + + ConsoleFont + + ConsoleMode + + DirectGopRendering + + ForceResolution + + GopBurstMode + + GopPassThrough + Disabled + IgnoreTextInGraphics + + InitialMode + Auto + ProvideConsoleGop + + ReconnectGraphicsOnConnect + + ReconnectOnResChange + + ReplaceTabWithSpace + + Resolution + 1920x1080@32 + SanitiseClearScreen + + TextRenderer + BuiltinGraphics + UIScale + 0 + UgaPassThrough + + + ProtocolOverrides + + AppleAudio + + AppleBootPolicy + + AppleDebugLog + + AppleEg2Info + + AppleFramebufferInfo + + AppleImageConversion + + AppleImg4Verification + + AppleKeyMap + + AppleRtcRam + + AppleSecureBoot + + AppleSmcIo + + AppleUserInterfaceTheme + + DataHub + + DeviceProperties + + FirmwareVolume + + HashServices + + OSInfo + + PciIo + + UnicodeCollation + + + Quirks + + ActivateHpetSupport + + DisableSecurityPolicy + + EnableVectorAcceleration + + EnableVmx + + ExitBootServicesDelay + 0 + ForceOcWriteFlash + + ForgeUefiSupport + + IgnoreInvalidFlexRatio + + ReleaseUsbOwnership + + ReloadOptionRoms + + RequestBootVarRouting + + ResizeGpuBars + -1 + ResizeUsePciRbIo + + ShimRetainProtocol + + TscSyncTimeout + 0 + UnblockFsConnect + + + ReservedMemory + + + + diff --git a/README-NoUI.md b/README-NoUI.md new file mode 100644 index 0000000..49b0e8c --- /dev/null +++ b/README-NoUI.md @@ -0,0 +1,106 @@ +## Setup Instructions - SSH iOS Development Environment + +### Step 1: Clone the Repository + +Clone this repository to your local machine and navigate to the repository root. + +### Step 2: Follow Initial Setup Instructions + +Follow the steps in the [README.md](README.md) file to set up the environment and install macOS (Sonoma). + +### Step 3: Initial VM Boot + +Start the VM for the first time with the GUI to complete the initial macOS setup: + +```bash +./OpenCore-Boot.sh +``` + +Complete the macOS setup and install XCode and other GUI-dependent tools. + +**Note:** Active SSH on macOS `System Preferences > Sharing > Remote Login`. + +### Step 4: Install XCode and Generate Unique Serial + +If you need to install XCode, you'll need a unique serial number. Complete steps 1-5 below and start `./OpenCore-Boot.sh` again to connect to your Apple account, install XCode, and other tools. + +1. Navigate or clone GenSMBIOS repository into workspace: + + ```bash + git clone https://github.com/corpnewt/GenSMBIOS.git + cd GenSMBIOS + ``` + +2. Make `GenSMBIOS.command` executable and run it: + + ```bash + chmod +x GenSMBIOS.command + ./GenSMBIOS.command + ``` + +3. Install/Update MacSerial. +4. Select `$osx_kvm_path/OpenCore/Boot-NoUI/config.plist` as the configuration file. +5. Generate SMBIOS for `iMacPro1,1`. +6. Generate UUID. + +### Step 5: Generate OpenCore Image with NoUI Configuration + +```bash +# Update submodule +git submodule update --init --recursive ./resources/OcBinaryData + +cd ./OpenCore + +# Generate OpenCore image with NoUI configuration +rm -f OpenCore.qcow2; sudo ./opencore-image-ng.sh --cfg ./Boot-NoUI/config.plist --img OpenCore.qcow2 +``` + +### Step 6: Start OpenCore VM with NoUI Configuration + +```bash +# Navigate to repository root +cd $osx_kvm_path +# cd .. + +# Make the shell script executable +chmod +x ./OpenCore-Boot-NoUI.sh + +./OpenCore-Boot-NoUI.sh +``` + +### Step 7: Connect to macOS VM with SSH + +```bash +ssh -p 2222 $user_name@localhost +``` + +### Step 8: Map Port 22 to 2222 and Open Firewall + +```bash +# Map port 22 to 2222 +sudo iptables -t nat -A PREROUTING -p tcp --dport 22 -j REDIRECT --to-port 2222 + +# Open firewall +sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT +``` + +### Step 9: Connect from Any Device on the Network to the VM + +```bash +ssh $user_name@$vm_host_ip +``` + +### Step 10: Shutdown the VM + +```bash +# (run on mac via SSH) +sudo shutdown -h now +``` + +## Additional Notes + +I personally use Nix flakes to manage the environment, so I can install all the required tools with `nix develop` and run the scripts from there. (The Nix package manager does not support XCode, so you need to install it manually first.) + +Additionally, I use GitHub to store my credentials, which allows me to just copy the `.gitconfig` and `.git-credentials` to the user home directory on the VM. + +To debug iOS apps, it's easiest to use XCode Wi-Fi debugging, so you don't need to connect the phone to the VM. diff --git a/fetch-macOS-v2.py b/fetch-macOS-v2.py index 250a63f..ac69e5b 100755 --- a/fetch-macOS-v2.py +++ b/fetch-macOS-v2.py @@ -529,8 +529,8 @@ def main(): {"name": "Catalina (10.15)", "b": "Mac-00BE6ED71E35EB86", "m": "00000000000000000", "short": "catalina"}, {"name": "Big Sur (11.7)", "b": "Mac-2BD1B31983FE1663", "m": "00000000000000000", "short": "big-sur"}, {"name": "Monterey (12.6)", "b": "Mac-B809C3757DA9BB8D", "m": "00000000000000000", "os_type": "latest", "short": "monterey"}, - {"name": "Ventura (13) - RECOMMENDED", "b": "Mac-4B682C642B45593E", "m": "00000000000000000", "os_type": "latest", "short": "ventura"}, - {"name": "Sonoma (14) ", "b": "Mac-A61BADE1FDAD7B05", "m": "00000000000000000", "short": "sonoma"} + {"name": "Ventura (13)", "b": "Mac-4B682C642B45593E", "m": "00000000000000000", "os_type": "latest", "short": "ventura"}, + {"name": "Sonoma (14) - RECOMMENDED", "b": "Mac-A61BADE1FDAD7B05", "m": "00000000000000000", "short": "sonoma"} ] for index, product in enumerate(products): name = product["name"] From 08e95d85801f9666ad1a3c820b80c17abe600e87 Mon Sep 17 00:00:00 2001 From: Steffen70 Date: Thu, 13 Jun 2024 13:01:08 +0200 Subject: [PATCH 2/3] Reduced ram to 8GB and added additional notes. --- OpenCore-Boot-NoUI.sh | 2 +- OpenCore-Boot.sh | 2 +- README-NoUI.md | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/OpenCore-Boot-NoUI.sh b/OpenCore-Boot-NoUI.sh index 26320c1..f3c93d7 100755 --- a/OpenCore-Boot-NoUI.sh +++ b/OpenCore-Boot-NoUI.sh @@ -2,7 +2,7 @@ MY_OPTIONS="+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check" -ALLOCATED_RAM="12288" # MiB +ALLOCATED_RAM="8192" # MiB CPU_SOCKETS="1" CPU_CORES="2" CPU_THREADS="4" diff --git a/OpenCore-Boot.sh b/OpenCore-Boot.sh index 30b05b9..58226d6 100755 --- a/OpenCore-Boot.sh +++ b/OpenCore-Boot.sh @@ -23,7 +23,7 @@ MY_OPTIONS="+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check" # This script works for Big Sur, Catalina, Mojave, and High Sierra. Tested with # macOS 10.15.6, macOS 10.14.6, and macOS 10.13.6. -ALLOCATED_RAM="12288" # MiB +ALLOCATED_RAM="8192" # MiB CPU_SOCKETS="1" CPU_CORES="2" CPU_THREADS="4" diff --git a/README-NoUI.md b/README-NoUI.md index 49b0e8c..f013f68 100644 --- a/README-NoUI.md +++ b/README-NoUI.md @@ -99,6 +99,8 @@ sudo shutdown -h now ## Additional Notes +When you use the VSCode Remote SSH extension, you will disconnect from the VM as soon as the VM enters sleep mode. To prevent this, you can enable automatic login and disable lock screen in the macOS settings. This way, the user will be logged in automatically when the VM starts and won't enter sleep mode. + I personally use Nix flakes to manage the environment, so I can install all the required tools with `nix develop` and run the scripts from there. (The Nix package manager does not support XCode, so you need to install it manually first.) Additionally, I use GitHub to store my credentials, which allows me to just copy the `.gitconfig` and `.git-credentials` to the user home directory on the VM. From 2bcec7346e8f807ec32b941bc95e5e98f4076dde Mon Sep 17 00:00:00 2001 From: Steffen70 Date: Fri, 14 Jun 2024 10:24:45 +0200 Subject: [PATCH 3/3] Added headless_opencore.service for background VM startup. --- .gitignore | 1 + OpenCore/{Boot-NoUI => headless}/config.plist | 10 +-- README.md | 7 +- boot-macOS-headless.sh | 72 ------------------- OpenCore-Boot-NoUI.sh => headless_boot.sh | 17 ++++- headless_opencore.service | 12 ++++ README-NoUI.md => headless_readme.md | 39 ++++++++-- headless_service_install.sh | 16 +++++ 8 files changed, 85 insertions(+), 89 deletions(-) rename OpenCore/{Boot-NoUI => headless}/config.plist (99%) delete mode 100755 boot-macOS-headless.sh rename OpenCore-Boot-NoUI.sh => headless_boot.sh (71%) create mode 100644 headless_opencore.service rename README-NoUI.md => headless_readme.md (75%) create mode 100755 headless_service_install.sh diff --git a/.gitignore b/.gitignore index c154cea..1214c67 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ *.sucatalog OVMF_VARS*.fd OpenCore-Catalina/EFI/OC/Resources/ +*log.txt diff --git a/OpenCore/Boot-NoUI/config.plist b/OpenCore/headless/config.plist similarity index 99% rename from OpenCore/Boot-NoUI/config.plist rename to OpenCore/headless/config.plist index 1f218ea..d6f34da 100755 --- a/OpenCore/Boot-NoUI/config.plist +++ b/OpenCore/headless/config.plist @@ -1312,11 +1312,13 @@ AdviseFeatures MLB - C02119700QXJG36JC + C02731301GUJG36JC ProcessorType 0 ROM - 0022412e3d4a + + 9PFai1o+ + SpoofVendor SystemMemoryStatus @@ -1324,9 +1326,9 @@ SystemProductName iMacPro1,1 SystemSerialNumber - C02FPBZPHX87 + C02V5SYMHX87 SystemUUID - 213FA768-A62C-4299-8598-47AA666E436F + DF0A0B37-D713-4408-BD6A-3F96139F8597 UpdateDataHub diff --git a/README.md b/README.md index 72a4508..4099b50 100644 --- a/README.md +++ b/README.md @@ -209,12 +209,7 @@ processors work just fine (even for macOS Sonoma). ### Headless macOS -- Use the provided [boot-macOS-headless.sh](./boot-macOS-headless.sh) script. - - ``` - ./boot-macOS-headless.sh - ``` - +You can follow the instructions in the `headless_readme.md` file to run the macOS VM in a headless mode. ### Setting Expectations Right diff --git a/boot-macOS-headless.sh b/boot-macOS-headless.sh deleted file mode 100755 index b5ce2e8..0000000 --- a/boot-macOS-headless.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env bash - -# Special thanks to: -# https://github.com/Leoyzen/KVM-Opencore -# https://github.com/thenickdude/KVM-Opencore/ -# https://github.com/qemu/qemu/blob/master/docs/usb2.txt -# -# qemu-img create -f qcow2 mac_hdd_ng.img 128G -# -# echo 1 | sudo tee -a /sys/module/kvm/parameters/ignore_msrs # this is required -# -# Usage: -# -# $ boot-macOS-headless.sh -# -# (qemu) change vnc password -# Password: ******** -# -# Note: Using RealVNC client, connect to ``. -# E.g. `vncviewer localhost:5901` - -############################################################################ -# NOTE: Tweak the "MY_OPTIONS" line in case you are having booting problems! -############################################################################ - -MY_OPTIONS="+ssse3,+sse4.2,+popcnt,+avx,+aes,+xsave,+xsaveopt,check" - -# This script works for Big Sur, Catalina, Mojave, and High Sierra. Tested with -# macOS 10.15.6, macOS 10.14.6, and macOS 10.13.6. - -ALLOCATED_RAM="7192" # MiB -CPU_SOCKETS="1" -CPU_CORES="2" -CPU_THREADS="4" - -REPO_PATH="." -OVMF_DIR="." - -# shellcheck disable=SC2054 -args=( - -enable-kvm -m "$ALLOCATED_RAM" -cpu Penryn,kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,"$MY_OPTIONS" - -machine q35 - -device qemu-xhci,id=xhci - -device usb-kbd,bus=xhci.0 -device usb-tablet,bus=xhci.0 - -smp "$CPU_THREADS",cores="$CPU_CORES",sockets="$CPU_SOCKETS" - -device usb-ehci,id=ehci - # -device usb-kbd,bus=ehci.0 - # -device usb-mouse,bus=ehci.0 - # -device nec-usb-xhci,id=xhci - # -global nec-usb-xhci.msi=off - -global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off - # -device usb-host,vendorid=0x8086,productid=0x0808 # 2 USD USB Sound Card - # -device usb-host,vendorid=0x1b3f,productid=0x2008 # Another 2 USD USB Sound Card - -device isa-applesmc,osk="ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc" - -drive if=pflash,format=raw,readonly=on,file="$REPO_PATH/$OVMF_DIR/OVMF_CODE.fd" - -drive if=pflash,format=raw,file="$REPO_PATH/$OVMF_DIR/OVMF_VARS-1920x1080.fd" - -smbios type=2 - -device ich9-ahci,id=sata - -drive id=OpenCoreBoot,if=none,snapshot=on,format=qcow2,file="$REPO_PATH/OpenCore/OpenCore.qcow2" - -device ide-hd,bus=sata.2,drive=OpenCoreBoot - -device ide-hd,bus=sata.3,drive=InstallMedia - -drive id=InstallMedia,if=none,file="$REPO_PATH/BaseSystem.img",format=raw - -drive id=MacHDD,if=none,file="$REPO_PATH/mac_hdd_ng.img",format=qcow2 - -device ide-hd,bus=sata.4,drive=MacHDD - -netdev user,id=net0,hostfwd=tcp::2222-:22 -device vmxnet3,netdev=net0,id=net0,mac=52:54:00:c9:18:27 - -monitor stdio - -device vmware-svga - -display none - -vnc 0.0.0.0:1,password=on -k en-us -) - -qemu-system-x86_64 "${args[@]}" diff --git a/OpenCore-Boot-NoUI.sh b/headless_boot.sh similarity index 71% rename from OpenCore-Boot-NoUI.sh rename to headless_boot.sh index f3c93d7..68f96ec 100755 --- a/OpenCore-Boot-NoUI.sh +++ b/headless_boot.sh @@ -7,7 +7,7 @@ CPU_SOCKETS="1" CPU_CORES="2" CPU_THREADS="4" -REPO_PATH="." +REPO_PATH=$(dirname "$(readlink -f "$0")") OVMF_DIR="." args=( @@ -42,9 +42,20 @@ args=( -device virtio-net-pci,netdev=net0,id=net0,mac=52:54:00:c9:18:27 # Disable the QEMU monitor interface and graphical output + # Comment out the following lines if you want to enable conectivity to the VM via VNC -monitor none -nographic + + # Uncomment the following lines if you want to enable conectivity to the VM via VNC + # -monitor stdio + # -device vmware-svga + # -display none + # -vnc 0.0.0.0:1,password=on -k en-us ) -# Start the QEMU virtual machine in the background and disown the process -qemu-system-x86_64 "${args[@]}" > /dev/null 2>&1 & disown +# Create log file for headless boot and clear it if it already exists +touch "$REPO_PATH/headless_boot_log.txt" +echo "" > "$REPO_PATH/headless_boot_log.txt" + +# Start the QEMU virtual machine and redirect the output to the log file +qemu-system-x86_64 "${args[@]}" > "$REPO_PATH/headless_boot_log.txt" 2>&1 & diff --git a/headless_opencore.service b/headless_opencore.service new file mode 100644 index 0000000..7329aad --- /dev/null +++ b/headless_opencore.service @@ -0,0 +1,12 @@ +[Unit] +Description=OpenCore VM +After=network.target + +[Service] +Type=forking +ExecStart=%repo_path%/headless_boot.sh +ExecStop=/usr/bin/pkill -f qemu-system-x86_64 +Restart=on-failure + +[Install] +WantedBy=multi-user.target diff --git a/README-NoUI.md b/headless_readme.md similarity index 75% rename from README-NoUI.md rename to headless_readme.md index f013f68..688d282 100644 --- a/README-NoUI.md +++ b/headless_readme.md @@ -24,6 +24,13 @@ Complete the macOS setup and install XCode and other GUI-dependent tools. If you need to install XCode, you'll need a unique serial number. Complete steps 1-5 below and start `./OpenCore-Boot.sh` again to connect to your Apple account, install XCode, and other tools. +```bash +# Download XCode from [Apple Developer](https://developer.apple.com/download/all/?q=xcode) +xip -x ~/Downloads/$xcode_version.xip -C /Applications + +xcode-select --install +``` + 1. Navigate or clone GenSMBIOS repository into workspace: ```bash @@ -39,7 +46,7 @@ If you need to install XCode, you'll need a unique serial number. Complete steps ``` 3. Install/Update MacSerial. -4. Select `$osx_kvm_path/OpenCore/Boot-NoUI/config.plist` as the configuration file. +4. Select `$osx_kvm_path/OpenCore/headless/config.plist` as the configuration file. 5. Generate SMBIOS for `iMacPro1,1`. 6. Generate UUID. @@ -52,7 +59,7 @@ git submodule update --init --recursive ./resources/OcBinaryData cd ./OpenCore # Generate OpenCore image with NoUI configuration -rm -f OpenCore.qcow2; sudo ./opencore-image-ng.sh --cfg ./Boot-NoUI/config.plist --img OpenCore.qcow2 +rm -f OpenCore.qcow2; sudo ./opencore-image-ng.sh --cfg ./headless/config.plist --img OpenCore.qcow2 ``` ### Step 6: Start OpenCore VM with NoUI Configuration @@ -63,9 +70,9 @@ cd $osx_kvm_path # cd .. # Make the shell script executable -chmod +x ./OpenCore-Boot-NoUI.sh +chmod +x ./headless_boot.sh -./OpenCore-Boot-NoUI.sh +./headless_boot.sh ``` ### Step 7: Connect to macOS VM with SSH @@ -106,3 +113,27 @@ I personally use Nix flakes to manage the environment, so I can install all the Additionally, I use GitHub to store my credentials, which allows me to just copy the `.gitconfig` and `.git-credentials` to the user home directory on the VM. To debug iOS apps, it's easiest to use XCode Wi-Fi debugging, so you don't need to connect the phone to the VM. + +### Install as a Service + +To install the VM as a service, you can run the `headless_service_install.sh` script. This script will install the VM as a service that starts on boot. + +```bash +chmod +x ./headless_service_install.sh + +./headless_service_install.sh +``` + +#### Uninstall Service + +Run the commands below to uninstall the service: + +```bash +sudo systemctl stop headless_opencore.service + +sudo systemctl disable headless_opencore.service + +sudo rm /etc/systemd/system/headless_opencore.service + +sudo systemctl daemon-reload +``` diff --git a/headless_service_install.sh b/headless_service_install.sh new file mode 100755 index 0000000..9c428f1 --- /dev/null +++ b/headless_service_install.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# Fetch script directory +REPO_PATH=$(dirname "$(readlink -f "$0")") + +# Replace %repo_path% in the service file with the actual path +sed -i "s|%repo_path%|$REPO_PATH|g" "$REPO_PATH/headless_opencore.service" + +# Copy the modified service file to /etc/systemd/system/ +sudo cp "$REPO_PATH/headless_opencore.service" /etc/systemd/system/ + +# Reload systemd daemon to apply the new service file +sudo systemctl daemon-reload + +# Enable the service to start on boot +sudo systemctl enable headless_opencore.service