midi1996 / P50-opencore-hackintosh

Lenovo ThinkPad P50 OpenCore macOS Install Guide
39 stars 4 forks source link

Lenovo ThinkPad P50 macOS Install with OpenCore

Intro

I've been able to install macOS on the Lenovo ThinkPad P50 through OpenCore. This guide will go through the setup on how to get it working but will not include any files other than ACPI and parts of the config, you will have to do the work youself.


Disclaimer

THIS GUIDE IS PROVIDED TO YOU FOR EDUCATIONAL PURPOSES. I AND ANYONE MENTIONED DIRECTLY OR INDIRECTLY IN THIS GUIDE WILL NOT BE HELD RESPONSIBLE FOR ANY HARM OR LOSS. BY FOLLOWING THIS GUIDE YOU AGREE TO TAKE FULL RESPONSIBILITY FOR ANYTHING THAT COMES OUT FROM THIS GUIDE.


My Hardware

What's working

A lot of things are working fine as expected:

What's not working

What's working badly/did not test

Things I'm trying to fix atm and need help with


Installing macOS (10.13 and later) | BigSur works as of the time of writing

Preparing your computer

Before installing macOS, you'll have to prepare your computer.

Make sure you're in UEFI mode, I'm not going to help you on legacy installs.

  1. ⚠️ BACKUP EVERYTHING, I will not take responsibility of anything that happens to your data.

  2. If you're dual booting with windows:

    1. Disable BitLocker if you have it enabled already.
    2. Download a disk partitioning tool (like Minitool Partition Wizard, EaseUS, Aomei...), I DO NOT recommend Gparted as it may break NTFS and can create partition overlapping if you're not careful (if you're ok with it and sure about it, go for it).
    3. Resize your C: partition to leave at least 60GB from the right (because windows will be broken if you resize from the other side)
      • In case there are any partitions after the free space, move them at the end of the Windows partition (usually it's Recovery)
      • In case the EFI partition is less than 200MB, make it larger by shrinking the windows partition from the side of the EFI by the amount you need to grow it and some more.
      • This is crucial as it will help use format it with APFS later on.
    4. Create an empty FAT32 partition in that free space (CRUCIAL, as macOS doesn't see "empty" space.)
  3. Boot to the Firmware Setup (AKA, BIOS Setup), use one of these methods:

    • Open Start > Settings > Updates and Security > Recovery > Advanced Startup > Troubleshoot > Advanced Options > UEFI Firmware Settings
    • Shutdown the laptop, press the power button once, press F1 (or keep holding it), you'll get into the UEFI Setup screen
    • Shutdown the laptop, press the power button once, press F12 (or keep holding it), you'll get into the boot menu, press Tab and select Enter Setup
    • Shutdown the laptop, press the power button once, press Enter (or keep holding it), press F1 to access the BIOS Setup.
    • If you're using GRUB2/Systemd-boot, select Boot Firmware Setup
  4. Configure your BIOS setting:

    1. Config

      1. Network

        • Disable all the stacks and Wake On LAN
          • Will fix issues with Intel Ethernet in the OS
          • If you don't disable Wake On LAN you may have sleep issues later on macOS. Fixable but less desirable solution.
      2. USB

        • Charge in battery mode
        • Can be ON optionally
      3. Display

        1. Boot Display Device
          • ThinkPad LCD
        2. Total Graphics Memory
          • 512MB
            • Not sure if that's needed, but it's fine as it is
        3. Graphics Device
          • Hybrid Graphics
      4. RAID

        1. Disabled.

          • If you set it up before, or had Windows installed on 1 drive with RAID enabled, you'll have to fix that

            1. Backup your files
            2. Disable RAID
            3. Boot Windows
            4. It will crash, boot into safe mode
            5. Reboot to windows normally
            6. You should be good now
          • If you set it up before, or had drives (2 or more) in RAID mode, macOS will not be able to see them (hardware raid is not supported)

          • Either add a 4th drive for macOS or disable raid altogether.

    2. Security

      1. Security Chip
        1. Security Chip Selection: Intel PPT
          • The TPM chip existence creates sleep issues on macOS.
          • Use this and keep the presence if you're using security chips on Windows
          • Enabling this will disable Intel TXT
      2. Memory Protection
        • Enabled (default)
      3. Virtualization
        1. Virtualization Technology
          • Enabled (optionally, if you're going to use VMs or other apps using virtualization)
        2. VT-d
          • Enabled (by default disabled, optionally, if you're going to use some encryption software -like bitlocker- or do some hardware passthrough on other OSes)
      4. I/O Port Access
        • Disable hardware you're not going to use. (In my case, SDCard slot, TB3 and ExpressCard and WWAN)
      5. Anti-Theft
        1. Computrace
        2. Disabled (by default)
          • WARNING: if you choose Permanently Disabled, you will not be able to enable it again
      6. Secure Boot
        • Secure Boot: Disabled
      7. Intel SGX
        • Enabled (default)
      8. Device Guard
        • Disabled (default)
    3. Startup

      1. UEFI/Legacy Boot
        1. UEFI Only
        2. CSM Support
          • NO
          • You can enable it but there is really no need to, it also slows down the boot process by a lot
      2. Boot Mode: Quick
    4. Restart

      1. Exit Saving Changes
  5. Reboot and make sure you can boot into Windows or Linux.


Ok, so I know that some of you may have a macOS machine nearby and some may not so I got the guide for both. The setup overview will be something like this:

  1. Prepare a vanilla bare macOS installer
  2. Install macOS and get it booting
  3. Add extra stuff from this guide

OpenCore Guide by Dortania

You're good to go and start your macOS installer

  1. You can boot your OpenCore drive by starting your laptop to the Boot Menu
    • By pressing Enter until you get the Boot Interrupt Menu, press F12
    • By pressing F12
  2. Boot your OpenCore USB
  3. When you get to the OpenCore Boot Picker, quickly press the number for macOS recovery/installer (you have 5 seconds)
  4. After macOS Installer starts up, select Disk Utility
    1. Select View > All Devices
      • ViewDevices
    2. Select the partition you made earlier
    3. Select Erase
    4. Select APFS as format and name the drive whatever you want
      • erase
    5. Select Erase
      • ⚠️ Disk Utility can suddenly crash and go back to the main menu, just wait like a minute or two, open Disk Utility again and see if the drive has been formatted
    6. Close Disk Utility once done and select Install macOS and install macOS obviously.
    7. The installer may reboot several times (at least once) and will automatically choose the drive to boot from, do not select/change the boot order. Make sure you start your USB drive on each reboot, you can do that automatically by moving the USB boot entry in Boot Options in your BIOS Setup to the top of the list order.
    8. Once macOS installed and get to the desktop (make sure you skip Apple Account login) you can now:
      1. Download MountEFI and install the Automator Quick Action
      2. While in Finder, click on Finder > Preferences > General > Show these items on the desktop > Hard disks and External disks
      3. You will see your SSD's partitions on the desktop, right click on the macOS partition > Quick Actions > Mount EFI > type in your password when you get the prompt. Your SSD's EFI will show up.
      4. Copy Your USB's FAT32 partition > EFI > BOOT and OC to Your SSD's EFI > EFI > .
      5. In your USB, backup EFI > BOOT > BOOTx64.EFI and replace it with OpenShell.efi that you will rename to BOOTX64.EFI, this way, your laptop will boot to the shell instead of OC
      6. Boot the USB from your firmware Boot Options
      7. Once you're greeted with the shell
        1. Type map -b, usually you'll find the first partition listed is the FAT32 readable partition, should be named FSX: where X is a number
          • In case you have multiple drives with FAT32 partitions your EFI might be something different from FS0, always check the files inside the partition you chose by running ls.
        2. Type FSX:
        3. Type bcfg boot add 00 FSX:\EFI\OC\OpenCore.EFI "OpenCore"
          • bcfg: Manages the boot and driver options that are stored in NVRAM. -- UEFI Spec sheet
          • boot: what bcfg needs to change
          • add: add entry
          • 00: entry order in the list (00 being the very first entry)
          • FSX:\EFI...: path to the EFI file
          • "OpenCore": name of the entry, you can choose whatever you want as long as it's 3 characters long and with the quotes.
        4. You can run the same commands for OpenShell.efi (with path \EFI\OC\Tools\OpenShell.efi) to make it accessible from the UEFI Boot Menu in case you need to fix/check things. (Optional, comes with security risks)
        5. Press Ctrl + Alt + Del and your laptop will reboot
      8. After that a new entry for the BOOTxOC is made and your laptop will boot to OC automatically.
        • Note that in the event of a Windows Update "replaces your EFI" (which it totally does NOT), you can simply check the boot order in the BIOS Setup > Boot and change the order as you see fit, or if suddenly the entry vanishes, you'll have to redo the steps above
        • I have yet to get this kind of issue
        • OpenCore's NVRAM clearing will reset the EFI boot entries to the defaults, rerun the above after an NVRAM clearing

Fixing macOS and friends

After installing macOS, getting OpenCore to boot, it's time to get the rest of it to work. In this repository you'll find a bunch of SSDTs with a plist for patches that comes with SSDTs (if needed). Note that these ACPI files are made with my machine in mind (the RAM, SSD and HDD differences do not matter), and depending on your motherboard revision and your UEFI Firmware version/variation/revision/options, you may need to change things, but usually you wouldn't need to but just in case, I'll link many resources to get information to fix things on your end.

ACPI Fixes

SSDT File Name Patch(es) to use with (if needed) Reason to use
SSDT-BAXX (OBSOLETE DO NOT USE) - Change Method(_WAK,1,N) to XXAK
- Change Method(GBIF,3,N) to XBIF
- Change Method(GBST,4,N) to XBST
- Change _L17 to XL17
- Change BAT1 to BAX1 (use only if you have one battery)
Battery patches to get battery reading in macOS. The SSDT has the patched OperationRegions + Methods, the OC patches rename the original methods to something else so that macOS uses the new patched methods in the SSDT.
This SSDT does not take in consideration a dual battery setup. If you're using 2 batteries, refer to SSDT-BATC (google).
This SSDT contains converted EC Registers from >8bits to 8bit chunks for YogaSMC.
SSDT-KBD (OBSOLETE DO NOT USE) - Change Method(_Q15,0,N) to XQ15
- Change Method(_Q14,0,N) to XQ14
- Change Method(_Q6A,0,N) to XQ6A
- Change Method(_Q16,0,N) to XQ16
- Change Method(_Q64,0,N) to XQ64
- Change Method(_Q66,0,N) to XQ66
- Change Method(_Q67,0,N) to XQ67
- Change Method(_Q68,0,N) to XQ68
- Change Method(_Q69,0,N) to XQ69
Contains Hotkey fixes for Brightness keys, Volume keys and the other keys are all mapped to some Fn key that I totally forgot about. You can map them separately with Karabiners or Keyboard preference panel. OBSOLETE. Use YogaSMC.
SSDT-NoHybGfx none Disables the Nvidia dGPU following bumblebee guidelines (Credit: Maemo)
SSDT-PNLF none Fixes brightness by adding a PNLF device.
SSDT-SBUS-MCHC (DO NOT USE) none Adds SBUS and MCHC devices, needed for macOS. DO NOT USE. It will break VoodooRMI support.
SSDT-Thinkpad_Trackpad none Contains VoodooPS2Controller settings to fix the TrackPoint jumpiness.OBSOLETE. Use VoodooRMI.
SSDT-USBX none Adds USB properties for AppleBusPowerController for the USB ports, helps with the 10 W output support.
SSDT-XCPM none Adds plugin-type property to the CPU scope device, helps with CPU Power management. Contains CPUFriend Data set to Power (not Performances).
SSDT-XOSI _OSI to XOSI Renames the _OSI (Operating System Interface Level) method so that we can add macOS identification in the SSDT, this way, features that would only be enabled if Windows was detected would be also available for macOS. In our case it actually doesn't really matter, but just to be sure that it doesn't limit anything later down the road on UEFI Firmware updates.
none Change SAT1 to SATA To enable proper compatibility with macOS SATA drivers (for power management). You can also use ThirdPartyDrives in config.plist\Kernel\Quirks.
none FPU to MATH To enable MATH device. macOS look for MATH device.
none Change XHCI to XHC To disable macOS's auto-attachement to the XHCI device and applying the SMBIOS's native USB port mapping, we don't want that, and we're using our own USBMap anyways.
none Instant Wake Fix (_PRW 0x6d, 0x04) to (0x6d, 0x00) Fixes Instant wake after sleep caused by the XHCI driver. Thanks to u/TopuzWats for reminding me!

Kernel Extensions (Kexts)

Kext Use Depends on Source Download link
Lilu An open source kernel extension bringing a platform for arbitrary kext, library, and program patching throughout the system for macOS. none https://github.com/acidanthera/Lilu https://github.com/acidanthera/Lilu/releases
VirtualSMC Advanced Apple SMC emulator in the kernel. Lilu https://github.com/acidanthera/VirtualSMC https://github.com/acidanthera/VirtualSMC/releases
WhateverGreen Various patches necessary for certain ATI/AMD/Intel/Nvidia GPUs Lilu https://github.com/acidanthera/WhateverGreen https://github.com/acidanthera/WhateverGreen/releases
AppleALC An open source kernel extension enabling native macOS HD audio for not officially supported codecs without any filesystem modifications. Lilu https://github.com/acidanthera/AppleALC https://github.com/acidanthera/AppleALC/releases
USBMap Maps the USB ports by personality and address none Made by USBMap in this repository
AirportBrcmFixup An open source kernel extension providing a set of patches required for non-native Airport Broadcom Wi-Fi cards. Lilu https://github.com/acidanthera/AirportBrcmFixup https://github.com/acidanthera/AirportBrcmFixup/releases
CPUFriend A Lilu plug-in for dynamic power management data injection. Will read the Data from the companion kext (CPUFiriendDataProvider) or SSDT (in our case SSDT-XCPM). Lilu https://github.com/acidanthera/CPUFriend https://github.com/acidanthera/CPUFriend/releases
VoodooI2C 1 VoodooI2C is a project consisting of macOS kernel extensions that add support for I2C bus devices. In our Case Fore OpenCore, make sure you put the Dependencies (found in VoodooI2C.kext/Contents/Plugins) in this order: - VoodooI2CServices
- VoodooGPIO
- VoodooI2C
https://github.com/alexandred/VoodooI2C https://github.com/alexandred/VoodooI2C/releases
VoodooI2CHID 1 A satellite kext for VoodooI2C to enable support for I2C-HID support, like the touchscreen. VoodooI2C https://github.com/alexandred/VoodooI2C/ https://github.com/alexandred/VoodooI2C/releases
NoTouchID Lilu plugin for disabling Touch ID support. Helps with the lag/hang when being asked for password input when using MBP13,1 and later SMBIOSes. Lilu https://github.com/al3xtjames/NoTouchID https://github.com/al3xtjames/NoTouchID/releases
SMCBatteryManager VirtualSMC Plugin to enable battery states readings. VirtualSMC https://github.com/acidanthera/VirtualSMC https://github.com/acidanthera/VirtualSMC/releases
SMCProcessor VirtualSMC Plugin to enable CPU information readings (Temp, Freq...) VirtualSMC https://github.com/acidanthera/VirtualSMC https://github.com/acidanthera/VirtualSMC/releases
VoodooPS2Controller Enables PS/2 Support on macOS. none https://github.com/acidanthera/VoodooPS2/ https://github.com/acidanthera/VoodooPS2/releases
BrcmBluetoothInjector The BrcmBluetoothInjector.kext is a codeless kernel extension which injects the BT hardware data using a plist; it does not contain a firmware uploader. none https://github.com/acidanthera/BrcmPatchRAM https://github.com/acidanthera/BrcmPatchRAM/releases
BrcmFirmwareData Holds all the configured firmwares for different Broadcom Bluetooth USB devices BrcmBluetoothInjector https://github.com/acidanthera/BrcmPatchRAM https://github.com/acidanthera/BrcmPatchRAM/releases
BrcmPatchRAM3 A macOS driver which applies PatchRAM updates for Broadcom RAMUSB based devices. (Note that BrcmPatchRAM3 is to be used with 10.15, it works with 10.14 but BrcmPatchRAM2 is recommended for that OS version, OpenCore can inject either of them depending on the OS version, make sure you configure it in the config.plist) - BrcmBluetoothInjector
- BrcmFirmwareData
https://github.com/acidanthera/BrcmPatchRAM https://github.com/acidanthera/BrcmPatchRAM/releases
NVMeFix NVMeFix is a set of patches for the Apple NVMe storage driver, IONVMeFamily. Its goal is to improve compatibility with non-Apple SSDs. It may be used both on Apple and non-Apple computers. Lilu https://github.com/acidanthera/NVMeFix https://github.com/acidanthera/NVMeFix/releases
VoodooRMI2 Synaptics RMI driver for macOS, touchpad. - VoodooSMBus (comes with VoodooRMI zip as of writing)
- VoodooPS2Trackpad (from VoodooPS2Controller)
https://github.com/VoodooSMBus/VoodooRMI/ https://github.com/VoodooSMBus/VoodooRMI/releases
VoodooSMBUS SMBUS Driver. Use the one provided by VoodooRMI repository. none https://github.com/VoodooSMBus/VoodooRMI/ https://github.com/VoodooSMBus/VoodooRMI/releases
BrightnessKeys Self-explanatory Lilu https://github.com/acidanthera/BrightnessKeys https://github.com/acidanthera/BrightnessKeys/releases
HibernationFixup A Lilu plugin intended to fix hibernation compatibility issues Lilu https://github.com/acidanthera/HibernationFixup https://github.com/acidanthera/HibernationFixup/releases
YogaSMC Support for a lot of things including: Battery limiter, Fan Speed reading, Hotkeys... VirtualSMC https://github.com/zhen-zen/YogaSMC https://github.com/zhen-zen/YogaSMC/releases (or https://github.com/zhen-zen/YogaSMC/actions for latest commits)
ECEnabler Allows reading Embedded Controller fields over 1 byte long, vastly reducing the amount of ACPI modification needed (if any) for working battery status. Lilu https://github.com/1Revenger1/ECEnabler https://github.com/1Revenger1/ECEnabler/releases

Note:

1 : Only use this if you have a touchscreen and you want to use it with macOS. Not really the best way to interact with macOS as the driver will turn the touchscreen into a giant trackpad which is uncomfortable if you're going to invoke Launchpad or the like. Not really needed. Contains VoodooInput which will conflict with VoodooPS2 and VoodooRMI, keep VoodooInput from VoodooRMI.

2 : Adding VoodooRMI will cause ProperTree to show you an error message about Duplicate Kexts (VoodooInput in this case), you need to disable one of them, selecting "Yes" in the ProperTree prompt will do that for you.

2 : This kexts contains plugin kexts like RMISMBUS and RMII2C, disable the I2C one.

You should be all done for now. All of these patches will be in oc-additions.plist. You will have to merge them in your config.plist that you made earlier with the OpenCore guide.

For intel WiFi:

Kext Use Depends on Source Download Link
IntelBluetoothFirmware Intel...Bluetooth Firmware package none (but requires IntelBluetoothInjector loaded before it) https://github.com/OpenIntelWireless/IntelBluetoothFirmware https://github.com/OpenIntelWireless/IntelBluetoothFirmware/releases
IntelBluetoothInjector Injects intel bluetooth IDs into the system to make it load. none https://github.com/OpenIntelWireless/IntelBluetoothFirmware https://github.com/OpenIntelWireless/IntelBluetoothFirmware/releases
AirportItlwm3 WiFi driver that uses RE's IO80211. Works with native WiFi menu. none (but requires IO80211, which is already a system kext) https://github.com/OpenIntelWireless/itlwm/ https://github.com/OpenIntelWireless/itlwm/releases
Itlwm3 (non-AirPort) Same as the above but requires HeliPort (from the same repository) to manage networks. none https://github.com/OpenIntelWireless/itlwm/ https://github.com/OpenIntelWireless/itlwm/releases

3 : DO NOT install both, use only one of them.

Also without me telling you, you will not need to add the broadcom kexts if you're using intel.


Issues and small fixes and whatever I can't put in a category lol

Type C

No (not now)

USB port mapping

Port Address Physical Location Internal/External Enabled/Disabled in USBMap
HSP0/SSP0 00000001|00000011 Back Port - Power Share E E/E
HSP1/SSP1 00000002|00000012 Back Port - next to Ethernet Port E E/E
HSP4/SSP4 00000005|00000015 Right Port - next to mDP E E/E
HSP5/SSP5 00000006|00000016 Right Port - next to 3.5mm jack port E E/E
HSP7 00000008 Integrated Camera module I E
HSP8 00000009 Fingerprint Sensor I D
HSP9 0000000A Wacom Touchscreen + Pen I E
HSPC 0000000F X-Rite Pantone Color Sensor I D
HSPD 0000000E Bluetooth USB Port I E

WiFi Card replacement

You will need to disassemble your laptop:

  1. Remove the battery and power
  2. Remove the back cover
    • The screws stay retained in the cover
  3. You will find 3 screw holes for the keyboard, THEY ARE LONG and they are labeled with a keyboard icon.
  4. Open back the laptop screen and slide the keyboard towards the screen (DO NOT LIFT, just push it)
  5. The keyboard will loosen up on bottom, you can lift it GENTLY from the bottom (aka the tracepoint buttons area)
  6. Disconnect the TrackPoint and Keyboard ribbons (BE CAREFUL! THEY VERY FRAGILE)
  7. You have now access to the extra 2 RAM slots and WWAN and WLAN slots.

Compatible WiFi Cards

As of now there are a lot of WiFi cards that are compatible:

WiFi card Quirks and issues
Dell's DW1560
Lenovo's PN 04X6020
Expensive AF now because they're not in production anymore.
Lenovo's part NEEDS dremeling, not really recommended if you don't know how to do that.
Dell's DW1820A
Lenovo's 00JT494/00JT493
Cheap now, works.
Requires adding pci-aspm-default = 0 (number) to its device path under DeviceProperties (for my case it's under PciRoot(0x0)/Pci(0x1c,0x0)/Pci(0x0,0x0), you can check yours by using gfxutil from Acidanther's repo, however technically, it should be the same)
Has NaTiVe linux support which is 10/10
There is another taping solution from here: tmx thread
Bluetooth firmware fixed with the latest BrcmPatchRam from acidanthera.
Update: Use the taping solution, the aspm trick doesn't always work
Apple's BCM94360CS2 or BCM943602CS CS2 is limited to 867Mbps on AC and up to 300Mbps on N (2.4Ghz), 2CS goes up to 1.3Gbps.
CS2 uses 2 antennae, 2CS needs 3 antennae! (You will have to use one of the WWAN antennae)
Technically any card that would fit there would work, CD variant can't because of the antenna connector (M.FL vs MHF4, we need the latter, you will have to use converters)
You will have to use a 12 + 6 to A/E adapter like shown in this album. Since I don't use a WWAN, it made a snug fit there.
I got the card for $10, now the price has gone up.
Intel WiFi cards Yes: Check here and [here](OpenIntelWireless/itlwm: Intel Wi-Fi Drivers for macOS (github.com)). You will not have AWDL support (AirDrop, Instant Hotspot...) but you'll get basic networking and internet.
all of the above You might want to brcmfx-country=#a to unlock some bands and get higher speeds. (You may also put your own country identifier)

HiDPI Resolutions (for 4k screens users)

By default, if you get proper screen resolution after macOS install, the screen res would be at a 200% DPI, which is for our devices 1920 by 1080, looks small on paper but its actual resolution is twice that at 3840 by 2160 which, you guessed it, your native screen resolution. It makes text sharper, elements of the screen bigger and more comfortable to use, however unlike windows, macOS does not have non-integer scaling, so you will not have a % you can choose from, but you'll have to give macOS a resolution to emulate and then "x2"s it as a Retina resolution. (The example bellow is taken from my tablet's guide, which has a 3:2 aspect ratio and a screen resolution of 2736x1824, the logic is the same).

Hibernation:

Some may start using macOS a lot on this device because it's that good, which may require you to hibernate your device from time to time. By enabled DiscardHibernationMap in Booter > Quirks, you'll be able to successfully enter and exit hibernation (as far as my testing goes). You will also need to set some arguments for HibernationFixup to get it working smoothly following their boot arguments here. For my preferences, I chose the following:

Which gives me a sum of 39 and I use it with hbfx-ahbm= boot argument.


Documentations and guides that you must read/follow in case you need assistance:


And with that, Good Luck and let me know if you succeeded. Also I would love to get fixes and changes to this guide to improve on it. Open an Issue or make a PR and I'll review it.

Credits

Thank you.