T450-Hackintosh
Switch branches/tags
Nothing to show
Clone or download

README.rst

Title:Install Hackintosh on Thinkpad T450 20BV-A00YCD
Author: Shmilee
Date: 2015-11-02

Introduction

This guide is for the Thinkpad T450 20BV-A00YCD (Lenovo Reference Doc).

CPU: Intel(R) Core(TM) i5-5200U @ 2.20GHz

RAM: 4GB x 2 DDR3L

Graphics: HD5500 + GeForce 940M, 1366x768 LED Non-Touchscreen

Audio: ALC3232

Ethernet: Intel I218-V

WLAN: Intel 7265

Specifically, this is only the history and notes of my Hackintosh installation. Here is my gpt disk partition table:

Device Start End Sectors Size Type
/dev/sda1 2048 1050623 1048576 512M EFI System
/dev/sda2 1050624 42993663 41943040 20G Linux filesystem
/dev/sda3 42993664 105908223 62914560 30G Apple HFS/HFS+
/dev/sda4 105908224 189794303 83886080 40G Microsoft basic data
/dev/sda5 189794304 441452543 251658240 120G Microsoft basic data
/dev/sda6 441452544 902825983 461373440 220G Linux filesystem
/dev/sda7 902825984 959449087 56623104 27G Microsoft basic data
/dev/sda8 959449088 976773134 17324047 8.3G Apple boot

I have upgraded the BIOS version to 1.18, and installed Archlinux on /dev/sda2, Windows 8.1 on /dev/sda4. /dev/sda7 is used to share data between linux osx and win. Device /dev/sda3 is reserved for Hackintosh, and /dev/sda8 is used to restore Hackintosh Install dmg.

Prepare

Hackintosh, OS version: Yosemite(10.10.5) or El Capitan(10.11.1)

Install Clover

Download Clover Bootable ISO, extract archive and find the Clover-*-X64.iso file.

Note:
10.11.1 requires Clover v3292 or later.

Download driver HFSPlus.efi.

Download themes: MavericksLogin and minimal.

In Archlinux, mount Clover-*-X64.iso, and mount ESP on /boot, then copy files that I need.

cd <Clover-ISO mount dir>/EFI/CLOVER/
find drivers64UEFI \
    drivers-Off/drivers64UEFI \
    kexts/Other \
    tools/{bdmesg.efi,Shell64U.efi}\
    CLOVERX64.efi \
    config.plist \
    -exec install -D {} /boot/EFI/Clover/{} \;
# drivers
cd <Download dir>/
install HFSPlus.efi /boot/EFI/Clover/drivers64UEFI/HFSPlus.efi
rm /boot/EFI/Clover/drivers64UEFI/VBoxHfs-64.efi
mv /boot/EFI/Clover/{drivers-Off/,}drivers64UEFI/OsxAptioFix2Drv-64.efi
# themes
mkdir /boot/EFI/Clover/themes
cd clover-minimal
find . -exec install -D {} /boot/EFI/Clover/themes/minimal/{} \;
cd MavericksLogin
find . -exec install -D {} /boot/EFI/Clover/themes/MavericksLogin/{} \;
# remove .DS_Store
find /boot/EFI/Clover/ -name '.DS_Store' -exec rm -vi {} \;
# chainloader in grub2
install /boot/EFI/Clover/CLOVERX64.efi /boot/EFI/boot/bootx64.efi
# add efi bootolder
efibootmgr -c -L 'Mac OS X' -d /dev/sda -p 1 -l \\EFI\\Clover\\CLOVERX64.efi

Make El Capitan icon for clover theme. First, Get the ProductPageIcon from BaseSystem.dmg.

$ cp /Volumes/OS\ X\ Base\ System/Install\ OS\ X\ El\ Capitan.app/\
> Contents/Resources/ProductPageIcon_512x512.tiff ./

According to the logo icns of theme MavericksLogin, make a new png os_cap.png from ProductPageIcon. Upload os_cap.png to http://www.easyicon.net/language.en/covert/, and save as os_cap.icns. Copy it to the themes directory.

BIOS Setting

See jcsnider's guide.

Some difference here:

  • USB 3.0 Mode, Enabled, because I will restore the install image to disk partition /dev/sda8.
  • Security > Virtualization, Both Enabled, because the config.plist below will include dart=0 in boot arguments.
  • Startup > CSM Support Yes, reduce boot screen garble.

Config for T450

Download config.plist for HD5500 from RehabMan's github repository OS-X-Clover-Laptop-Config. Then copy it to /boot/EFI/Clover/config.plist, change the ScreenResolution, Theme, Timeout, add CPU Frequency, and set GUI -> Scan -> Legacy to false. Enable KextsToPatch: Disable minStolenSize for 10.10.x and 10.11.x, Boot graphics glitch. Change SMBIOS, MacBookAir7,2 and add SerialNumber C1D[XXXXX(replace 5X)]G942.

Save the changed config.plist as config-mba72.plist.

Download kexts.

# add config.plist
cp /boot/EFI/Clover/{config.plist,config.plist.default}
install config-mba72.plist /boot/EFI/Clover/config.plist
# Install the kexts to Other for 10.10.x and 10.11.1
cd /boot/EFI/Clover/kexts/Other/
# add VoodooHDA.kext
# add VoodooPS2Controller_X1Carbon.kext
# add AppleIntelE1000e.kext or IntelMausiEthernet.kext

Install Image

Download Yosemite 10.10.5 (14F27) InstallESD.dmg (MD5:ff4850735fa0a0a1d706edd21f133ef2) or El Capitan 10.11.1 (15B42) InstallESD.dmg (MD5:3332a4e05713366343e03ee6777c3374).

And, OSInstall MBR patch should be used too, according to the partition tables.

  1. Restore BaseSystem.dmg to HFS partition.
  2. Copy InstallESD.dmg/BaseSystem.dmg to (HFS partition) BaseSystem.dmg/
  3. Copy InstallESD.dmg/BaseSystem.chunklist to (HFS partition) BaseSystem.dmg/
  4. Copy InstallESD.dmg/AppleDiagnostics.dmg to (HFS partition) BaseSystem.dmg/
  5. Copy InstallESD.dmg/AppleDiagnostics.chunklist to (HFS partition) BaseSystem.dmg/
  6. Remove (HFS partition) BaseSystem.dmg/System/Installation/Packages
  7. Copy InstallESD.dmg/Packages to (HFS partition) BaseSystem.dmg/System/Installation/Packages
  8. OSInstall.mpkg replace to /System/Installation/Packages/OSInstall.mpkg
  9. OSInstaller replace to /System/Library/PrivateFrameworks/OSInstaller.framework/Versions/A/OSInstaller

Install MAC OS X

Reboot, enter clover, install Yosemite or El Capitan to /dev/sda3.

If an kernel error about AppleIntelBDWGraphicsFramebuffer occurs to you, please set graphics fakeid = 0x16160002.

Hint:
In clover screen, Options -> Graphics Injector menu -> FakeID. Default value is 0x00000000, change it to 0x16160002 or 0x16160004.

Post-Installation

Graphics HD5500

As the AppleIntelBDWGraphicsFramebuffer error is still there, we should make HD5500 work first.

Here is a guide for Intel HD Graphics 5500 on OS X Yosemite. There are 2 ways to deal with DVMT pre-allocated memory in BIOS. But as guide page 20 and guide page 28 said, STEP 2.2 (grub shell and setup_var) is not working here. The "Security: <guid>" things may lock these options to keep people from changing them.

Here is what I get from BIOS 1.18 rom.

Result:

0x2685E     Grayout If: {19 82}
0x26860             Security: 85B75607-F7CE-471E-B7E4-2AEA5F7232EE {60 92 07 56 B7 85 CE F7 1E ...
0x26872                     Not {17 02}
0x26874             End {29 02}
0x26876             Setting: DVMT Pre-Allocated, Variable: 0x37 {05 A6 61 04 62 04 1D 27 0A 00 ...
0x2689C                     Default: 8 Bit, Value: 0x1 {5B 1B 00 00 00 01 00 00 00 00 00 00 00 00 0...
0x268B7                     Default: 8 Bit, Value: 0x1 {5B 1B 01 00 00 01 00 00 00 00 00 00 00 00 0...
0x268D2                     Option: 32MB, Value: 0x1 {09 1C 63 04 00 00 01 00 00 00 00 00 00 00 00 ...
0x268EE                     Option: 64MB, Value: 0x2 {09 1C 64 04 00 00 02 00 00 00 00 00 00 00 00 ...
0x2690A                     Option: 128MB, Value: 0x4 {09 1C 65 04 00 00 04 00 00 00 00 00 00 00 00...
0x26926             End of Options {29 02}
0x26928     End If {29 02}

So, we have to patch the AppleIntelBDWGraphicsFramebuffer binary file in /S/L/E/AppleIntelBDWGraphicsFramebuffer.kext/Contents/MacOS/.

Use app:HexFiend, find 39CF763C and replace it with 39CFEB3C for 10.10.x, replace 4139c4763e with 4139c4eb3e for 10.11.x.

Note:
The hexadecimal digits are get by echo -n Oc92PA== | base64 -d | hexdump -C, string Oc92PA== read from config_HD5300_5500_6000.plist.

Do not forget to fix the kext's permissions. Othewise, you may get an error said:

Graphics driver failed to load: could not register with Framebuffer driver!

The recommended and easier way is just to modify EFI/Clover/config.plist, which is already done by config-mba72.plist.

Boot Screen Garble

Enable KextsToPatch Boot graphics glitch, which is already done by config-mba72.plist.

SSDT for PM

Use Piker-Alpha's ssdtPRGen.sh which is a script to generate a SSDT for Power Management. We'd better download the latest Beta branch.

Run ./ssdtPRGen.sh, copy ~/Library/ssdtPRGen/SSDT.aml to EFI/Clover/ACPI/Patched/.

Download AppleIntelCPUPowerManagementInfo.kext from PikeRAlpha's thread. Install it to EFI/Clover/kexts/Other/.

Reboot, and use this terminal command to show the data:

sudo grep "AICPUPMI:"  /var/log/system.log

DSDT Common Patches

Download MaciASL from Rehabman's Bitbucket repository os-x-maciasl-patchmatic. Download patches from Rehabman's github repository Laptop-DSDT-Patch.

Download IORegistryExplorer from toleda's thread

Dump DSDT and SSDT tables in Archlinux:

mkdir ./ACPI-Tables/
find /sys/firmware/acpi/tables \( -name "*SSDT*" -o -name '*DSDT*' \) -exec sudo cp {} ./ACPI-Tables/ \;
sudo chmod 644 ./ACPI-Tables/*

Copy tables to Mac OS X, then use iasl in MaciASL to disassemble them.

/Applications/MaciASL.app/Contents/MacOS/iasl5 -e ./ACPI-Tables/SSDT* -dl ./ACPI-Tables/DSDT

Copy DSDT.dsl to your work directory, then apply patches using MaciASL.

Note:
Both disassemble DSDT and apply patches should be in Mac OS X. If you disassemble DSDT in Linux, then apply patches in Mac OS X, some patches may have no effect.

Here is a list of the patches that are commonly needed. [1]

  • [sys] HPET Fix
  • [sys] Add IMEI
  • [sys] IRQ Fix
  • [sys] Fix Mutex with non-zero SyncLevel
  • [sys] OS Check Fix (Windows 8)
  • [sys] Fix PNOT/PPNT
  • [sys] RTC Fix
  • [sys] SMBUS Fix
  • [sys] Fix _WAK Arg0 v2
Hint:
Apply one at a time. Verify it creats no error.

Save the result named as patched_1_DSDT.dsl and patched_1_DSDT.aml. Copy aml file to EFI/Clover/ACPI/patched/DSDT.aml, and test it.

DSDT Wake Fix

For instant wake problem, we can run command:

sudo grep 'Wake reason'  /var/log/system.log

to get the reason:

... kernel[0]: Wake reason: IGBE XHCI (Network)

Then, search IGBE in DSDT.

Device (IGBE)
{
    Name (_ADR, 0x00190000)  // _ADR: Address
    Name (_S3D, 0x03)  // _S3D: S3 Device State
    Name (RID, 0x00)
    Name (_PRW, Package (0x02)  // _PRW: Power Resources for Wake
    {
        0x6D,
        0x04
    })
}

We can remove _PRW names to prevent instant wake, but it seems to work better if _PRW is present, but returns 0 (original was 0x04 or 0x03) for sleep state. So we apply the flowing patch to patched_1_DSDT.dsl:

  • ./DSDT/patch-files/2_usb_prw.txt

After wake up from sleep, power led and red dot light continute to blink.

We can fix this by adding control method _SI._SST into method _WAK. (Ref: XDleader555's post) According to ACPI Specification Revision 5.0a 9.1.1 _SST(System Status), Arg0 should be 1.

Here is the patch: ./DSDT/patch-files/2_led_blink.txt. Save the result named as patched_2_DSDT.dsl and patched_2_DSDT.aml. Test it.

DSDT Fn and Brightness

Save the Fn Key Fix code posted in Ludacrisvp's t440s guide, named as Fn_Keys.txt, and apply it. We also need a brightness fix patch in Rehabman's github repository Laptop-DSDT-Patch.

  • [igpu] Brightness fix (Haswell)

Save the result named as patched_3_DSDT.dsl and patched_3_DSDT.aml. Test it.

Then Fn+F5 and Fn+F6 will work well. It sames there is no need to patch AppleBacklight and AppleBacklightInjector.

Issue:
F14(Fn+F10) is also for brightness down. F15(Fn+F11) is for brightness up.
Solution:
Set Keyboard Shortcuts for Spotlight and App switcher.

DSDT Battery Status

Download RehabMan's ACPIBatteryManager.kext, install the kext to EFI/Clover/kexts/Other/.

Use the battery patch: ./DSDT/patch-files/4_battery_Lenovo-T450.txt.

If you have only one battery, please uncomment this line in the patch:

into method label _STA parent_label BAT1 replace_content begin Return(0) end;

Save the result named as patched_4_DSDT.dsl and patched_4_DSDT.aml. Test it.

DSDT auto patch script

All the patches we used are in directory ./DSDT/patch-files, and there is a auto_patch script used to do the things of common, led sleep, brightness, battery patches. Thanks to the command line patcher, Rehabman's patchmatic.

USB Injector For El Capitan

In 10.11+ Apple has changed the USB drivers. Then a usb port injector is needed. For T450, controller names in ACPI are EHC1(USB2), XHCI(USB3). In the DSDT, var PJCD = 8 for SSP[123] Address.

XHCI controller ports needed:

port UsbConnector name
0x01 0 (2.0) HSP0
0x02 0 HSP1
0x03 0 HSP2
0x06 255 (FP) HSP5
0x07 255 (BT) HSP6
0x08 255 (Camera) HSP7
0x0C 3 (3.0) SSP0
0x0D 3 SSP1
0x0E 3 SSP2

Save the injector as USB_Injector_T450.plist. And install it to clover kexts/10.11.

install -D USB_Injector_T450.plist /boot/EFI/Clover/kexts/10.11/USB_Injector_T450.kext/Contents/Info.plist

Remap Home/End keys

Run the script ./HomeEndFix/install.sh.

Optional: Use patched AppleHDA

First, remove the VoodooHDA in EFI/Clover/kexts/Other.

Enable the KextsToPatch of Realtek ALC3232 in EFI/Clover/config.plist.

Then enter the directory ALC3232.

make # generate AppleHDAInjector.kext CodecCommander.kext
make install # copy AppleHDAInjector.kext CodecCommander.kext to /Library/Extensions/
#repair permissions and update the system cache.

Enter the directory DSDT.

./auto_patch.sh #path 5_audio_HDEF-layout1.txt
# copy result/patched_5_DSDT.aml to EFI/Clover/ACPI/Patched/DSDT.aml

Reboot, and check.

Optional: Use RehabMan's FakeSMC

The default FakeSMC in clover doesn't support CPU,GPU Sensor plugins for T450. So if you want to use them with HWMonitor, just look at RehabMan's version forked from kozlek. It works fine in my T450.

Applications

dock

defaults write com.apple.dock orientation -string left
defaults write com.apple.dock springboard-columns -int 9
#sudo mv /Applications/{Utilities,Utilities.lost}
defaults write com.apple.dock ResetLaunchPad -bool TRUE;killall Dock
#sudo mv /Applications/{Utilities.lost,Utilities}

brew

sudo xcode-select --install

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
#or git clone --depth=1 git://mirrors.tuna.tsinghua.edu.cn/homebrew.git /usr/local

brew tap homebrew/dupes
brew tap homebrew/science
#cd /usr/local/Library/Taps/homebrew/homebrew-science
#git remote set-url origin git://mirrors.tuna.tsinghua.edu.cn/homebrew-science.git

brew install wget tig pandoc coreutils gcc iproute2mac
brew cask install --appdir=/Applications aliwangwang atom firefox hex-fiend jabref \
    kext-utility kodi macvim mplayerx mpv sshfs torbrowser transmission
for myapp in Firefox QQ; do
    defaults write com.apple.dock persistent-apps -array-add "<dict>
    <key>tile-data</key>
        <dict>
            <key>file-data</key>
                <dict>
                    <key>_CFURLString</key>
                    <string>file:///Applications/${myapp}.app</string>
                    <key>_CFURLStringType</key>
                    <integer>15</integer>
                </dict>
            <key>file-label</key>
                <string>${myapp}</string>
        </dict>
    </dict>"
done
killall Dock

python3

brew install python3
brew linkapps
#mkdir ~/.pip
#echo -e '[global]\nindex-url = https://pypi.tuna.tsinghua.edu.cn/simple' > ~/.pip/pip.conf
pip3 install ipython notebook ipywidgets numpy scipy sympy pandas matplotlib

oh-my-zsh

sudo scutil --set HostName osx-T450
git clone https://github.com/shmilee/oh-my-zsh-custom.git
cd oh-my-zsh-custom
make
make install
[1]http://www.tonymacx86.com/yosemite-laptop-support/152573-guide-patching-laptop-dsdt-ssdts.html