XXCoreRangerX / Hackintosh-HP-EliteBook-840-G4

OpenCore EFI for the HP EliteBook 840 G4
MIT License
17 stars 4 forks source link
bigsur elitebook hackintosh hackintosh-efi hackintosh-laptop opencore opencore-efi touchscreen

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.

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:

Not tested:

Acknowledgements

Thanks to: