Home

Awesome

Hackintosh-HP-EliteBook-840-G4

OpenCore EFI for the HP EliteBook 840 G4

GitHub release (latest by date) GitHub all releases GitHub issues GitHub pull requests

Overview:

:warning: The repository has finally been updated to the latest version of OpenCore. I've been testing this configuration on the latest version of macOS Monterey and everything works as expected. Trackpoint and upper touchpad buttons are fixed now as well! Oh and battery patching is no longer buggy, thanks to ECEnabler kext. I've also tested the dock station, which seems to work fine with some USB patching. Additionally, new RealtekCardReader kext fixes all problems with the card reader.

This repository was built to make a fully working OpenCore EFI for this laptop. It's based on my work and help from other people. HP EliteBook 840 G4

Laptop Specification:

BIOS Settings:

Installation

To use this EFI, follow Dortania's OpenCore guide. You will need to create a bootable USB with macOS image on it, then copy the entire EFI folder on it. Remember to first set BIOS settings, use kexts that match your hardware configuration, make changes to the config.plist according to your laptop's specification and make sure you have backups.

Tweaks:

ACPI

Here I explain what each SSDT in the EFI does.

SSDTWhat is it used forIs it required
SSDT-PLUGFixes CPU power managementYes
SSDT-USBXFixes Embedded ControllerYes
SSDT-GPRWFixes wake on USB or power state changeYes
SSDT-ZPTSFixes auto reboot when shutting downYes
SSDT-HP-FixLidSleepFixes keyboard spam on lid closeYes
SSDT-PWRBFixes power buttonYes
SSDT-PNLFEnables brightness controlYes
SSDT-XOSIFixes touchscreen and touchpadYes
SSDT-HPETFixes IRQ conflicts?
SSDT-SBUS-MCHCImproves SMBus support and injects MCHC propertiesBroken when VoodooSMBus injected, but does fix MCHC - recommended to keep it enabled
SSDT-PMCRSome LPCB device fix?
SSDT-PPMCNVRAM fixNo
SSDT-SET-STASFixes support for latest BIOS versionsDisable if on BIOS version lower than 1.32

ACPI renames and patches

Here I explain what does each ACPI patch do.

PatchWhat is it used forIs it required
RTC Fix to stop Post ErrorFixes RTC wakeYes
Rename method GPRW to XPRWFixes wake on USB or power state changeYes
_CRS to XCRSFixes touchscreen and touchpadYes
Rename PWRB method _STA to XSTAFixes power buttonYes
_PTS to ZPTSFixes auto reboot when shutting downYes
Rename _OSI to XOSIFixes touchscreen and touchpadYes
HPET _CRS to XCRS RenameFixes IRQ conflicts?
RTC IRQ 8 PatchFixes RTC IRQ conflict?
TIMR IRQ 0 PatchFixes TIMR IRQ conflict?

Kexts

Here I explain what each injected kext is used for.

KextWhat is it used forIs it required
AppleALCFixes audioYes
CPUFriendFixes CPU power managementYes
CPUFriendDataProviderProvides information about the CPU for CPUFriendYou need to make a custom CPUFriendDataProvider) if you have a different CPU
CtlnaAHCIPortFixes some AHCI controllers that were dropped in Big SurYes
ECEnablerDoes the battery patchingYes
IntelMausiFixes ethernetYes
LiluA kext to patch many processes, required for AppleALC, WhateverGreen, VirtualSMC and many other kexts. Without Lilu, they will not workYes
NVMeFixFixes power management and initialization on non-Apple NVMeYes
RealtekCardReaderFixes SD card readerYes
RealtekCardReaderFriendMakes macOS recognize the card reader as a native oneYes
VirtualSMCEmulates the SMC chip found on real macs, without this macOS will not bootYes
SMCBatteryManagerUsed for measuring battery readouts on laptopsYes
SMCProcessorUsed for monitoring CPU temperatureYes
USBPortsUSB ports mapYes
VoodooInputRequired for almost all "Voodoo" kextsYes
VoodooI2C (works since 2.6.5 release)Used for fixing I2C devicesDisable if no touchscreen
VoodooI2CHID (works since 2.6.5 release)Satellite for VoodooI2C, fixes I2C touchscreenDisable if no touchscreen
VoodooPS2ControllerFixes PS2 keyboardYes
VoodooRMIFixes the touchpadYes
VoodooSMBusRequired for VoodooRMI to work with SMBus devicesYes
WhateverGreenUsed for graphics patching DRM, boardID, framebuffer fixes, etc.Yes

If you use the builtin Intel Wi-Fi, inject Itlwm and IntelBluetoothFirmware kexts.

CPU Power Management

CPU power management is done by CPUFriend.kext while CPUFriendDataProvider.kext defines how it should be done. CPUFriendDataProvider.kext is generated for a specific CPU and power setting. The one supplied in this repository was made for the i7-7600U. You might have a different CPU, and if you do - you need to make CPUFriendDataProvider.kext yourself using CPUFriendFriend tool. Read this guide for more information.

The settings I used for CPUFriendFriend, for managing CPU power:

FeatureSetting
LFM (Low Frequency Mode)800Mhz (recommended value from Intel ARK website)
EPP (Energy Performance Preference)0x3F (focused on performance, but with decent battery saving)
Performance Bias0x05 (focused on fair performance and high stability)
Additional Energy Savings OptionsYes

Fixing iServices

One of the most important things that many people don't know how to properly set up is iServices. Actually, it's pretty easy if you do it before the installation. Just follow the original guide but generate the serial and inject it before you start installing macOS. This will save you a lot of time and will make iServices work right after the installation.

Secure Boot and ApECID

If you're using Itlwm, you need to set SecureBootModel to Default. If you don't use that kext, you can have it set to the closest one that matches your SMBIOS for higher security. I used j680 from MacBookPro15,1 SMBIOS.

You can also generate your own ApECID (stands for Apple Enclave Identifier) which is known as the "highest level of security". Used along with a custom SecureBootModel will make your device even more secure.

FileVault

I won't cover this topic in the README, because I don't use FileVault, but it is possible to have it working on this laptop and most other machines. If you want to use it - follow the guide.

Configure sleep

Screenshot

These are the settings that work for me. Hibernation isn't supported on Hackintosh, therefore should be disabled.

To apply patches for sleep - type the following commands in the terminal:

sudo pmset hibernatemode 0
sudo rm -f /var/vm/sleepimage
sudo mkdir /var/vm/sleepimage
sudo pmset autopoweroff 0
sudo pmset -a standby 0
sudo pmset autorestart 0
sudo pmset proximitywake 0
sudo pmset disksleep 0
sudo pmset tcpkeepalive 0 (optional)

Make sure to disable wake on LAN in power settings. I also recommend to disable Power Nap, which causes random wake up calls on my laptop.

HiDPI Scaling (Retina Scaling)

Screenshot

Retina displays on real Apple devices have a high pixel density because of HiDPI scaling. One logical pixel is four physical pixels on Retina displays. This can be emulated on Hackintoshes too. I used a script called one-key-hidpi which works pretty good on this device. Since Full HD is quite hard to work on while using a 14" display, this is a really useful fix. However, using it will make the Apple boot logo large at 2nd boot stage, and I haven't found a way to fix that yet.

These are the options I used in the script:

FeatureSetting
HiDPIEnable HiDPI
IconMacBook Pro
Resolution1920x1080

Note: HiDPI only works on Full HD or higher

Wi-Fi button fix

I found a way to fix the Wi-Fi button, that was previously not doing anything. Turns out it's a regular key, that is blocked in default VoodooPS2Keyboard configuration. I mapped it to F16, because it was the safest key with no general use under macOS (you can assign it to any other key in VoodooPS2Keyboard’s info.plist file, if needed).

I'll provide the instructions needed for the fix.

First, you'll need to determine what is your Wi-Fi device's name. To do so, type in networksetup -listnetworkserviceorder | sed -n '/Wi-Fi/s|.*Device: \(.*\)).*|\1|p' in the terminal. Generally it's named en3. Remember the interface's name, as you will need it in further steps.

  1. Open Automator app and create a new Service
  2. Set "Service receives selected: to "no input" in "any application"
  3. Add an action named "Run Shell Script". It's in the Utilities section of the Actions Library
  4. Insert networksetup -getairportpower en1 | grep "On" && networksetup -setairportpower en1 off || networksetup -setairportpower en1 on into the text box and test run it using the Run button (top right)
  5. Save it and give it a name you will remember
  6. Go to System Preferences -> Keyboard -> Shortcuts
  7. Go to the Services section, and scroll down to General - you should find your service there. Once you select it - click "add shortcut" and press the Wi-Fi button.

Done! Now you can use the Wi-Fi button to enable and disable Wi-Fi. However, the LED will require additional fixes - making a custom SSDT would probably make it work.

Note: If you have multiple user accounts on your laptop - you will have to repeat all of these steps for each account.

Not working:

Not tested:

Acknowledgements

Thanks to: