qwerty12 / X250-Hackintosh

ThinkPad X250 running Mojave with Clover
60 stars 7 forks source link
hackintosh thinkpad x250

X250 Mojave

Follow whatever is written here at your own risk. I do not take responsibility for any damage to your device or files caused by following anything on this page.

This repository makes use of submodules. So, to clone this repository, run

git clone --recursive https://github.com/qwerty12/X250-Hackintosh.git

Otherwise, you'll be missing a ton of files.

I do not keep a complete EFI folder here. While it does undeniably make things easier, I don't want to be distributing old versions of software, and nor do I want the responsibility of keeping this repository up to date with every kext etc. update.
The TL;DR version of this is something along the lines of use the SSDTs from here, grab the config.plist from here, install Clover with the drivers I mention and install the kexts I mention. You'll then be missing the few QOL tweaks in this guide, however.

Specs of my X250

Component Notes
CPU 2.3 GHz Intel Core i5-5300u (vPro ugh) Make sure to read the CPUFriend short note later on in this write-up
RAM Crucial 16 GB 1600 MHz DDR3
IGPU Intel HD 5500 QE/CI works, of course
Screen 1920×1080 LG LP125WF2-SPB2 (00HN899) Not touchscreen, and brightness control works in Windows
Audio Realtek ALC3232 Speakers and headphone output works, as long as the modified ALCPlugFix is installed
Wi-Fi Dell DW1830 (Broadcom BCM43602) The original Intel 7265 (with BT) was replaced, as it's not supported by macOS
Bluetooth Dell DW1830 (Broadcom BCM20703A1) AirDropping to and from an iPad 4 works fine
Ethernet Intel I218-LM No idea if it actually works, but it shows up fine and Mieze's driver is well tested at this point in time
Touchpad Synaptics PS/2 The TrackPoint, with VoodooPS2Controller, also works should you feel more inclined to use that instead
WWAN Not present If your X250 has a WWAN card, then the DW1830 probably isn't the best choice as the DW1830 has three antenna ports - I use one of the WWAN antennas for the Wi-Fi card
SSD Samsung 860 EVO 512 GB SATA Works fine. I personally enable TRIM by running sudo trimforce enable, but some schools of thought say it's not needed when using APFS
Card reader Realtek something sinetek's driver (recommended: syscl's fork) might work somewhat; I have not tested it personally

Problems and other things you should be aware of

Thanks to

Also thanks to the Clover developers, Mieze for her Intel Ethernet driver, the acidanthera collective (most of the third-party kexts I have installed are theirs!), goodwin for ALCPlugFix, Dolnor/TimeWalker75a for CodecCommander and nguyenlc1993 for his ASUS K501L guide showing how to tune AppleGraphicsPowerManagement.kext and X86PlatformPlugin.kext to have the CPU idle at 800MHz and the GPU minimum speed one floor lower.

Preparation

UEFI settings

As it's 2019, I assume you are booting your current OS in UEFI mode. This write-up has never been tested - and never will be - with Clover in legacy mode.

You can update the BIOS too. This write-up was written on a laptop running 1.35. Use the latest UEFI version available. As this write-up utilises Clover ACPI hot patching, there is no dependency on a pre-patched DSDT specific to a certain UEFI version and configuration.

Assuming the default settings are applied, make the following changes to the UEFI configuration:

Setting Value Notes
Wake on LAN Off Whether it actually works in macOS I don't know, but by leaving it off, you might eliminate one cause of early wakeup from sleep
Always on USB Off This might be safe to leave on, I have no idea, but all my USB testing has been done with it off
USB 3.0 Mode Enabled Must be done. The SSDT, thanks to RehabMan, will turn off the EHCI controller, leaving only the XHCI controller present. Externally, this laptop only has USB 3.0 ports anyway. The only reason this would need to be disabled is if you're running a very old OS that has no USB 3.0 support.
Total Graphics Memory 512 MB Optional if you're using the standard 1366×768 screen; however, if you're using the 1920×1080 screen, then you will (anecdotally) see better performance with higher resolutions with this bumped up.
Intel Rapid Start Technology Off The OS needs to support this, which macOS doesn't, and according to fraisdos125, having it on may cause macOS not to boot.
Security Chip Disabled I don't know if macOS even supports a TPM, but according to fraisdos125, waking up from sleep may fail with it enabled.
Intel VT-d Feature Disabled You can keep this on if you use VT-d in other OSes, as the bootarg dart=0 and the dropping of the DMAR table will disable VT-d in macOS anyway
Secure Boot Disabled Unsurprisingly, Clover isn't signed.
CSM Support Yes You might be able to keep this off if you set a screen resolution in Clover lower than your standard one, but with this off and Clover and macOS set to use the native/same resolution of your screen, you'll see a very distorted logon screen that can only be fixed if you put your laptop to sleep and quickly cancel it. Clover can set the screen resolution to 1920×1080 in CSM mode, so it's not too big a loss.
Ethernet Adapter Enabled Even if you don't use the Ethernet card, MacBookPro SMBIOS profiles expect it as en0, not the Wi-Fi adapter

Preparing your USB stick

I'll mention this now in the hopes it will be remembered when the time comes: If you do manage to boot into macOS, DO NOT SIGN INTO ICLOUD. The config.plist provided here does not have a Mac serial number etc. Should you try to use iMessage etc. without a proper SMBIOS definition, your account may be barred from signing in on a non-iOS device and you'll need to ring up Apple support.

I won't rehash how to create a USB stick with Clover and the Mojave installer on it; RehabMan's comprehensive guide covers everything. dosdude1's patcher can download Mojave from the App Store on a Mac already running Mojave. Make sure to install the mentioned mount_efi script mentioned in that thread at the first available opportunity. This write-up does make the assumption you have your EFI partition already mounted when necessary.

There are tools and guides out there for Windows allowing the creation of an Apple recovery USB, from which you can install macOS proper. I did not test this method.

However, contrary to the guide, you should use a newer Clover version (not RehabMan's Clover), the config.plist from this repository, and the recommended kexts and UEFI drivers mentioned in this write-up. As RehabMan's guide explains, you'll need to install Clover again after managing to boot into an installed macOS copy on your disk drive using your Clover USB. The config.plist, kexts etc. needed will still be the same.

Clover configuration

Install Clover from here. I am currently running 4988 but use the latest version where possible. RehabMan's guide linked above goes into more detail on installing Clover. After viewing the Important Information and clicking Continue, make sure to click Customise. I would recommend selecting the following options in the Clover installer:

Making sure the EFI partition is mounted (search for mount_efi on this page), copy X250-Hackintosh/DSDT_src/srcs/RehabMan/OS-X-Clover-Laptop-Config/config_HD5300_5500_6000.plist into /Volumes/EFI/EFI/CLOVER/ and rename it to config.plist

The following separate UEFI drivers must also be installed into /Volumes/EFI/EFI/CLOVER/drivers/UEFI/ :

Regarding the APFS and HFS drivers: you'll almost certainly need HFSPlus for booting the macOS installer. The Mojave installer forces the use of APFS on an SSD, so you'll need ApfsDriverLoader to boot the resulting installation. You can get rid of one driver if you're using HFS or APFS everywhere, but keeping both around is the safest option. I haven't had any bad experiences with APFS personally in the short time I have been using a Hackintosh. APFS, unlike HFS+, supports sparse files. Something to bear in mind if you use NZBGet.

You might want to edit config.plist for the following:

Place the following kexts into /Volumes/EFI/EFI/CLOVER/kexts/Other (in brackets are the versions I have installed at the time of writing this write-up, but install the latest versions):

Copy DSDT_src/patched/SSDT-IALL.aml into /Volumes/EFI/EFI/CLOVER/ACPI/patched.

If you want to create your own version of SSDT-IALL from the dsl files, you can run DSDT_src/produceSSDTs.sh. You will need the XCode Command Line Tools (for patch and make at least) and RehabMan's iasl fork installed.

SSDT-IALL.aml comes from the SSDTs listed in DSDT_src/srcs/RehabMan/OS-X-Clover-Laptop-Config/hotpatch/SSDT-IALL.dsl. You can add your own SSDTs there and/or edit the SSDTs mentioned with your own changes and then run DSDT_src/produceSSDTs.sh to place a new SSDT-IALL.aml into the patched folder which you can then copy into Clover.

DSDT_src/srcs/RehabMan/OS-X-Voodoo-PS2-Controller/SSDT-Thinkpad_Clickpad.dsl has a (disabled) hack to set battery charging thresholds on both batteries. It's not the best place to put it, but I needed something that I know would execute at least once on startup without being triggered by a kext I wrote. It's there should you wish to enable it by uncommenting QTHR, and changing the thresholds set inside said function.

Injection of the audio layout number is done from the SSDT, see RehabMan's SSDT-HDEF and SSDT-HDEF. For the SSDTs where I made many changes, the repositories containing them originally are included - run git diff HEAD^ in each folder. This was done so that my changes can easily be separated from those of the original repositories, should you try to use parts of this write-up to run a version of macOS other than one this write-up targets. When you have time, I recommend looking at the patches applied in the config.plist, produceSSDTs.sh and SSDT-IALL.dsl to understand what is injected. You'll have a far better understanding of what is going on and what to possibly disable in case of problems.

Kext Updater is a handy tool for keeping many of the kexts mentioned above up to date. You may find Hackintool useful too.

Ethernet

Even if you don't plan on using the Ethernet card, it helps with iCloud etc. if the Ethernet card corresponds to the en0 device on the system instead of the Wi-Fi card.

Unless this is newer, install IntelMausiEthernet 2.5.0d0. 2.5.0 has an Intel AMT-related fix (isn't having a vPro laptop great?) which, for me at least, stops any Ethernet-related KPs during sleep. Thanks to Wheatley who noticed that IntelMausiEthernet 2.4.0 was causing his X250 to kernel panic while sleeping and let me know.

There is also another fork of Mieze's driver with her potential fix incorporated: IntelMausi. I am currently using this and have not experienced any KPs during sleep.

Wheatley informs me that using AppleIntelE1000e.kext instead [of IntelMausiEthernet 2.4.0] stopped the KPs for him; however, the Ethernet connection fails after a longer sleep. Rebuilding SSDT-IALL without SSDT-LANCPRW.dsl, and removing/disabling the corresponding "change IGBE._PRW to XPRW" patch inside config.plist, might help with this. It is an older driver, however, and by all accounts Mieze's driver supports more features: I would try using IntelMausiEthernet 2.5.0 first.

Post-install stuff

Getting working audio

Place CodecCommander (2.7.1) into /Library/Extensions.

Copy DSDT_src/Snikii/Lenovo-ThinkPad-X240/kexts/ALC3232.kext into /Library/Extensions

(These can't be loaded from Clover's kext folder: ALC3232 has a symlink to the AppleHDA binary in /System/Library/Extensions [which I don't think works well when stored on a FAT32 filesystem but I could be wrong] and CodecCommander is more reliable if it loads after AppleHDA - if CodecCommander is in the Clover folder, it's more likely that the sound won't be working after booting up.)

After copying everything, run the following in Terminal to ensure sufficient permissions are set on the kext and to rebuild the kext cache:

sudo chown -R root:wheel /Library/Extensions/CodecCommander.kext /Library/Extensions/ALC3232.kext
sudo chmod -R 755 /Library/Extensions/CodecCommander.kext /Library/Extensions/ALC3232.kext
sudo touch /System/Library/Extensions && sudo kextcache -u / ; sudo kextcache -i / && sudo kextcache -u /

Also install ALCPlugFix for working audio over headphones:

cd X250-Hackintosh # wherever it may be
cd DSDT_src/srcs/Snikii/Lenovo-ThinkPad-X240/Audio/alc_fix
sh ./install.sh

For some reason, and I'm hoping that it's something I messed up on this install, when headphones are plugged in and you play something with IINA/mpv/VLC and then pause it for a bit, there will be no sound when resuming playback, unless you put the laptop to sleep and wake it up again.

I don't have a fix, just a mere workaround to prevent power saving when headphones are plugged in:

Install Mac Audio Keepalive to Applications. Install Hammerspoon. Use the init.lua from this repository.

A lighter alternative to Mac Audio Keepalive is antipopd.

With Hammerspoon running, plugging in headphones will start Mac Audio Keepalive/antipopd and then stop it when unplugging them. As already alluded to, for some reason this problem doesn't occur when the speakers are active.

Getting the DW1830 working for Wi-Fi and Bluetooth

Again, the Intel 7265 that comes with the X250 is a good card, but it doesn't work with macOS. There have been various attempts over the years to port the Linux or BSD drivers to macOS but none seem to have really panned out. One alternative is to use a USB dongle, but these do not integrate with macOS's native Wi-Fi solution AirPort and require the use of their unwieldy software to operate the dongle. Not ideal.

The Broadcom-based Dell DW1830 works in Windows 10 (not any earlier versions AFAICT) with a driver you can find on the Dell website, and natively in macOS.

Before I go on, I will point out the following:

FakePCIID kexts etc. are not needed.

The one kext I do recommend you install for Wi-Fi (to the same place where Lilu.kext resides) is AirportBrcmFixup (2.0.0). brcmfx-country=#a has already been set in the config.plist boot arguments. Before installing this kext and setting this specific country code, my download speeds was a fraction of what it should have been (and what I was getting from Windows).

Bluetooth, Bluetooth, Bluetooth...

Note: sometimes, turning it off means you can't turn it back on again. I have no idea why.

Anyway, for Bluetooth to somewhat work using a DW1830, you need this. Download BrcmPatchRAM_Catalina_All.zip from the releases page. Read the instructions there carefully. Anyway, here's my summary: to load the kext at boot, you need to do one of the following:

However, I personally do not have the kext load at boot. Even with BRCM kext delays set very high - higher than those specified in the README of the original project - it still wasn't enough to avoid the 3 minute delays (!) I'd sometimes get on boot because the system would wait for the Bluetooth chip to be ready. And it seems like BrcmPatchRAM actually managed to upload the firmware successfully in many of these cases. I don't actually use Bluetooth myself, so the delay was unacceptable to me, but I'd still like to have the choice of being able to use Bluetooth.
So I have the kext load when I log in, instead. This is not a great idea if you rely on external Bluetooth peripherals like a mouse or keyboard being available at the login screen.

Take BrcmPatchRAM2.kext from the res folder of this repository. This is a version of OS-X-BrcmPatchRAM built from master with GridH's HCI_RESET fix and ESProcessing's upgrade delay introduction patches applied. These patches are essential for a reliable Bluetooth experience after resuming.
When (if) the patches are applied upstream, I will delete the copy here. OS-X-BrcmPatchRAM.tar.xz contains the modified source, but without the .git and firmware folders from RehabMan/OS-X-BrcmPatchRAM to save lots of space. BrcmFirmwareRepo.kext can be taken from the latest release of the original project.

If it exists, BrcmBluetoothInjector.kext needs to be placed into EFI/Clover/kexts/Other.

Place BrcmFirmwareRepo.kext into /Library/Extensions. Place BrcmPatchRAM2.kext into /kexts, a folder you'll need to create yourself. As demonstrated in the AppleHDA section, appropriate permissions must be set correctly (chmod 755, chown root:wheel) on the /kexts folder, BrcmFirmwareRepo.kext and BrcmPatchRAM2.kext.

Run EDITOR=nano sudo visudo and add the following rule at the end:

%admin ALL= NOPASSWD: /sbin/kextload /kexts/BrcmPatchRAM2.kext

Copy res/com.q12.brcmpatchloader.plist from your clone of this repository into ~/Library/LaunchAgents/

Run launchctl load -w ~/Library/LaunchAgents/com.q12.brcmpatchloader.plist to ensure it's set to load on login.

Restart or load the kexts yourself now. After doing so, open the Bluetooth Preference Pane and tick the option to show the Bluetooth icon in the status bar if you want. If you have too many status bar icons, try the freeware Dozer program.

Getting iCloud and iMessage to work

I can't explain this better than P1LGRIM's An iDiot's Guide To iMessage can. I've had a successful experience with it twice. Follow the given instructions to the letter and you'll be OK.

However, when you use Clover Configurator:

Save the generated config.plist anywhere but on the EFI partition. You can then manually copy and paste the SMBIOS section from the generated config.plist into your current config.plist on the EFI partition using a text editor.

Getting the CPU to idle at 800 MHz instead of 1.3 GHz

(Note: this is just simply installing CPUFriend, but without the SSDT for one certain model of SMBIOS only. stevezhengshiqi's script is also far more futureproof than my method of copying the plist from the running system and then running patch on it... If SSDT-CPUF.aml from a previous version of this write-up works for you, then there is no harm in continuing to use it. Otherwise, if you wish to switch to using this method for consistency's sake, then delete SSDT-CPUF.aml from EFI/.../patched and make sure SSDT/Generate/PluginType is set to true inside config.plist)

My CPU is capable of idling at a lower speed than the macOS default. CPUFriend can override the platform power profile to allow for the use of a lower idle speed. Read the instructions at https://github.com/stevezhengshiqi/one-key-cpufriend for information on how to run the script.

Once the script has done its job, make sure the EFI partition is mounted (mount_efi) and run mv ~/Desktop/CPUFriend*.kext /Volumes/EFI/EFI/CLOVER/kexts/Other (or just drag the kexts onto the EFI partition with Finder).

Getting the iGPU to idle one step lower

AppleGraphicsPowerManagement_Broadwell.kext has been removed from this repository. If you have it installed, I would recommend removing it. In my case, it was responsible for sporadic resets when resuming from sleep, and for hard system lockups when opening more than a few tabs in Chrome.

Undervolting the CPU and GPU

Entirely, entirely, optional but the option is there.

VoltageShift works fine on my X250.

I won't mention the settings I use, because all processors are different: you might be able to undervolt more than I can or you may have to undervolt less if you're running into system freezes or spontaneous resets. (I realised I was undervolting the CPU too much when attempting to update Xcode from the App Store and watching something with IINA at the same time would cause the laptop to reset every single time. Worked fine otherwise, just apparently not under heavy load.)

Using "Retina" resolutions with the 1080p screen

If you have a 1080p panel in your X250 (attempting this with a 1366×768 screen is a waste of time), you might find that the screen is too physically small to really be able to see things clearly at 1920×1080 all the time. What I do is this: run in 1680×944 in Retina/HiDPI mode - 3360×1888 downscaled - but switch to 1920×1080 when watching something with IINA.

To enable Retina mode, I recommend using one-key-hidpi. It's very easy to use, and will enable the Retina-style Display Preference Panel (even if the resolutions don't exactly match up with the description).

If you wish to do it somewhat more manually, use usr-sse2's fork of RDM. Use its edit function and add the following resolutions:

Horizontal Vertical HiDPI
1920 1080
3360 1888 ☑️
1680 944 ☑️

Reboot. If you don't see the new resolutions in the Display Preference Panel when holding the Option key, set it with RDM. You may have to do this on every startup. Again, one-key-hidpi works great.

See this for more information.

A better colour profile for the 1080p LP125WF2-SPB2

https://github.com/soleblaze/icc/raw/master/lp125wf2-spb2.icc

Source

Better font rendering with 1366×768

From the Terminal, run:

defaults write -g CGFontRenderingFontSmoothingDisabled -bool NO
defaults write NSGlobalDomain AppleFontSmoothing -int 2

Log out and log in again.

Making the Wi-Fi toggle key work

This isn't the best solution out there - this will not work at the login screen or in secure password entry prompts - but I simply do not have the time nor knowledge to implement something compatible with the existing Lenovo hotkey system to detect Fn keypresses.

With the SSDT here, pressing the Wi-Fi key will send F17 to the system.

You can use Hammerspoon to detect and perform specified actions on said keypresses, look at the two hs.hotkey.bind lines in this repository's res/init.lua file.

blueutil comes from Homebrew so install it if you want Bluetooth toggling to work. With this HS config, you can press Fn+F8 to toggle Bluetooth and if you press Ctrl+Fn+F8, Wi-Fi will be toggled. This assumes you're using a Wi-Fi and Bluetooth solution natively supported by macOS.

Disable hibernation

Hibernation might work if you install acidanthera's HibernationFixup, because RTCMemoryFixup isn't blocking the offsets used by hibernation. I've certainly not tried hibernation here.

The safe thing to do is to disable hibernation by running the following:

sudo pmset -a hibernatemode 0
sudo rm /var/vm/sleepimage
sudo mkdir /var/vm/sleepimage

and possibly

sudo pmset -a standby 0
sudo pmset -a autopoweroff 0

Source

Setting the default OS to boot into on startup

You can of course edit config.plist to your heart's content, but the config.plist here, and Clover of course, honours the choice made from the Startup Disk Preference Pane. There is the LastBootedVolume option available too.

Better mouse and keyboard settings

The keyboard layout in use should preferably be the PC variant of whatever keyboard layout you currently have set.

From the Trackpad Preference Pane, set secondary click to "click in bottom right corner" if you want to have the trackpad's buttons actually perform a right-click in addition to having a left-click option. I don't think the gestures there work; you're meant to go to the keyboard settings, edit a shortcut for something and perform your desired swipe action.

The laptop's PrtSc key is bound to F13 - you can edit the various screenshot shortcuts in the Keyboard Preference Pane to use the PrtSc key if you wish.

Caps lock indicator

The freeware Captin program can be used to show the caps lock status when the button is pressed. A hex editor can be used to zero out the OFF and ON labels, making it closer to how the Lenovo Windows OSD looks.

ThinkPadMuteLEDSetter

If anybody wants to make a better version of ThinkPadMuteLEDSetter, I'll be happy to use it. The source-only ThinkPadMuteLEDSetter can toggle the laptop's mute LED on demand, so it accurately reflects the current mute state even if the laptop was muted by means other than pressing the physical mute button.

Fan control

Based on 123marvin123's patch for the T430, there's a commented-out fan control method. It can be enabled by:

The fan curves were modified from the original patch - I don't mind the fan going off more often if it means I'll get lower temperatures overall. (Though of course, the longer the fan runs, the more quickly it will need to be replaced.)

I have also left a modified version of my DisableTurboBoostBattery kext in the res folder. This kext has been tested on 10.14.5. It will always disable Turbo Boost two minutes after it's been loaded (typically on startup) and 1 minute 10 seconds after resuming from sleep. It can be unloaded to re-enable Turbo Boost again.