Skip to content

OpenCore EFI for the HP EliteBook 840 G4

License

Notifications You must be signed in to change notification settings

XXCoreRangerX/Hackintosh-HP-EliteBook-840-G4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

⚠️ 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: Tested 1.29 and above and all seem to work (1.32 and above require SSDT-SET-STAS enabled)
  • CPU: Intel® Core i7-7600U (for other CPUs, you need to make CPUFriendDataProvider.kext yourself)
  • GPU: Intel® HD Graphics 620
  • RAM: 8GB DDR4 2133MHz
  • Wi-Fi/BT: Apple AirPort BCM94360CS2 (if you're using the builtin Intel WiFi - inject Itlwm and IntelBluetoothFirmware kexts)
  • Audio: Conexant CX8200
  • ETH: Intel® Ethernet Connection I219-LM (I219-V also supported with IntelMausi)
  • Display: 14" Full HD Touchscreen (for the non-touch model, remove everything regarding VoodooI2C)
  • Touchpad: Synaptics SMBus
  • Keyboard: PS2 HP Keyboard
  • Webcam: HP HD Camera (the camera may work out of the box, or not work at all - there is no way to fix it)
  • SD Card Reader: Realtek RTS522A

BIOS Settings:

  • Disable TPM Security
  • Disable Physical Presence Interface
  • Disable Intel SGX
  • Enable System Management Command
  • Enable USB Storage Boot
  • Disable Network PXE Boot
  • Disable Power On when AC Detected
  • Disable Power On when Lid is Opened
  • Disable Secure Boot
  • Disable Legacy Boot
  • Enable Turbo Boost
  • Enable Hyperthreading
  • Enable Multi-Processor
  • Set VRAM to 64MB or higher
  • Enable VT-x
  • Disable VT-d (can be used with DisableIOMapper enabled)
  • Disable Fast Charge
  • Enable Turbo Boost on DC
  • Disable HP Application Driver
  • Enable LAN Controller
  • Disable Wake on LAN
  • Disable Lock Wireless Button
  • Enable WLAN
  • Enable Bluetooth
  • Disable LAN/WLAN Auto Switching
  • Enable Fan Always On while on AC Power
  • Enable Fan Quietness Mode
  • Enable Boost Converter
  • Enable Touch Device (if you have a touchscreen)
  • Enable Integrated Camera
  • Enable Media Card Reader
  • Enable Smart Card (if you want to use the smart card reader)
  • Disable Smart Card Power Savings (weird behavior on macOS)
  • Enable Runtime Power Management
  • Disable Extended Idle Power States
  • Disable Deep Sleep
  • Disable Wake when Lid is Opened
  • Disable Wake when AC is Detected
  • Disable Wake on USB
  • Disable USB Legacy Port Charging
  • Enable Power Control

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.

SSDT What is it used for Is it required
SSDT-PLUG Fixes CPU power management Yes
SSDT-USBX Fixes Embedded Controller Yes
SSDT-GPRW Fixes wake on USB or power state change Yes
SSDT-ZPTS Fixes auto reboot when shutting down Yes
SSDT-HP-FixLidSleep Fixes keyboard spam on lid close Yes
SSDT-PWRB Fixes power button Yes
SSDT-PNLF Enables brightness control Yes
SSDT-XOSI Fixes touchscreen and touchpad Yes
SSDT-HPET Fixes IRQ conflicts ?
SSDT-SBUS-MCHC Improves SMBus support and injects MCHC properties Broken when VoodooSMBus injected, but does fix MCHC - recommended to keep it enabled
SSDT-PMCR Some LPCB device fix ?
SSDT-PPMC NVRAM fix No
SSDT-SET-STAS Fixes support for latest BIOS versions Disable if on BIOS version lower than 1.32

ACPI renames and patches

Here I explain what does each ACPI patch do.

Patch What is it used for Is it required
RTC Fix to stop Post Error Fixes RTC wake Yes
Rename method GPRW to XPRW Fixes wake on USB or power state change Yes
_CRS to XCRS Fixes touchscreen and touchpad Yes
Rename PWRB method _STA to XSTA Fixes power button Yes
_PTS to ZPTS Fixes auto reboot when shutting down Yes
Rename _OSI to XOSI Fixes touchscreen and touchpad Yes
HPET _CRS to XCRS Rename Fixes IRQ conflicts ?
RTC IRQ 8 Patch Fixes RTC IRQ conflict ?
TIMR IRQ 0 Patch Fixes TIMR IRQ conflict ?

Kexts

Here I explain what each injected kext is used for.

Kext What is it used for Is it required
AppleALC Fixes audio Yes
CPUFriend Fixes CPU power management Yes
CPUFriendDataProvider Provides information about the CPU for CPUFriend You need to make a custom CPUFriendDataProvider) if you have a different CPU
CtlnaAHCIPort Fixes some AHCI controllers that were dropped in Big Sur Yes
ECEnabler Does the battery patching Yes
IntelMausi Fixes ethernet Yes
Lilu A kext to patch many processes, required for AppleALC, WhateverGreen, VirtualSMC and many other kexts. Without Lilu, they will not work Yes
NVMeFix Fixes power management and initialization on non-Apple NVMe Yes
RealtekCardReader Fixes SD card reader Yes
RealtekCardReaderFriend Makes macOS recognize the card reader as a native one Yes
VirtualSMC Emulates the SMC chip found on real macs, without this macOS will not boot Yes
SMCBatteryManager Used for measuring battery readouts on laptops Yes
SMCProcessor Used for monitoring CPU temperature Yes
USBPorts USB ports map Yes
VoodooInput Required for almost all "Voodoo" kexts Yes
VoodooI2C (works since 2.6.5 release) Used for fixing I2C devices Disable if no touchscreen
VoodooI2CHID (works since 2.6.5 release) Satellite for VoodooI2C, fixes I2C touchscreen Disable if no touchscreen
VoodooPS2Controller Fixes PS2 keyboard Yes
VoodooRMI Fixes the touchpad Yes
VoodooSMBus Required for VoodooRMI to work with SMBus devices Yes
WhateverGreen Used 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:

Feature Setting
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 Bias 0x05 (focused on fair performance and high stability)
Additional Energy Savings Options Yes

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:

Feature Setting
HiDPI Enable HiDPI
Icon MacBook Pro
Resolution 1920x1080

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:

  • DRM (isn't supported on iGPU only systems)
  • Proper CFG Unlock (there isn't an option in the BIOS, and I didn't find any way to disable it)
  • FingerPrint Scanner (currently there's no way to emulate an OEM fingerprint scanner under macOS)
  • Boot chime
  • External display on VGA
  • Dot to disable touchpad (in the upper left corner of the touchpad, might be possible with VoodooPS2)
  • Wi-Fi LED (always orange, but if there's an LTE module connected it's always white)
  • LTE module (being detected as Ethernet and not working)
  • Booting Linux from OpenCore

Not tested:

  • NFC module

Acknowledgements

Thanks to: