ITGOIT - Wiki

pro-2011-a1286

Reviving a 2010/2011 15" MacBook Pro (A1286): Dead GPU Fix, OS Guide & Windows 11 UEFI + Audio Mod

Hardware Tested: MacBookPro8,2 (Late 2011)
Bottom Case Stamp: A1286 (may read © 2010)
Processor: Intel Core i7 (2.4 GHz)
Integrated GPU: Intel HD Graphics 3000
Dedicated GPU: AMD Radeon HD 6750M / 6770M
Memory Tested: 4 GB DDR3
Storage Tested: 750 GB HDD
UEFI Audio Codec: Cirrus Logic CS4206B

This guide covers how to revive, wipe, and install modern operating systems (macOS, Linux Mint, or Windows 10/11, including OpenCore dual-boot) on a 2010 or 2011 15-inch MacBook Pro (A1286) whether your dedicated AMD/Nvidia GPU is still working properly or has already failed.

Model Year Verification

Many 2011 A1286 MacBook Pros still have © 2010 Apple Inc. printed on the bottom case. Booting into macOS About This Mac confirms the true model year (MacBookPro6,2 for 2010; MacBookPro8,2 / 8,3 for 2011).

1. First Step: Is Your AMD GPU Healthy or Dead?

15-inch 2010 and 2011 MacBook Pros contain two graphics chips:

  1. A reliable Intel integrated GPU (Intel HD Graphics 3000 on 2011 models).
  2. A dedicated GPU (Nvidia GeForce GT 330M on 2010 models; AMD Radeon HD 6750M/6770M on 2011 models) that is notorious for solder/chip failure over time.

Before following any OS or driver steps, determine which group you belong to. Running Dead-GPU workarounds on a healthy Mac will unnecessarily disable your working Radeon graphics, while ignoring them on a failing Mac will cause boot freezes and crashes.

flowchart TD
  A["Power on your 2010/2011 15-inch MacBook Pro"] --> B{"Do you see horizontal red/green lines,<br/>glitches, or a solid white screen freeze<br/>around 50% boot progress?"}
  B -- "No, Boots cleanly & 3D works" --> C["Healthy / Working AMD GPU"]
  B -- "Yes, Red lines, freezes, or GPU panics" --> D["Dead / Unhealthy AMD GPU"]
  C --> E["Follow Chapter 2.1 (Healthy GPU)<br/>Keep AMD drivers enabled"]
  D --> F["Follow Chapter 2.2 (Dead GPU)<br/>Disable AMD GPU via NVRAM / OS"]

Healthy vs. Dead GPU Comparison

Check / Symptom Healthy GPU Working AMD Radeon Dead GPU Failing / Dead AMD Radeon
Apple Boot Screen Clean grey/black screen, no artifacts Horizontal red, green, or pink lines across the logo
Single-User Mode (Cmd+S) Crisp white text on black background Red/colored horizontal streaks even inside text mode
Boot Progress (~50%) Reaches the desktop normally Screen turns solid white/grey and hangs forever
External Monitor / Heavy 3D Stable under load Immediate distortion, black screen, or kernel panic
Display Panel Status Panel is fine Panel is fine (broken GPU sends bad signal)

Do NOT Bake or Heat-Gun Your Logic Board

Avoid "reflowing", heat-gunning, or oven-baking the motherboard. Heat only expands broken internal chip connections temporarily for days or weeks before failing again, and risks warping the board. Proper BGA chip replacement ($150–$300+) is rarely economical on a 15-year-old laptop, disabling a dead GPU in firmware/software is free and permanent while powered.

2. GPU Setup Guide (Choose Your Chapter)

2.1 Chapter A: Users with a Healthy / Working AMD GPU Healthy GPU

If your MacBook Pro boots cleanly without lines, artifacts, or white-screen freezes, your dedicated AMD Radeon GPU is healthy and you want to keep it active for full graphics acceleration and multi-monitor support.

What NOT to do on a Healthy-GPU Mac

What You Should Do Instead

Keep a Healthy AMD GPU Healthy

The 2011 AMD failure is accelerated by heat. Replace the dried 15-year-old thermal paste on the CPU and GPU dies, blow out the heatsink fins, and install a fan control utility (such as Macs Fan Control) to ramp fans up earlier under load.

2.2 Chapter B: Users with a Dead / Unhealthy AMD GPU Dead GPU

When macOS reaches ~50% on the progress bar and loads the full 3D AMD driver, the dying chip crashes and leaves a frozen white screen. To rescue the Mac, force it to use the healthy Intel HD Graphics 3000 integrated chip instead.

Step 1: Emergency macOS Rescue (NVRAM Bypass)

  1. Power off the MacBook completely (hold the Power button for 10 seconds).

  2. Press Power and immediately hold Cmd+S to enter Single-User Mode (text terminal).

  3. At the root# prompt (ignore any red lines on screen), type the following commands and press Enter after each:

    nvram fa4ce28d-b62f-4c99-9cc3-6815686e30f9:gpu-power-prefs=%01%00%00%00
    reboot
    

    (Alternative if needed on some 2010/2011 models: nvram GfxMode=4)

On reboot, the red lines should vanish and macOS should boot cleanly on Intel HD Graphics 3000.

Where gpu-power-prefs Is Stored

This setting lives on the motherboard's NVRAM chip, not on the hard drive. Formatting or replacing the SSD/HDD will not erase it. Only a PRAM/NVRAM reset (Cmd+Option+P+R) or a completely drained battery sitting uncharged for a long time will clear it.

Step 2: Lock Intel Mode Inside macOS High Sierra (Optional if keeping macOS)

To stop macOS from waking the broken AMD driver during normal use:

  1. Reboot holding Cmd+R to enter macOS Recovery, open Utilities → Terminal, and disable System Integrity Protection:

    csrutil disable
    reboot
    
  2. Back on the macOS desktop, open Terminal and move the AMD kext out of /System/Library/Extensions:

    sudo nvram fa4ce28d-b62f-4c99-9cc3-6815686e30f9:gpu-power-prefs=%01%00%00%00
    sudo mkdir -p /Library/DisabledKexts
    sudo mv /System/Library/Extensions/AMDRadeonX3000.kext /Library/DisabledKexts/
    sudo touch /System/Library/Extensions
    sudo kextcache -i /
    sudo reboot
    
  3. Open System Preferences → Energy Saver and set Computer Sleep to Never (waking from sleep often crashes dead-GPU 2011 Macs because the firmware tries to re-power the AMD chip).

3. Wiping a Used / Donated Mac Without the Password

Online High Sierra Recovery Usually Fails

Do not erase Macintosh HD in Recovery (Cmd+R) expecting "Reinstall macOS High Sierra" to download cleanly... Apple's 2017 High Sierra recovery servers frequently fail today with "The recovery server could not be contacted".

If you want to remove a previous owner's account cleanly while keeping the existing macOS installation intact:

  1. Power on holding Cmd+S to enter Single-User Mode.

  2. Mount the root filesystem as writable, delete .AppleSetupDone, and reboot:

    /sbin/mount -uw /
    rm /var/db/.AppleSetupDone
    reboot
    
  3. The Mac will launch Apple's out-of-box Setup Assistant. Create your own new Administrator account.

  4. Log into your new account, open System Preferences → Users & Groups, click the padlock to unlock, select the previous owner's account, click -, and choose "Delete the home folder".

(If you are wiping the entire Mac for Linux or Windows anyway, skip this chapter and delete all partitions during Linux/Windows installation.)

4. Choosing an Operating System (Real-World Verdict)

Newer macOS via OpenCore Legacy Patcher Legacy

  • macOS Monterey (12): Sweet Spot Runs stably and is the best macOS target for non-Metal Intel HD 3000 graphics.
  • macOS Sequoia (15.8.3 via OCLP 2.5.1): Installs and boots, but is very sluggish on 4 GB RAM + a spinning HDD (upgrading to an SSD and 8–16 GB RAM helps, though non-Metal UI/app limits still apply).
  • macOS Tahoe (26): Requires unstable pre-release OCLP 3.0.0 RC not recommended on this hardware.

GPU-Specific Notes

  • Healthy GPU: Both Intel HD 3000 and the AMD Radeon chip are patched by OCLP post-install root patches.
  • Dead GPU: Avoid PRAM resets (Cmd+Option+P+R) during troubleshooting, as they wipe gpu-power-prefs.

Common OCLP Gotchas

  • Prohibited symbol (🚫) after installing macOS: You rebooted without OpenCore installed to your internal drive's EFI partition. Boot from your OCLP USB (Option → EFI Boot), open OCLP, and run Build and Install OpenCore → Install to disk.
  • "Volume Hash Mismatch" notification: Harmless APFS snapshot warning in Monterey; safe to ignore.
  • "An error occurred preparing the software update" loop: Keep rebooting into macOS Installer via OpenCore (Option → EFI Boot) 2–4 times, or erase the drive to ExFAT → quit Disk Utility → reopen and erase to APFS before reinstalling.
  • White desktop wallpaper after install/upgrade: Graphics acceleration isn't patched yet. Open OCLP → Post-Install Root Patch → Start Root Patching (and switch away from animated wallpapers to a static image).

Linux Mint runs smoothly out of the box, including built-in speakers, headphone jack, trackpad, and modern browsers. Use XFCE for maximum speed on 4 GB RAM + HDD, or Cinnamon 22.3 for the full desktop experience. (To dual-boot Linux Mint 22.3 alongside Windows 11 + OpenCore, jump to Chapter 8 after completing Chapters 5–7.)

  1. Flash Linux Mint (64-bit) to a USB drive with Rufus (GPT, UEFI (non CSM)) or balenaEtcher.

  2. Boot the Mac holding Option (Alt) → select EFI Boot.

  3. Choose the boot option based on your GPU:

    • Healthy GPU: Press Enter to boot normally.
    • Dead GPU: Highlight Start Linux Mint, press e, add radeon.modeset=0 right after quiet splash, and press Ctrl+X.
  4. Install Linux Mint ("Erase disk and install" or dual-boot via Chapter 8).

  5. Dead GPU Only: After installation, make the bypass permanent by editing /etc/default/grub:

    /etc/default/grub
    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash radeon.modeset=0 modprobe.blacklist=radeon"
    

    Then run sudo update-grub.

  6. Plug in Ethernet (or use USB phone tethering) and install the Broadcom Wi-Fi driver from Driver Manager.

Windows 10 / Windows 11 (UEFI Mode) UEFI Only

Windows 11 runs surprisingly well on this MacBook Pro once configured provided you install in UEFI mode, avoid Apple's Boot Camp Assistant, and use the proper scripts in Chapters 5–7.

  • Healthy GPU: Gets full Windows drivers for both Intel and AMD Radeon graphics plus working internal audio after Chapter 7.
  • Dead GPU: Runs reliably on Microsoft Basic Display Adapter with the dead AMD chip disabled and blocked from Windows Update, plus full working internal audio after Chapter 7.

5. Installing Windows 10 / 11 in UEFI Mode

Do NOT Use Apple's Boot Camp Assistant

On 2011 MacBook Pros, Boot Camp Assistant uses Legacy BIOS (CSM) mode. This disables Intel HD 3000 and forces the dedicated AMD GPU on, causing immediate crashes and red lines on dead-GPU Macs and its installer bundles an outdated MacHALDriver.sys that causes a WDF_VIOLATION BSOD on Windows 11.

  1. On another Windows PC, download Rufus and the Windows 10 or Windows 11 (64-bit) ISO from Microsoft.

  2. In Rufus, select your USB drive (16 GB+), set Partition scheme: GPT, click Start, and check Remove requirement for TPM / Secure Boot / RAM if installing Windows 11.

  3. (Optional Dual-Boot) If you want to keep a ~40–50 GB macOS rescue partition, shrink Macintosh HD in macOS Disk Utility (View → Show All Devices → Partition → +) and format the new partition as ExFAT or Mac OS Extended.

  4. Plug the USB stick into the MacBook Pro, restart, and hold Option (Alt).

  5. Select EFI Boot (the yellow/orange USB icon).

  6. During Windows Setup:

    • Choose Custom Installation.
    • Dual-boot: Select only your newly created partition, click Delete, select the resulting Unallocated Space, and click Next.
    • Windows-only: Delete all partitions on Drive 0 and install to the single Unallocated Space.
    • Stay OFFLINE during setup! Choose "I don't have internet" → "Continue with limited setup" so Windows Update cannot auto-install crashing display drivers before you configure them.
  7. Lock Windows as default boot: Restart holding Option (Alt), hold Control, and click EFI Boot (the arrow changes into a circular arrow ↻).

Mac Keyboard Shortcuts in Windows

Windows Action MacBook Keyboard Combination
Ctrl + Alt + Del fn + Ctrl+Option+Delete
Task Manager Ctrl+Shift+Esc
Lock PC Cmd+L

6. Automated Windows 10 / 11 Driver Scripts (Healthy & Dead GPU)

Do not run Setup.exe or BootCamp.msi from Apple's Boot Camp 5.1 package on Windows 11 it installs MacHALDriver.sys (WDF_VIOLATION BSOD), and on dead-GPU Macs it installs crashing AMD (ATI) drivers.

Instead, use the PowerShell scripts below. They use an untouched BootCamp_Raw folder so the exact same downloaded package works for both Healthy-GPU and Dead-GPU MacBook Pros.

Step 6A: Download & Extract BootCamp5.1.5621 (Run on an Internet-Connected PC)

Open Windows PowerShell on your internet-connected PC and run:

Red Download Bar in PowerShell

PowerShell displays curl.exe's download progress bar in red... this is normal as long as it reaches 100% and prints green text at the end. (If running inside PowerShell ISE with $ErrorActionPreference = "Stop", run in regular Windows PowerShell or Windows Terminal instead.)

Step 6A: Download & Extract BootCamp 5.1.5621
$ErrorActionPreference = "Stop"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

$rawDir = "$env:USERPROFILE\Desktop\BootCamp_Raw"
$zip    = "$rawDir\BootCamp5.1.5621.zip"
$url    = "https://download.info.apple.com/Mac_OS_X/031-3384.20140211.Xcc3e/BootCamp5.1.5621.zip"

New-Item -ItemType Directory -Path $rawDir -Force | Out-Null
Write-Host "Downloading BootCamp 5.1.5621 (~882 MB)..." -ForegroundColor Cyan
curl.exe -L --fail -o $zip $url

Write-Host "Extracting to Desktop\BootCamp_Raw..." -ForegroundColor Cyan
if (Get-Command tar.exe -ErrorAction SilentlyContinue) {
    tar.exe -xf $zip -C $rawDir
} else {
    Expand-Archive -Path $zip -DestinationPath $rawDir -Force
}
Remove-Item $zip -Force -ErrorAction SilentlyContinue

Write-Host "`nDone! Copy '$rawDir' onto a USB drive." -ForegroundColor Green

Copy BootCamp_Raw from your PC's Desktop onto a USB stick, then copy BootCamp_Raw onto your MacBook's Desktop (Desktop\BootCamp_Raw).

Step 6B: Install All Drivers on the MacBook (Choose Your GPU Tab)

Right-click Start → open Terminal (Admin) or Windows PowerShell (Admin) on the MacBook, select the exact tab matching your Mac's AMD GPU status, and run that script.

Healthy GPU Script

This script sets $GpuMode = "Healthy". It re-enables any previously disabled AMD VEN_1002 GPU, clears any prior VEN_1002 driver blocks, installs all Apple/Broadcom/Cirrus drivers (skipping BootCamp.msi), and installs the Intel HD and AMD/ATI Radeon graphics drivers.

If you get a black screen with backlight on after installing the Intel HD driver in UEFI mode, connect via RDP or Safe Mode and run the Step 6C Display Rollback Rescue script to remove only the Intel HD driver while keeping your AMD Radeon GPU.

Step 6B (Healthy GPU): Install All Drivers + AMD & Intel Graphics
# ================= CONFIGURATION =================
$GpuMode = "Healthy"
# =================================================

if ($GpuMode -notin @("Healthy", "Dead")) {
    throw "Invalid GpuMode '$GpuMode'. Must be 'Healthy' or 'Dead'."
}

$driverRoot = "$env:USERPROFILE\Desktop\BootCamp_Raw"
if (-not (Test-Path $driverRoot)) {
    Write-Host "ERROR: Copy BootCamp_Raw to your Desktop first ($driverRoot)." -ForegroundColor Red
    return
}

$7z = @("$env:ProgramFiles\7-Zip\7z.exe", "${env:ProgramFiles(x86)}\7-Zip\7z.exe") |
      Where-Object { Test-Path $_ } | Select-Object -First 1

function Install-DriverExe {
    param([string]$ExePath, [string]$Label)
    if (-not (Test-Path $ExePath)) { return }
    Write-Host "  Installing $Label..." -ForegroundColor White
    if ($7z) {
        $tmp = Join-Path $env:TEMP ("BC_Ext_" + [IO.Path]::GetFileNameWithoutExtension($ExePath))
        Remove-Item $tmp -Recurse -Force -ErrorAction SilentlyContinue
        & $7z x $ExePath "-o$tmp" -y | Out-Null
        $infs = Get-ChildItem -Path $tmp -Filter "*.inf" -Recurse -ErrorAction SilentlyContinue
        if ($infs) {
            pnputil.exe /add-driver "$tmp\*.inf" /subdirs /install | Out-Null
            Remove-Item $tmp -Recurse -Force -ErrorAction SilentlyContinue
            return
        }
        Remove-Item $tmp -Recurse -Force -ErrorAction SilentlyContinue
    }
    Start-Process -FilePath $ExePath -Wait
}

# 1. Healthy GPU Mode: ensure AMD VEN_1002 is enabled and not blocked by policy
Write-Host "`n[1/4] HEALTHY GPU mode: ensuring AMD Radeon (VEN_1002) & Intel HD drivers are enabled..." -ForegroundColor Green
$amdDevices = Get-PnpDevice | Where-Object { $_.InstanceId -match "VEN_1002" -and $_.Class -eq "Display" }
foreach ($dev in $amdDevices) {
    if ($dev.Status -ne "OK") {
        Enable-PnpDevice -InstanceId $dev.InstanceId -Confirm:$false -ErrorAction SilentlyContinue
    }
}
$regPath  = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DeviceInstall\Restrictions"
$denyPath = "$regPath\DenyDeviceIDs"
if (Test-Path $denyPath) {
    $props = Get-ItemProperty -Path $denyPath
    $hasAmdBlock = $props.PSObject.Properties | Where-Object { $_.Name -match '^\d+$' -and $_.Value -match 'VEN_1002' }
    if ($hasAmdBlock) {
        Remove-Item -Path $denyPath -Recurse -Force -ErrorAction SilentlyContinue
        Set-ItemProperty -Path $regPath -Name "DenyDeviceIDs" -Value 0 -Type DWord -ErrorAction SilentlyContinue
        Write-Host "  Cleared previous AMD GPU (VEN_1002) driver block policy." -ForegroundColor Yellow
    }
}

# 2. Install raw INF packages (Bluetooth, Chipset, Intel HD)
Write-Host "`n[2/4] Installing Intel Chipset, Intel HD & Broadcom Bluetooth INFs..." -ForegroundColor Cyan
$infPaths = @(
    "$driverRoot\`$WinPEDriver`$\AppleBluetoothBroadcom64\AppleBTBC64.inf",
    "$driverRoot\BootCamp\Drivers\Intel\Chipset\All\*.inf",
    "$driverRoot\`$WinPEDriver`$\IntelHDGraphics64\Graphics\igdlh64.inf",
    "$driverRoot\`$WinPEDriver`$\IntelHDGraphics64\DisplayAudio\IntcDAud.inf"
)
foreach ($p in $infPaths) {
    if (Test-Path $p) { pnputil.exe /add-driver $p /install | Out-Null }
}

# 3. Install Broadcom, Cirrus Audio, Apple & Intel Management Engine packages (skips BootCamp.msi)
Write-Host "`n[3/4] Installing Ethernet, Wi-Fi, Audio, Trackpad, Keyboard & Apple devices..." -ForegroundColor Cyan
Write-Host "(If 7-Zip is not installed, click Next / Install / Finish on each wizard.)" -ForegroundColor DarkGray

$packages = @(
    @{ Path = "BootCamp\Drivers\Broadcom\BroadcomEthernet64.exe";               Name = "Broadcom Ethernet" },
    @{ Path = "BootCamp\Drivers\Broadcom\BroadcomWirelessWin8x64.exe";          Name = "Broadcom Wi-Fi (Win8/10/11)" },
    @{ Path = "BootCamp\Drivers\Broadcom\BroadcomCardReader64.exe";             Name = "Broadcom Card Reader" },
    @{ Path = "BootCamp\Drivers\Broadcom\BroadcomComController64.exe";          Name = "Broadcom Com Controller" },
    @{ Path = "BootCamp\Drivers\Cirrus\CirrusAudioCS4206x64.exe";               Name = "Cirrus Logic CS4206 Audio" },
    @{ Path = "BootCamp\Drivers\Apple\AppleMultiTouchTrackPadInstaller64.exe";  Name = "Apple Multi-Touch Trackpad" },
    @{ Path = "BootCamp\Drivers\Apple\AppleKeyboardInstaller64.exe";            Name = "Apple Keyboard" },
    @{ Path = "BootCamp\Drivers\Apple\AppleCamera64.exe";                       Name = "Apple FaceTime Camera" },
    @{ Path = "BootCamp\Drivers\Apple\AppleBluetoothInstaller64.exe";           Name = "Apple Bluetooth" },
    @{ Path = "BootCamp\Drivers\Apple\AppleDisplayInstaller64.exe";             Name = "Apple Display" },
    @{ Path = "BootCamp\Drivers\Apple\AppleSDCardReader64.exe";                 Name = "Apple SD Card Reader" },
    @{ Path = "BootCamp\Drivers\Apple\AppleODDInstaller64.exe";                 Name = "Apple SuperDrive (ODD)" },
    @{ Path = "BootCamp\Drivers\Apple\AppleRemoteInstaller64.exe";              Name = "Apple IR Remote" },
    @{ Path = "BootCamp\Drivers\Apple\AppleNullDriver64.exe";                   Name = "Apple Null Driver" },
    @{ Path = "BootCamp\Drivers\Apple\NullSystemDevice64.exe";                  Name = "Null System Device" },
    @{ Path = "BootCamp\Drivers\Intel\IntelMgmtEngine.exe";                     Name = "Intel Management Engine" }
)

foreach ($pkg in $packages) {
    Install-DriverExe -ExePath (Join-Path $driverRoot $pkg.Path) -Label $pkg.Name
}

$brcmErr = Get-PnpDevice | Where-Object { $_.InstanceId -match "VEN_14E4" -and $_.Status -ne "OK" }
if ($brcmErr) {
    Write-Host "  Trying Broadcom Win7 Wi-Fi fallback..." -ForegroundColor Yellow
    Install-DriverExe -ExePath (Join-Path $driverRoot "BootCamp\Drivers\Broadcom\BroadcomWirelessWin7x64.exe") -Label "Broadcom Wi-Fi (Win7 Fallback)"
}

# 4. Install Intel Legacy HD + ATI/AMD Radeon drivers
Write-Host "`n[4/4] Installing ATI/AMD & Intel HD Graphics drivers (Healthy GPU mode)..." -ForegroundColor Cyan
$intelLegacy = Join-Path $driverRoot "BootCamp\Drivers\Intel\IntelHDLegacyGraphics64.exe"
$atiSetup    = Join-Path $driverRoot "BootCamp\Drivers\ATI\ATIGraphics\Setup.exe"
$atiAudio    = Join-Path $driverRoot "BootCamp\Drivers\ATI\ATIAudioSetup.exe"
if (Test-Path $intelLegacy) { Start-Process -FilePath $intelLegacy -Wait }
if (Test-Path $atiSetup)    { Start-Process -FilePath $atiSetup -Wait }
if (Test-Path $atiAudio)    { Start-Process -FilePath $atiAudio -Wait }

Write-Host "`nALL DONE (Healthy GPU Mode)! Restart your MacBook Pro now." -ForegroundColor Green

Dead GPU Script... Do NOT Run If Your AMD GPU Works!

This script sets $GpuMode = "Dead". It disables the AMD VEN_1002 GPU, blocks its hardware IDs via Group Policy, disables Windows Update driver auto-installs, and intentionally skips Intel HD 3000 graphics drivers (igdlh64.inf / IntelHDLegacyGraphics64.exe). On 2011 15-inch Macs in UEFI mode without a working AMD GPU, installing the Intel HD driver causes a **black screen (backlight on, no picture)**staying on Microsoft Basic Display Adapter keeps the screen working reliably.

Your BootCamp_Raw folder is left completely untouched.

Step 6B (Dead GPU): Disable AMD GPU & Install Safe Drivers
# ================= CONFIGURATION =================
$GpuMode = "Dead"
# =================================================

if ($GpuMode -notin @("Healthy", "Dead")) {
    throw "Invalid GpuMode '$GpuMode'. Must be 'Healthy' or 'Dead'."
}

$driverRoot = "$env:USERPROFILE\Desktop\BootCamp_Raw"
if (-not (Test-Path $driverRoot)) {
    Write-Host "ERROR: Copy BootCamp_Raw to your Desktop first ($driverRoot)." -ForegroundColor Red
    return
}

$7z = @("$env:ProgramFiles\7-Zip\7z.exe", "${env:ProgramFiles(x86)}\7-Zip\7z.exe") |
      Where-Object { Test-Path $_ } | Select-Object -First 1

function Install-DriverExe {
    param([string]$ExePath, [string]$Label)
    if (-not (Test-Path $ExePath)) { return }
    Write-Host "  Installing $Label..." -ForegroundColor White
    if ($7z) {
        $tmp = Join-Path $env:TEMP ("BC_Ext_" + [IO.Path]::GetFileNameWithoutExtension($ExePath))
        Remove-Item $tmp -Recurse -Force -ErrorAction SilentlyContinue
        & $7z x $ExePath "-o$tmp" -y | Out-Null
        $infs = Get-ChildItem -Path $tmp -Filter "*.inf" -Recurse -ErrorAction SilentlyContinue
        if ($infs) {
            pnputil.exe /add-driver "$tmp\*.inf" /subdirs /install | Out-Null
            Remove-Item $tmp -Recurse -Force -ErrorAction SilentlyContinue
            return
        }
        Remove-Item $tmp -Recurse -Force -ErrorAction SilentlyContinue
    }
    Start-Process -FilePath $ExePath -Wait
}

# 1. Dead GPU Mode: disable AMD VEN_1002 & block Windows Update display drivers
Write-Host "`n[1/4] DEAD GPU mode: disabling AMD VEN_1002 & blocking auto GPU drivers..." -ForegroundColor Yellow
$amdDevices = Get-PnpDevice | Where-Object { $_.InstanceId -match "VEN_1002" -and $_.Class -eq "Display" }
foreach ($dev in $amdDevices) {
    Disable-PnpDevice -InstanceId $dev.InstanceId -Confirm:$false -ErrorAction SilentlyContinue
    $hwIds = (Get-PnpDeviceProperty -InstanceId $dev.InstanceId -KeyName "DEVPKEY_Device_HardwareIds").Data
    if ($hwIds) {
        $regPath  = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DeviceInstall\Restrictions"
        $denyPath = "$regPath\DenyDeviceIDs"
        New-Item -Path $denyPath -Force | Out-Null
        Set-ItemProperty -Path $regPath -Name "DenyDeviceIDs" -Value 1 -Type DWord
        Set-ItemProperty -Path $regPath -Name "DenyDeviceIDsRetroactive" -Value 0 -Type DWord
        $i = 1
        foreach ($id in $hwIds) {
            Set-ItemProperty -Path $denyPath -Name "$i" -Value $id -Type String
            $i++
        }
    }
}

# Prevent Windows Update from auto-installing Intel HD (causes black screen) or AMD drivers
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Force | Out-Null
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "ExcludeWUDriversInQualityUpdate" -Value 1 -Type DWord
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DriverSearching" -Name "SearchOrderConfig" -Value 0 -Type DWord

# 2. Install raw INF packages (Bluetooth & Chipset ONLY; skips Intel HD)
Write-Host "`n[2/4] Installing Intel Chipset & Broadcom Bluetooth INFs..." -ForegroundColor Cyan
$infPaths = @(
    "$driverRoot\`$WinPEDriver`$\AppleBluetoothBroadcom64\AppleBTBC64.inf",
    "$driverRoot\BootCamp\Drivers\Intel\Chipset\All\*.inf"
)
foreach ($p in $infPaths) {
    if (Test-Path $p) { pnputil.exe /add-driver $p /install | Out-Null }
}

# 3. Install Broadcom, Cirrus Audio, Apple & Intel Management Engine packages (skips BootCamp.msi)
Write-Host "`n[3/4] Installing Ethernet, Wi-Fi, Audio, Trackpad, Keyboard & Apple devices..." -ForegroundColor Cyan
Write-Host "(If 7-Zip is not installed, click Next / Install / Finish on each wizard.)" -ForegroundColor DarkGray

$packages = @(
    @{ Path = "BootCamp\Drivers\Broadcom\BroadcomEthernet64.exe";               Name = "Broadcom Ethernet" },
    @{ Path = "BootCamp\Drivers\Broadcom\BroadcomWirelessWin8x64.exe";          Name = "Broadcom Wi-Fi (Win8/10/11)" },
    @{ Path = "BootCamp\Drivers\Broadcom\BroadcomCardReader64.exe";             Name = "Broadcom Card Reader" },
    @{ Path = "BootCamp\Drivers\Broadcom\BroadcomComController64.exe";          Name = "Broadcom Com Controller" },
    @{ Path = "BootCamp\Drivers\Cirrus\CirrusAudioCS4206x64.exe";               Name = "Cirrus Logic CS4206 Audio" },
    @{ Path = "BootCamp\Drivers\Apple\AppleMultiTouchTrackPadInstaller64.exe";  Name = "Apple Multi-Touch Trackpad" },
    @{ Path = "BootCamp\Drivers\Apple\AppleKeyboardInstaller64.exe";            Name = "Apple Keyboard" },
    @{ Path = "BootCamp\Drivers\Apple\AppleCamera64.exe";                       Name = "Apple FaceTime Camera" },
    @{ Path = "BootCamp\Drivers\Apple\AppleBluetoothInstaller64.exe";           Name = "Apple Bluetooth" },
    @{ Path = "BootCamp\Drivers\Apple\AppleDisplayInstaller64.exe";             Name = "Apple Display" },
    @{ Path = "BootCamp\Drivers\Apple\AppleSDCardReader64.exe";                 Name = "Apple SD Card Reader" },
    @{ Path = "BootCamp\Drivers\Apple\AppleODDInstaller64.exe";                 Name = "Apple SuperDrive (ODD)" },
    @{ Path = "BootCamp\Drivers\Apple\AppleRemoteInstaller64.exe";              Name = "Apple IR Remote" },
    @{ Path = "BootCamp\Drivers\Apple\AppleNullDriver64.exe";                   Name = "Apple Null Driver" },
    @{ Path = "BootCamp\Drivers\Apple\NullSystemDevice64.exe";                  Name = "Null System Device" },
    @{ Path = "BootCamp\Drivers\Intel\IntelMgmtEngine.exe";                     Name = "Intel Management Engine" }
)

foreach ($pkg in $packages) {
    Install-DriverExe -ExePath (Join-Path $driverRoot $pkg.Path) -Label $pkg.Name
}

$brcmErr = Get-PnpDevice | Where-Object { $_.InstanceId -match "VEN_14E4" -and $_.Status -ne "OK" }
if ($brcmErr) {
    Write-Host "  Trying Broadcom Win7 Wi-Fi fallback..." -ForegroundColor Yellow
    Install-DriverExe -ExePath (Join-Path $driverRoot "BootCamp\Drivers\Broadcom\BroadcomWirelessWin7x64.exe") -Label "Broadcom Wi-Fi (Win7 Fallback)"
}

# 4. Skip ATI/AMD and Intel HD drivers
Write-Host "`n[4/4] Skipped Intel HD & ATI/AMD graphics drivers (Dead GPU mode, keeping Microsoft Basic Display Adapter)." -ForegroundColor Green
Write-Host "`nALL DONE (Dead GPU Mode)! Restart your MacBook Pro now." -ForegroundColor Green

Step 6C: Troubleshooting Black Screen After Installing Intel HD Graphics

If you accidentally installed the Intel HD Graphics driver (either manually, via Windows Update, or on a UEFI Mac where the Intel driver blanks the panel) and now get a black screen with backlight on after the Windows boot logo:

  1. Connect to the MacBook via Remote Desktop (RDP) or boot into Safe Mode.
  2. Run this in PowerShell (Admin) to remove only the Intel display driver and restore Microsoft Basic Display Adapter:
Step 6C: Display Rollback Rescue
$intelDrivers = Get-WindowsDriver -Online | Where-Object {
    $_.ClassName -eq "Display" -and $_.ProviderName -match "Intel"
}
foreach ($drv in $intelDrivers) {
    pnputil.exe /delete-driver $drv.Driver /uninstall /force
}

$intelGpu = Get-PnpDevice | Where-Object { $_.InstanceId -match "VEN_8086&DEV_0126" }
if ($intelGpu) {
    pnputil.exe /remove-device $intelGpu.InstanceId
    pnputil.exe /scan-devices
}

New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Force | Out-Null
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "ExcludeWUDriversInQualityUpdate" -Value 1 -Type DWord
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DriverSearching" -Name "SearchOrderConfig" -Value 0 -Type DWord

Write-Host "Display rolled back! Restart your MacBook Pro." -ForegroundColor Green

7. Fixing Internal Audio in UEFI Windows 10 / 11 (Code 10 / DSDT + OpenCore 1.0.8) Both GPUs

Applies to Both Healthy & Dead GPU Macs

This UEFI audio fix is needed on both Healthy-GPU and Dead-GPU 2011 15-inch MacBook Pros running Windows 10/11 in UEFI mode.

Why Speakers & Headphone Jack Don't Work Yet

Even after installing CirrusAudioCS4206x64.exe, you will have no speaker or headphone-jack output (though RDP audio works over the network). Checking Device Manager reveals:

Apple's 2011 ACPI DSDT restricts PCIe resources to 32-bit addresses. Without a 64-bit QWordMemory range, Windows won't start the Intel HDA controller, so the Cirrus Logic CS4206B codec behind it never initializes.

Step 7A: Check Device Manager Status (Read-Only)

Step 7A: Check Devices with Errors
Write-Host "=== Devices with Errors ===" -ForegroundColor Yellow
Get-PnpDevice | Where-Object { $_.Status -ne "OK" } | ForEach-Object {
    $code = (Get-PnpDeviceProperty -InstanceId $_.InstanceId -KeyName "DEVPKEY_Device_ProblemCode" -ErrorAction SilentlyContinue).Data
    [PSCustomObject]@{ Class = $_.Class; Name = $_.FriendlyName; Status = $_.Status; ErrorCode = $code; InstanceId = $_.InstanceId }
} | Format-Table -AutoSize

Step 7B: Extract, Patch & Compile Your Mac's Own DSDT

Never Use Someone Else's DSDT.aml

Using a DSDT dumped from another Mac model or BIOS version can cause boot failures. The script below dumps your own Mac's live DSDT from the Windows Registry, appends a 64-bit QWordMemory resource template (BUF1) using ConcatenateResTemplate (preserving Apple's original BUF0 offsets), and compiles it with Intel's official iasl.exe.

Run this in PowerShell (Admin) on the MacBook (creates Desktop\DSDT_Fix):

Step 7B: Dump, Patch & Compile DSDT
$ErrorActionPreference = "Stop"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

$workDir = "$env:USERPROFILE\Desktop\DSDT_Fix"
New-Item -ItemType Directory -Path $workDir -Force | Out-Null

# 1. Dump this Mac's exact DSDT from Windows Registry
$dsdtKey = Get-ChildItem "HKLM:\HARDWARE\ACPI\DSDT" -Recurse |
           Where-Object { $_.Property -contains "00000000" } |
           Select-Object -First 1
if (-not $dsdtKey) { throw "Could not find DSDT in Registry." }

$bytes = (Get-ItemProperty -Path $dsdtKey.PSPath -Name "00000000")."00000000"
[System.IO.File]::WriteAllBytes("$workDir\dsdt.dat", $bytes)
Write-Host "[1/4] Dumped your Mac's raw DSDT ($($bytes.Length) bytes)." -ForegroundColor Green

# 2. Download Intel ACPICA (iasl-win-20260408.zip)
$iaslZip = "$workDir\iasl-win-20260408.zip"
$iaslUrl = "https://downloadmirror.intel.com/917620/iasl-win-20260408.zip"
Write-Host "[2/4] Downloading Intel iasl..." -ForegroundColor Cyan
curl.exe -L --fail -o $iaslZip $iaslUrl
tar.exe -xf $iaslZip -C $workDir
Remove-Item $iaslZip -Force -ErrorAction SilentlyContinue

$iaslExe = (Get-ChildItem -Path $workDir -Filter "iasl.exe" -Recurse | Select-Object -First 1).FullName
if (-not $iaslExe) { throw "Could not find iasl.exe after extraction." }

# 3. Decompile dsdt.dat -> dsdt.dsl
Write-Host "[3/4] Decompiling dsdt.dat..." -ForegroundColor Cyan
Push-Location $workDir
& $iaslExe -d "$workDir\dsdt.dat"

# 4. Patch PCI0._CRS with 64-bit QWordMemory + ConcatenateResTemplate (Late 2011 MacBookPro8,2 layout)
$src = Get-Content "$workDir\dsdt.dsl" -Raw
$step1 = $src -replace 'DefinitionBlock \("", "DSDT", 1, "APPLE ", "MacBookP", 0x00080001\)',
                        'DefinitionBlock ("", "DSDT", 1, "APPLE ", "MacBookP", 0x00080002)'

$pattern = '(?s)(0x00, 0x50, 0x00, 0x00, 0x79, 0x00[^\r\n]*\r?\n\s*\}\)\r?\n)(\s*Method \(_CRS, 0, Serialized\))'
$buf1 = @'
$1            Name (BUF1, ResourceTemplate ()
            {
                QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
                    0x0000000000000000, // Granularity
                    0x0000000C20000000, // Range Minimum (48.5 GB)
                    0x0000000E0FFFFFFF, // Range Maximum (56.25 GB)
                    0x0000000000000000, // Translation Offset
                    0x00000001F0000000, // Length
                    ,, , AddressRangeMemory, TypeStatic)
            })
$2
'@
$step2 = [regex]::Replace($step1, $pattern, $buf1, 1)
$step3 = $step2.Replace(
    'Return (BUF0) /* \_SB_.PCI0.BUF0 */',
    "ConcatenateResTemplate (BUF0, BUF1, Local0)`r`n                Return (Local0)"
)

if ($step2 -eq $step1 -or $step3 -eq $step2) {
    Pop-Location
    throw "DSDT anchor did not match (different Mac model/BIOS?). Inspect $workDir\dsdt.dsl manually before patching."
}

[System.IO.File]::WriteAllText("$workDir\dsdt-modified.dsl", $step3)
Write-Host "[4/4] Compiling dsdt-modified.dsl..." -ForegroundColor Cyan
& $iaslExe -ve "$workDir\dsdt-modified.dsl"
Pop-Location

if (-not (Test-Path "$workDir\dsdt-modified.aml")) {
    throw "Compilation failed! Check iasl errors above."
}
Write-Host "`nCompiled dsdt-modified.aml with 0 errors!" -ForegroundColor Green
If dsdt.dsl doesn't match the MacBookPro8,2 anchors above, open Desktop\DSDT_Fix\dsdt.dsl in Notepad, find Device (PCI0), bump the OEM revision in DefinitionBlock by 1, add the QWordMemory block inside BUF1, and concatenate BUF1 onto BUF0 before running iasl.exe -ve dsdt-modified.dsl.

Step 7C: Install OpenCore 1.0.8 + DSDT.aml (No "Test Mode" Watermark)

OpenCore injects your DSDT.aml cleanly before Windows boots, eliminating the need for Windows Test Signing mode. This script validates config.plist with ocvalidate.exe, backs up your existing EFI & BCD safely, and installs OpenCore onto the EFI partition while leaving Windows' original \EFI\Microsoft\Boot\bootmgfw.efi untouched.

Run in PowerShell (Admin) on the MacBook:

Step 7C: Install OpenCore 1.0.8 + DSDT.aml
$ErrorActionPreference = "Stop"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

$workDir = "$env:USERPROFILE\Desktop\DSDT_Fix"
$amlPath = "$workDir\dsdt-modified.aml"
if (-not (Test-Path $amlPath)) { throw "Missing $amlPath! Run Step 7B first." }

# 1. Download & extract OpenCore 1.0.8
$ocZip     = "$workDir\OpenCore-1.0.8-RELEASE.zip"
$ocExtract = "$workDir\OpenCore-1.0.8-RELEASE"
$ocUrl     = "https://github.com/acidanthera/OpenCorePkg/releases/download/1.0.8/OpenCore-1.0.8-RELEASE.zip"

if (-not (Test-Path $ocExtract)) {
    Write-Host "[1/5] Downloading OpenCore 1.0.8..." -ForegroundColor Cyan
    curl.exe -L --fail -o $ocZip $ocUrl
    New-Item -ItemType Directory -Path $ocExtract -Force | Out-Null
    tar.exe -xf $ocZip -C $ocExtract
    Remove-Item $ocZip -Force -ErrorAction SilentlyContinue
}

$sampleFile = Get-ChildItem -Path $ocExtract -Filter "Sample.plist" -Recurse | Select-Object -First 1
if (-not $sampleFile) { throw "Could not find Sample.plist inside $ocExtract" }
$ocDir = Split-Path (Split-Path $sampleFile.FullName)

# 2. Build config.plist cleanly (UTF-8 without BOM) and validate with ocvalidate.exe
Write-Host "[2/5] Building & validating config.plist..." -ForegroundColor Cyan
$configOut = "$workDir\config.plist"

$settings = New-Object System.Xml.XmlReaderSettings
$settings.DtdProcessing = [System.Xml.DtdProcessing]::Ignore
$reader = [System.Xml.XmlReader]::Create($sampleFile.FullName, $settings)
$xml = New-Object System.Xml.XmlDocument
$xml.XmlResolver = $null
$xml.Load($reader)
$reader.Close()

function Get-PlistChild($Dict, $Key) {
    foreach ($c in $Dict.ChildNodes) {
        if ($c.Name -eq "key" -and $c.InnerText -eq $Key) {
            $n = $c.NextSibling
            while ($n -and $n.NodeType -ne 'Element') { $n = $n.NextSibling }
            return $n
        }
    }
    return $null
}
function Set-PlistVal($Dict, $Key, $Type, $Val) {
    $node = Get-PlistChild $Dict $Key
    if (-not $node) { throw "Missing plist key: $Key" }
    if ($Type -eq "bool") {
        $Dict.ReplaceChild($xml.CreateElement($Val.ToLower()), $node) | Out-Null
    } else {
        $node.InnerText = $Val
    }
}

$rootDict = $xml.SelectSingleNode("/plist/dict")

# Remove #WARNING keys
@($rootDict.ChildNodes | Where-Object { $_.Name -eq "key" -and $_.InnerText -like "#WARNING*" }) | ForEach-Object {
    $v = $_.NextSibling
    while ($v -and $v.NodeType -ne 'Element') { $v = $v.NextSibling }
    if ($v) { $rootDict.RemoveChild($v) | Out-Null }
    $rootDict.RemoveChild($_) | Out-Null
}

# ACPI -> Add: load DSDT.aml
$acpiAdd = Get-PlistChild (Get-PlistChild $rootDict "ACPI") "Add"
$acpiAdd.RemoveAll()
$d = $xml.CreateElement("dict")
foreach ($p in @(@("Comment","string","DSDT QWordMemory Audio Fix"), @("Enabled","bool","true"), @("Path","string","DSDT.aml"))) {
    $k = $xml.CreateElement("key"); $k.InnerText = $p[0]
    $v = if ($p[1] -eq "bool") { $xml.CreateElement($p[2]) } else { $e = $xml.CreateElement($p[1]); $e.InnerText = $p[2]; $e }
    $d.AppendChild($k) | Out-Null; $d.AppendChild($v) | Out-Null
}
$acpiAdd.AppendChild($d) | Out-Null

# Clear Kernel -> Add & Misc -> Tools
(Get-PlistChild (Get-PlistChild $rootDict "Kernel") "Add").RemoveAll()
(Get-PlistChild (Get-PlistChild $rootDict "Misc") "Tools").RemoveAll()

# Misc -> Boot & Security (ShowPicker = true for initial test; change to false later if desired)
$misc = Get-PlistChild $rootDict "Misc"
$boot = Get-PlistChild $misc "Boot"
Set-PlistVal $boot "ShowPicker" "bool" "true"
Set-PlistVal $boot "Timeout" "integer" "2"

$sec = Get-PlistChild $misc "Security"
Set-PlistVal $sec "AllowSetDefault" "bool" "true"
Set-PlistVal $sec "ScanPolicy" "integer" "0"
Set-PlistVal $sec "Vault" "string" "Optional"

# PlatformInfo: preserve real MacBook Pro SMBIOS
$plat = Get-PlistChild $rootDict "PlatformInfo"
Set-PlistVal $plat "Automatic" "bool" "false"
Set-PlistVal $plat "UpdateDataHub" "bool" "false"
Set-PlistVal $plat "UpdateNVRAM" "bool" "false"
Set-PlistVal $plat "UpdateSMBIOS" "bool" "false"

# UEFI -> Drivers: keep ONLY OpenRuntime.efi
$drvArr = Get-PlistChild (Get-PlistChild $rootDict "UEFI") "Drivers"
$keep = @()
foreach ($item in $drvArr.ChildNodes) {
    if ($item.Name -eq "dict") {
        $p = Get-PlistChild $item "Path"
        if ($p -and $p.InnerText -eq "OpenRuntime.efi") {
            Set-PlistVal $item "Enabled" "bool" "true"
            $keep += $item
        }
    }
}
$drvArr.RemoveAll()
foreach ($item in $keep) { $drvArr.AppendChild($item) | Out-Null }

# Write UTF-8 without BOM and without spaces in self-closing tags
$sw = New-Object System.IO.StringWriter
$xwSettings = New-Object System.Xml.XmlWriterSettings
$xwSettings.Indent = $true
$xwSettings.IndentChars = "`t"
$xwSettings.OmitXmlDeclaration = $true
$xw = [System.Xml.XmlWriter]::Create($sw, $xwSettings)
$xml.WriteTo($xw)
$xw.Flush()
$body = ($sw.ToString() -replace ' />', '/>')

$finalPlist = @"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
$body
"@
$finalPlist = $finalPlist.Replace("`r`n", "`n")
[System.IO.File]::WriteAllText($configOut, $finalPlist, (New-Object System.Text.UTF8Encoding($false)))

$ocValidate = (Get-ChildItem -Path "$ocDir\Utilities\ocvalidate" -Filter "ocvalidate.exe" -Recurse | Select-Object -First 1).FullName
& $ocValidate $configOut
if ($LASTEXITCODE -ne 0) { throw "ocvalidate failed! EFI partition untouched." }

# 3. Mount EFI partition & back up safely (using bcdedit + robocopy to skip locked BCD)
Write-Host "[3/5] Backing up EFI partition..." -ForegroundColor Cyan
$efiDrive = "S:"
if (-not (Test-Path "$efiDrive\EFI")) {
    if (Test-Path $efiDrive) { throw "Drive S: is already in use." }
    mountvol $efiDrive /S
}

$backupDir = "$workDir\EFI_Backup"
New-Item -ItemType Directory -Path $backupDir -Force | Out-Null
Remove-Item "$backupDir\BCD_Backup" -Force -ErrorAction SilentlyContinue
bcdedit.exe /export "$backupDir\BCD_Backup" | Out-Null
robocopy "$efiDrive\EFI" "$backupDir\EFI" /E /XF BCD BCD.LOG* /R:0 /W:0 | Out-Null

# 4. Install OpenCore + DSDT.aml
Write-Host "[4/5] Installing OpenCore + DSDT.aml to internal EFI..." -ForegroundColor Cyan
New-Item -ItemType Directory -Path "$efiDrive\EFI\BOOT", "$efiDrive\EFI\OC\ACPI", "$efiDrive\EFI\OC\Drivers" -Force | Out-Null
Copy-Item "$ocDir\X64\EFI\BOOT\BOOTx64.efi"           "$efiDrive\EFI\BOOT\BOOTx64.efi" -Force
Copy-Item "$ocDir\X64\EFI\OC\OpenCore.efi"            "$efiDrive\EFI\OC\OpenCore.efi" -Force
Copy-Item "$ocDir\X64\EFI\OC\Drivers\OpenRuntime.efi" "$efiDrive\EFI\OC\Drivers\OpenRuntime.efi" -Force
Copy-Item $amlPath                                    "$efiDrive\EFI\OC\ACPI\DSDT.aml" -Force
Copy-Item $configOut                                  "$efiDrive\EFI\OC\config.plist" -Force

# 5. Unmount EFI partition
Write-Host "[5/5] Unmounting EFI partition..." -ForegroundColor Cyan
mountvol $efiDrive /D

Write-Host "`nALL DONE! Reboot holding Option -> Control+Click EFI Boot -> Windows." -ForegroundColor Green

Final Boot & Verification

  1. Restart the MacBook Pro and hold Option (Alt).

  2. Hold Control and click EFI Boot (locks OpenCore as your default boot loader).

  3. In OpenCore's 2-second boot menu, highlight Windows and press Ctrl + Enter to set it as default.

  4. Once on the Windows desktop, verify:

    • Built-in speakers and headphone jack (Cirrus Logic CS4206B) play audio normally.
    • Device Manager shows High Definition Audio Controller with status OK and Large Memory listed under View → Resources by type → Memory.

If you are only running Windows 11 (skip this if you plan to dual-boot Linux Mint in Chapter 8) and want to boot straight into Windows invisibly:

  1. Open PowerShell (Admin) and run mountvol S: /S.
  2. Open S:\EFI\OC\config.plist in Notepad and change the <true/> under ShowPicker to <false/>.
  3. Save the file and run mountvol S: /D.

8. Dual-Booting Linux Mint 22.3 Alongside Windows 11 (OpenCore Menu) Optional

If you already installed Windows 11 with OpenCore (Chapters 5–7), you can add Linux Mint right into OpenCore's boot menu. OpenCore will continue to auto-boot Windows 11 by default after 5 seconds (keeping your audio DSDT fix active), while letting you press the arrow keys to pick Linux Mint whenever you want.

Step 8A: Prepare Windows 11 & Shrink C: by 100 GB

  1. Open PowerShell (Admin) in Windows 11 to back up your working EFI partition cleanly (skipping Windows' locked live BCD files via bcdedit + robocopy) and disable Fast Startup:

    Step 8A: Back Up EFI & Disable Fast Startup
    $backupDir = "$env:USERPROFILE\Desktop\EFI_PreMint_Backup"
    New-Item -ItemType Directory -Path $backupDir -Force | Out-Null
    mountvol S: /S
    bcdedit.exe /export "$backupDir\BCD_Backup" | Out-Null
    robocopy "S:\EFI" "$backupDir\EFI" /E /XF BCD BCD.LOG* /R:0 /W:0 | Out-Null
    mountvol S: /D
    powercfg /h off
    Write-Host "EFI backed up cleanly to $backupDir!" -ForegroundColor Green
    
  2. Right-click Start → open Disk Management (diskmgmt.msc).

  3. Right-click your Windows C: partition → Shrink Volume...

  4. Enter 102400 MB (100 GB) for "Enter the amount of space to shrink in MB" and click Shrink.

  5. Leave the new 100 GB Unallocated space as-is (do not create or format a partition in Windows).

Step 8B: Create the Linux Mint USB with Rufus

  1. Download Linux Mint 22.3 Cinnamon (64-bit):

  2. Open Rufus on Windows 11, plug in a USB drive (8 GB+), and configure:

    • Boot selection: Select the downloaded linuxmint-22.3-cinnamon-64bit.iso
    • Partition scheme: GPT
    • Target system: UEFI (non CSM)
    • Click START (accept the default "Write in ISO Image mode" if prompted).

Step 8C: Install Linux Mint into the 100 GB Space

  1. Reboot the MacBook Pro holding Option (Alt) → select EFI Boot (the USB drive).

  2. Choose your boot method based on your AMD GPU status:

    • Healthy GPU Press Enter on Start Linux Mint.
    • Dead GPU Highlight Start Linux Mint, press e, add radeon.modeset=0 right after quiet splash, and press Ctrl+X.
  3. Double-click Install Linux Mint on the desktop.

  4. On the Installation type screen, choose "Something else" (do not use Erase disk!).

  5. Verify your existing partitions and create the Linux partition carefully:

    • CRITICAL — Existing EFI System Partition (FAT32, ~100–300 MB): Leave it completely untouched. Make sure Format is UNCHECKED.
    • Select the ~107374 MB (100 GB) Free Space → click +:
      • Size: Use all free space
      • Type: Primary
      • Use as: Ext4 journaling file system
      • Mount point: /
    • Leave "Device for boot loader installation" pointing to your internal drive (e.g., /dev/sda).
  6. Click Install Now and finish setup.

Step 8D: Post-Install Setup Inside Linux Mint (And Hybrid MBR Fix)

After installing, Linux Mint will temporarily boot straight into GRUB / Mint because its installer adds an Ubuntu entry at the top of UEFI BootOrder and overwrites \EFI\BOOT\BOOTx64.efi.

Common Dual-Boot Trap on MacBooks (BlInitializeLibrary failed 0xc00000bb)

When installing Ubuntu/Linux Mint alongside Windows on a MacBook Pro, the installer often converts the disk's Protective MBR into a Hybrid MBR—causing Windows (bootmgfw.efi) to fail in both GRUB and OpenCore with OCB: StartImage failed - Unsupported (BlInitializeLibrary failed 0xc00000bb). Step 3 below checks and fixes this cleanly in 10 seconds without touching any partitions or data.

  1. (Dead GPU Only) If you had to add radeon.modeset=0 at boot, press e at GRUB one last time to reach the desktop, open Terminal, and edit /etc/default/grub so both GRUB and OpenCore's OpenLinuxBoot.efi read the bypass flags automatically:

    Make Dead-GPU Bypass Permanent
    sudo nano /etc/default/grub
    

    Set GRUB_CMDLINE_LINUX_DEFAULT to:

    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash radeon.modeset=0 modprobe.blacklist=radeon"
    

    Save (Ctrl+O, Enter, Ctrl+X) and run:

    sudo update-grub
    
  2. Plug in Ethernet (or use USB phone tethering), open Driver Manager, and install the Broadcom Wi-Fi driver. (Optional: run sudo apt update && sudo apt install -y openssh-server && sudo systemctl enable --now ssh if you want SSH access.)

  3. Check for a Hybrid MBR & restore Protective MBR if present:

    command -v gdisk || (sudo apt update && sudo apt install -y gdisk)
    sudo gdisk -l /dev/sda
    

    Look at the MBR: line near the top:

    • If it already says MBR: protective, move to Step 4.
    • If it says MBR: hybrid, fix it safely (rewrites only sector 0's protective MBR—does not touch any partitions or data):
      1. Run sudo gdisk /dev/sda
      2. Enter x (expert mode) → n (new protective MBR) → w (write) → Y (confirm)
      3. Verify sudo gdisk -l /dev/sda now prints MBR: protective and GPT: present.
  4. Point UEFI back to OpenCore (then reboot into Windows 11):

    sudo efibootmgr -c -d /dev/sda -p 1 -L "OpenCore" -l '\EFI\OC\OpenCore.efi'
    sudo reboot
    

    OpenCore's menu should appear—select Windows to boot back into Windows 11 with audio working!

Step 8E: Add Linux Mint to OpenCore & Restore BOOTx64.efi

Once back inside Windows 11, open PowerShell (Admin) or PowerShell ISE (Admin) and run this script. It downloads ext4_x64.efi, enables ext4_x64.efi + OpenLinuxBoot.efi, sets Timeout = 5, HideAuxiliary = true (hiding older kernels unless you press Space), LauncherOption = Full, and RequestBootVarRouting = true, validates with ocvalidate.exe, restores clean RELEASE OpenCore binaries, and cleans up any temporary debug files.

Step 8E: Add Linux Mint to OpenCore 1.0.8 (RELEASE)
$ErrorActionPreference = "Stop"
$ProgressPreference = "SilentlyContinue"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

# ============================================================
# CONFIGURATION
# ============================================================
$workDir    = "$env:USERPROFILE\Desktop\DSDT_Fix"
$version    = "1.0.8"
$ocExtract  = "$workDir\OpenCore-$version-RELEASE"
$ocZip      = "$workDir\OpenCore-$version-RELEASE.zip"
$ocUrl      = "https://github.com/acidanthera/OpenCorePkg/releases/download/$version/OpenCore-$version-RELEASE.zip"

$ext4Driver = "$workDir\ext4_x64.efi"
$ext4Url    = "https://raw.githubusercontent.com/acidanthera/OcBinaryData/master/Drivers/ext4_x64.efi"

$efiDrive    = "S:"
$mountedHere = $false

# ============================================================
# ADMINISTRATOR CHECK
# ============================================================
$identity  = [Security.Principal.WindowsIdentity]::GetCurrent()
$principal = New-Object Security.Principal.WindowsPrincipal($identity)
if (-not $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
    throw "Please run PowerShell as Administrator."
}

New-Item -ItemType Directory -Path $workDir -Force | Out-Null

# ============================================================
# HELPER FUNCTIONS
# ============================================================
function Download-File {
    param([string]$Url, [string]$Destination)
    Write-Host "Downloading: $Url" -ForegroundColor Cyan
    Invoke-WebRequest -Uri $Url -OutFile $Destination -UseBasicParsing
    if (-not (Test-Path $Destination) -or (Get-Item $Destination).Length -eq 0) {
        throw "Download failed or empty: $Destination"
    }
}

function Get-PlistChild {
    param($Dict, [string]$Key)
    foreach ($c in $Dict.ChildNodes) {
        if ($c.NodeType -eq 'Element' -and $c.Name -eq "key" -and $c.InnerText -eq $Key) {
            $n = $c.NextSibling
            while ($n -and $n.NodeType -ne 'Element') { $n = $n.NextSibling }
            return $n
        }
    }
    return $null
}

function Set-PlistVal {
    param($Dict, [string]$Key, [string]$Type, [string]$Val)
    $node = Get-PlistChild $Dict $Key
    if (-not $node) { throw "Missing plist key: $Key" }
    switch ($Type) {
        "bool" {
            if ($Val -notin @("true", "false")) { throw "Invalid boolean value for $Key" }
            $Dict.ReplaceChild($xml.CreateElement($Val.ToLower()), $node) | Out-Null
        }
        "string" {
            $newNode = $xml.CreateElement("string")
            $newNode.InnerText = $Val
            $Dict.ReplaceChild($newNode, $node) | Out-Null
        }
        "integer" {
            $newNode = $xml.CreateElement("integer")
            $newNode.InnerText = $Val
            $Dict.ReplaceChild($newNode, $node) | Out-Null
        }
        default { throw "Unsupported plist type: $Type" }
    }
}

# ============================================================
# STEP 1 - DOWNLOAD OPENCORE
# ============================================================
Write-Host "`n[1/6] Preparing OpenCore $version RELEASE..." -ForegroundColor Cyan
if (-not (Test-Path "$ocExtract\X64\EFI\OC")) {
    if (-not (Test-Path $ocZip)) {
        Download-File -Url $ocUrl -Destination $ocZip
    }
    tar.exe -tf $ocZip | Out-Null
    if ($LASTEXITCODE -ne 0) {
        Remove-Item $ocZip -Force -ErrorAction SilentlyContinue
        throw "OpenCore ZIP archive is invalid."
    }
    if (Test-Path $ocExtract) { Remove-Item $ocExtract -Recurse -Force }
    New-Item -ItemType Directory -Path $ocExtract -Force | Out-Null
    Expand-Archive -LiteralPath $ocZip -DestinationPath $ocExtract -Force
    Remove-Item $ocZip -Force -ErrorAction SilentlyContinue
}

$sampleFile = Get-ChildItem -Path $ocExtract -Filter "Sample.plist" -Recurse | Select-Object -First 1
if (-not $sampleFile) { throw "Sample.plist not found in OpenCore archive." }
$ocDir = Split-Path (Split-Path $sampleFile.FullName)

$ocValidate = Get-ChildItem "$ocDir\Utilities\ocvalidate" -Filter "ocvalidate.exe" -Recurse | Select-Object -First 1
if (-not $ocValidate) { throw "ocvalidate.exe not found." }
$ocValidate = $ocValidate.FullName

$requiredFiles = @(
    "$ocDir\X64\EFI\BOOT\BOOTx64.efi",
    "$ocDir\X64\EFI\OC\OpenCore.efi",
    "$ocDir\X64\EFI\OC\Drivers\OpenRuntime.efi",
    "$ocDir\X64\EFI\OC\Drivers\OpenLinuxBoot.efi"
)
foreach ($file in $requiredFiles) {
    if (-not (Test-Path $file)) { throw "Required OpenCore file missing: $file" }
}

# ============================================================
# STEP 2 - DOWNLOAD EXT4 DRIVER
# ============================================================
Write-Host "`n[2/6] Preparing EXT4 filesystem driver..." -ForegroundColor Cyan
if (-not (Test-Path $ext4Driver) -or (Get-Item $ext4Driver).Length -eq 0) {
    Download-File -Url $ext4Url -Destination $ext4Driver
}

# ============================================================
# STEP 3 - MOUNT EFI PARTITION
# ============================================================
Write-Host "`n[3/6] Mounting EFI partition..." -ForegroundColor Cyan
if (Test-Path "$efiDrive\EFI\OC\config.plist") {
    Write-Host "EFI partition already accessible at $efiDrive"
} else {
    if (Test-Path $efiDrive) { throw "Drive S: is already in use." }
    & mountvol $efiDrive /S
    if ($LASTEXITCODE -ne 0) { throw "Could not mount EFI partition." }
    $mountedHere = $true
}

try {
    $liveConfig = "$efiDrive\EFI\OC\config.plist"
    if (-not (Test-Path $liveConfig)) { throw "Missing EFI configuration: $liveConfig" }

    $efiBoot    = "$efiDrive\EFI\BOOT"
    $efiOC      = "$efiDrive\EFI\OC"
    $efiDrivers = "$efiOC\Drivers"
    foreach ($folder in @($efiBoot, $efiOC, $efiDrivers)) {
        if (-not (Test-Path $folder)) { throw "Required EFI folder missing: $folder" }
    }

    # ============================================================
    # STEP 4 - BACKUP EXISTING EFI FILES
    # ============================================================
    Write-Host "`n[4/6] Creating EFI backup..." -ForegroundColor Cyan
    $backupDir = "$workDir\EFI-Backup-$(Get-Date -Format 'yyyyMMdd-HHmmss')"
    New-Item -ItemType Directory -Path $backupDir -Force | Out-Null

    $backupFiles = @(
        "$efiBoot\BOOTx64.efi",
        "$efiOC\OpenCore.efi",
        "$efiDrivers\OpenRuntime.efi",
        "$efiDrivers\OpenLinuxBoot.efi",
        "$efiDrivers\ext4_x64.efi",
        $liveConfig
    )
    foreach ($file in $backupFiles) {
        if (Test-Path $file) {
            $relative    = $file.Substring(3)
            $destination = Join-Path $backupDir $relative
            New-Item -ItemType Directory -Path (Split-Path $destination) -Force | Out-Null
            Copy-Item $file $destination -Force
        }
    }
    Write-Host "EFI backup saved to: $backupDir" -ForegroundColor Green

    # ============================================================
    # STEP 5 - UPDATE CONFIGURATION
    # ============================================================
    Write-Host "`n[5/6] Updating OpenCore configuration..." -ForegroundColor Cyan
    $settings = New-Object System.Xml.XmlReaderSettings
    $settings.DtdProcessing = [System.Xml.DtdProcessing]::Ignore
    $settings.XmlResolver = $null
    $reader = [System.Xml.XmlReader]::Create($liveConfig, $settings)
    $xml = New-Object System.Xml.XmlDocument
    $xml.XmlResolver = $null
    try { $xml.Load($reader) } finally { $reader.Close() }

    $rootDict = $xml.SelectSingleNode("/plist/dict")
    $misc     = Get-PlistChild $rootDict "Misc"
    $uefi     = Get-PlistChild $rootDict "UEFI"
    if (-not $misc -or -not $uefi) { throw "Missing Misc or UEFI section." }

    $boot = Get-PlistChild $misc "Boot"
    Set-PlistVal $boot "ShowPicker" "bool" "true"
    Set-PlistVal $boot "HideAuxiliary" "bool" "true"
    Set-PlistVal $boot "Timeout" "integer" "5"
    Set-PlistVal $boot "LauncherOption" "string" "Full"

    $sec = Get-PlistChild $misc "Security"
    Set-PlistVal $sec "AllowSetDefault" "bool" "true"
    Set-PlistVal $sec "ScanPolicy" "integer" "0"

    $dbg = Get-PlistChild $misc "Debug"
    Set-PlistVal $dbg "Target" "integer" "0"
    Set-PlistVal $dbg "DisplayLevel" "integer" "2147483650"
    Set-PlistVal $dbg "DisableWatchDog" "bool" "false"

    # Clear temporary debug Tools entries if present
    (Get-PlistChild $misc "Tools").RemoveAll()

    $quirks = Get-PlistChild $uefi "Quirks"
    Set-PlistVal $quirks "RequestBootVarRouting" "bool" "true"

    $drvArr = Get-PlistChild $uefi "Drivers"
    if (-not $drvArr -or $drvArr.Name -ne "array") { throw "UEFI Drivers array is missing." }

    $existingPaths = @()
    $template = $null
    foreach ($item in $drvArr.ChildNodes) {
        if ($item.Name -eq "dict") {
            $p = Get-PlistChild $item "Path"
            if ($p) {
                $existingPaths += $p.InnerText
                if ($p.InnerText -eq "OpenRuntime.efi") { $template = $item }
            }
        }
    }
    if (-not $template) { throw "OpenRuntime.efi entry not found." }

    foreach ($drv in @(
        @("ext4_x64.efi", "EXT4 filesystem driver for Linux"),
        @("OpenLinuxBoot.efi", "Linux kernel auto-detector")
    )) {
        if ($existingPaths -notcontains $drv[0]) {
            $newDrv = $template.CloneNode($true)
            Set-PlistVal $newDrv "Path" "string" $drv[0]
            Set-PlistVal $newDrv "Comment" "string" $drv[1]
            Set-PlistVal $newDrv "Enabled" "bool" "true"
            $drvArr.AppendChild($newDrv) | Out-Null
        } else {
            foreach ($item in $drvArr.ChildNodes) {
                $p = Get-PlistChild $item "Path"
                if ($p -and $p.InnerText -eq $drv[0]) { Set-PlistVal $item "Enabled" "bool" "true" }
            }
        }
    }

    $sw = New-Object System.IO.StringWriter
    $xwSettings = New-Object System.Xml.XmlWriterSettings
    $xwSettings.Indent = $true
    $xwSettings.IndentChars = "`t"
    $xwSettings.OmitXmlDeclaration = $true
    $xw = [System.Xml.XmlWriter]::Create($sw, $xwSettings)
    try { $xml.WriteTo($xw); $xw.Flush() } finally { $xw.Close() }

    $body = $sw.ToString() -replace ' />', '/>'
    $finalPlist = @"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
$body
"@
    $finalPlist = $finalPlist.Replace("`r`n", "`n")
    $configOut = "$workDir\config-dualboot.plist"
    [System.IO.File]::WriteAllText($configOut, $finalPlist, (New-Object System.Text.UTF8Encoding($false)))

    # ============================================================
    # STEP 6 - VALIDATE, INSTALL & CLEAN DEBUG FILES
    # ============================================================
    Write-Host "`n[6/6] Validating configuration..." -ForegroundColor Cyan
    & $ocValidate $configOut
    if ($LASTEXITCODE -ne 0) { throw "ocvalidate FAILED. EFI has NOT been modified." }
    Write-Host "Configuration validation successful." -ForegroundColor Green

    $installFiles = @(
        @{ Source = "$ocDir\X64\EFI\BOOT\BOOTx64.efi";             Target = "$efiBoot\BOOTx64.efi" },
        @{ Source = "$ocDir\X64\EFI\OC\OpenCore.efi";              Target = "$efiOC\OpenCore.efi" },
        @{ Source = "$ocDir\X64\EFI\OC\Drivers\OpenRuntime.efi";   Target = "$efiDrivers\OpenRuntime.efi" },
        @{ Source = "$ocDir\X64\EFI\OC\Drivers\OpenLinuxBoot.efi"; Target = "$efiDrivers\OpenLinuxBoot.efi" },
        @{ Source = $ext4Driver;                                   Target = "$efiDrivers\ext4_x64.efi" },
        @{ Source = $configOut;                                    Target = $liveConfig }
    )
    foreach ($item in $installFiles) {
        if (-not (Test-Path $item.Source)) { throw "Missing source: $($item.Source)" }
        Copy-Item -LiteralPath $item.Source -Destination $item.Target -Force
    }

    Remove-Item "$efiOC\Tools\OpenShell.efi" -Force -ErrorAction SilentlyContinue
    Remove-Item "$efiDrive\opencore-*.txt" -Force -ErrorAction SilentlyContinue

    Write-Host "`nInstallation completed successfully!" -ForegroundColor Green
    Write-Host "Backup location: $backupDir" -ForegroundColor Yellow
}
finally {
    if ($mountedHere) {
        Write-Host "Unmounting EFI partition..." -ForegroundColor Cyan
        & mountvol $efiDrive /D
    }
}

Write-Host "`nALL DONE! Reboot holding Option -> Control+Click EFI Boot." -ForegroundColor Green

Step 8F: Final Dual-Boot Lock & Verification

  1. Restart the MacBook Pro and hold Option (Alt).

  2. Hold Control and click EFI Boot (locks OpenCore back as your default bootloader).

  3. In OpenCore's 5-second menu, highlight Windows and press Ctrl + Enter to confirm it as the automatic default.

  4. Test booting Linux Mint using the arrow keys at the OpenCore menu:

    • (Dead GPU Only) Once on the Mint desktop, open Terminal and run cat /proc/cmdline to confirm radeon.modeset=0 is present.

9. Optional: Debugging OpenCore Boot Failures (DEBUG Build + OpenShell) Troubleshooting

By default, the RELEASE build of OpenCore strips out DEBUG_INFO messages—so if an OS fails to boot, the log may only show the final error line without showing why.

  1. Install OpenCore 1.0.8 DEBUG + OpenShell.efi (backing up your RELEASE binaries first) from a Linux Mint root/sudo terminal:

    Enable OpenCore DEBUG Build + File Logging + OpenShell
    sudo mkdir -p /root/oc_release_bak /tmp/ocdbg /boot/efi/EFI/OC/Tools
    sudo cp -a /boot/efi/EFI/Boot/bootx64.efi /boot/efi/EFI/OC/OpenCore.efi /boot/efi/EFI/OC/Drivers/OpenRuntime.efi /root/oc_release_bak/
    sudo rm -f /boot/efi/opencore-*.txt
    
    wget -O /tmp/ocdbg/oc.zip "https://github.com/acidanthera/OpenCorePkg/releases/download/1.0.8/OpenCore-1.0.8-DEBUG.zip"
    python3 -m zipfile -e /tmp/ocdbg/oc.zip /tmp/ocdbg
    
    sudo cp /tmp/ocdbg/X64/EFI/BOOT/BOOTx64.efi /boot/efi/EFI/Boot/bootx64.efi
    sudo cp /tmp/ocdbg/X64/EFI/OC/OpenCore.efi /boot/efi/EFI/OC/OpenCore.efi
    sudo cp /tmp/ocdbg/X64/EFI/OC/Drivers/OpenRuntime.efi /boot/efi/EFI/OC/Drivers/OpenRuntime.efi
    sudo cp /tmp/ocdbg/X64/EFI/OC/Tools/OpenShell.efi /boot/efi/EFI/OC/Tools/OpenShell.efi
    
    sudo python3 - <<'EOF'
    import plistlib
    p = "/boot/efi/EFI/OC/config.plist"
    with open(p, "rb") as f:
        d = plistlib.load(f)
    d["Misc"]["Debug"]["Target"] = 67
    d["Misc"]["Debug"]["DisplayLevel"] = 0x80000042
    d["Misc"]["Debug"]["DisableWatchDog"] = True
    d["Misc"]["Tools"] = [{
        "Arguments": "",
        "Auxiliary": False,
        "Comment": "Debug Shell",
        "Enabled": True,
        "Flavour": "UEFIShell:Shell",
        "FullNvramAccess": False,
        "Name": "OpenShell",
        "Path": "OpenShell.efi",
        "RealPath": True,
        "TextMode": False,
    }]
    with open(p, "wb") as f:
        plistlib.dump(d, f, sort_keys=False)
    print("DEBUG OpenCore + OpenShell enabled!")
    EOF
    
  2. Reproduce the failure & inspect:

    • Reboot and try selecting the failing OS once (this writes the full opencore-YYYY-MM-DD-HHMMSS.txt log to /boot/efi/).
    • (Optional) Select OpenShell in OpenCore and test launching a bootloader directly (e.g., fs0: then EFI\Microsoft\Boot\bootmgfw.efi) to see raw firmware/Windows errors such as BlInitializeLibrary failed.
    • Boot back into Linux Mint and read the full log:
      cat /boot/efi/opencore-*.txt
      
  3. Revert back to RELEASE once finished:

    • From Windows 11: Simply re-run the Step 8E script—it automatically restores RELEASE binaries, resets Target = 0, removes OpenShell.efi, and deletes old opencore-*.txt logs.
    • From Linux Mint (if Windows isn't booted): Copy /root/oc_release_bak/* back into /boot/efi/EFI/... and set d["Misc"]["Debug"]["Target"] = 0 and d["Misc"]["Tools"] = [] in config.plist.