Contribute
Register

[Guide] Dell XPS 13 9360 on MacOS Sierra 10.12.x - LTS (Long-Term Support) Guide

Joined
Oct 23, 2012
Messages
446
Motherboard
Dell XPS 13 9360 (Clover)
CPU
i7-7500U
Graphics
HD 620, 1920x1080
Introduction

I managed to install MacOS Sierra 10.12.6 on this ultrabook, and I plan to keep it for a long time (min 2 years) and use it as my daily-driver machine.




LTS - Long-Term Support

My commitment is to keep this thread organised for a long time (thus the "LTS" tag), and to report on the first post every community finding that further improves system functionality, reliability and performance.


Why such a long and detailed guide?

Because most Hackintosh build guides are minimal and focus on copy-pasting the OP-provided Clover directory.
I want this guide to be reproducible, so I described every non-trivial step, so we can share the exact same build.
In addition, thoroughly describing everything makes the build way more upgrade-resilient and useful even with future BIOSes, hardware revisions and MacOS versions.

I will try to be very specific and to describe every difficult step with detail.
This is NOT to encourage laziness. Do your homework and research before asking questions here.
Here are described only the steps which I found hard to understand and are specific to this laptop (e.g. BIOS extraction for DVMT patching). I will try to explain what every patch does, because you can't be a good hackintoshing if you are not eager to learn.

I am a long-time Hackintosh modder and user but in no way I call myself an expert, so feel free to correct me.
We have many gurus on this forum and on the web and it's all their merit/credit if we came this far.


Important note:

I kindly ask you to post replies and comment only if you have this very laptop model: XPS 13 9360.
This is a specific guide, not a generic learning/support thread.
For all the rest, Google is your friend.


OS TO INSTALL

MacOS Sierra 10.12.6, Windows partitions will be wiped.
Note: wipe Windows only after completing all the steps that require its use.


MY EXACT CONFIGURATION
Code:
XPS 13 9360
i7-7500U (Kaby Lake)
FHD (1920x1080) matte screen
256GB Toshiba NVME THNSN5256GPUK SSD <can be swapped for more battery life>
Killer Wifi 1535 (2x2 mimo) <has to be swapped>
8GB LPDDR3 1866MHz RAM
Bios 1.3.5
USA-International keyboard layout
Webcam (VendorID 3034, ProductID 22155)

RESULTS TO EXPECT

Working:

- CPU power management [1.0GHz @ 0.5W idle <-> 3.5GHz @ 24W+ under load, 4360|8850(CPU)|19200(GPU) GeekBench4 score]
- GPU Power management [0.0GHz (reported) idle <-> 1.05GHz under load]
- Sleep/wake [wake only by lid open or power button press]
- Shutdown
- Webcam with LED on-off switching properly working
- Microphones
- Speakers
- Headphone jack (with jack sense)
- Touchpad with semi-advanced multitouch gestures
- USB A 3.0 ports
- USB C 3.1 port (no hotplug)
- Prev/Play/Next keys
- Volume keys with OSD
- Brightness slider and OSD
- Brightness keys with smooth and full range of brightness + level persistence after reboot
- Keyboard backlighting with keyboard activation key and with custom timeout
- QE-CI (without menu bar glitches)
- Wifi 2.4GHz + 5GHz as native AirPort (BCM94352z / DW1560 swap)
- Bluetooth
- Perfect-match keyboard layout (for USA-Intl keyboards) via custom keyboard layout
- Battery / AC status
- NVME SSD with native Trim
- USB-A high-current output (1A max on the left, 2.4A max on the right)
- Retina / HiDPI scaled resolutions
- Airdrop
- USB-C Power Delivery battery charging (20V@1.5A minimum)
- External HDMI video+audio output


Not working (yet):

- SD card reader (a solution may appear in the next months)
- Hibernation (doesn't work properly on hackintoshes)


Unknown:

- BT4LE Handoff+Hotspot (they show as supported, not tested, may be country-code dependant)
- Thunderbolt via USB-C connector (you need another SMBIOS with native Thunderbolt 3 support)
- Intel Smart Sound Technology (SST) Audio DSP (unable to determine, should provide further battery savings during media playback)
- FileVault 2 (not configured, may work if proper Clover drivers are injected, not advised)


A note on coil-whine:

This laptop, as all the past-gen Infinity-display XPS 13, suffers from coil-whine. It is unnoticeable until the audio amplifier powers on. At that time, very annoying whine can be heard through speakers. Luckily, with proper Audio configuration, the amplifier turns on only when there's some sound to play, and then powers-off immediately. Coil-whine is a non-issue during typical office/library workloads.


A note on CABC:

This laptop suffers from display CABC. It's not fixable for FHD screens, because it's embedded in display firmware that is not flashable via OS.
The only solutions seems to swap the display. The part number should be Sharp LQ133M1JW01. If I won't be able to live with CABC, I'll try the swap with a non XPS13-specific OEM display.

Dell has finally released the tool to reflash Sharp FHD screen and disable CABC.
The improvement in maximum brightness is huge! Give it a try!

A note on keyboard backlighting:

You may want to change the default Keyboard Backlighting timeout (10s) and the way the keyboard resets the timeout when you interact with input devices. Surprisingly, you can! You need Windows installed. Download the official "Dell Feature Enhancement Pack", install it, open Control Panel->Keyboard and you'll be greeted with this tab:



Change it as you want. The change is permanent as a new value is written in a keyboard's controller registry.
NOTE: oddly, you can't revert to the original 10s timeout. Such a loss.


A note on SpeedShift (aka HWP aka Intel SST), XPCM and OS-driven Power management in general:

With vanilla SSDTs, Power Management (CPU+GPU) works beautifully.
I strongly advise you not to try HWP until we better understand it.
XPS line laptops is plagued with unrecoverable filesystem corruption and that seems to be triggered by changes in hibernatemode status or other deep-idle states that may be related to HWP, non-native NVME patches or other power management settings.
Don't be brave if you rely on this laptop for work, stick with my files until further notice. Trust me on this.
Many of you suggest to implement non-HWP OS-driven Power Management (with P states injected via SSDPrGen, using a non-HWP SMBIOS). In this particular system, in my opinion it is not required. All the CPU and GPU C+P states are reached without the need of any tweak. The system is responsive, way faster than on Windows, and has superb battery life. After many months of experiments with HWP and SSDTs, I found no proof of any battery nor performance advantage by using these tweaks. So, my advice is to stick with vanilla frequency stepping.
So, why the system is power-stepping even without the specific tweaks?
With this vanilla solution, you are using XNU power management.
It's a way to control power management that has been added to 10.10 kernel and works for Haswell+ platforms.
To check that xnu PM is working, you can type: sysctl machdep.xcpm and check whether machdep.xcpm.mode: is "1".


A note on NVME drives:

There are 3 types of SSDs you can install on this XPS machine:

A) NVME non-4k compatible drives (like all the Samsung NVME drives)
You need to spoof the PCI address of the drive, in order to run a non-native, patched NVME kext that supports 512b LBA-formatted drives. Do your research. You'll need to add NVME hotpatches to Clover to boot the installer, and then, on a fully-configured system, swap them with more the stable and safe HackNVME kext. Do your research in the General Topics section.
This is the least desirable SSD type you can have on your XPS. Power management on NVME drives does not work properly on MacOS, so you'll experience a 10% impact on battery life, and warmer bottom-lid. Moreover, on XPS 9360, only 2 of 4 PCI-E lanes are enabled, so you won't experience hyper-fast transfer rates.

B) NVME 4k compatible drives (like all the OCZ-Toshiba NVME drives)
You can low-level format them to 4K LBA. Then, you will run the native NVME Apple driver without any sort of hack or patch. This is more desirable, future-proof than having an A) drive. Power management on NVME drives does not work properly on MacOS, so you'll experience a 10% impact on battery life, and warmer bottom-lid. Moreover, on XPS 9360, only 2 of 4 PCI-E lanes are enabled, so you won't experience hyper-fast transfer rates.

Here's how to 4k format:
0) Do a full Time-Machine backup. SSD will be formatted, all data will be lost.
1) Boot Ubuntu 16.10 Live USB
2) Enable Wifi by allowing third-party drivers through the "Additional Drivers" application
3) Enable Universe repo and reload repo database
4) sudo apt install smartmontools
5) sudo apt install nvme-cli
6) sudo smartctl -a /dev/nvme0

If the output is:

Code:
    Supported LBA Sizes (NSID 0x1)
    Id Fmt  Data  Metadt  Rel_Perf
     0 +     512       0         2
     1 -    4096       0         1
Your drive supports both 512B and 4KB sector sizes.
[+] setting is the active one.
You can then switch [0] setting (512B LBA) to [1] setting [4KB LBA] by typing:

7) nvme format -l 1 /dev/nvme0
8) Remove SSDT-NVME, HACKRNVMEFAMILY.kext and/or Clover storage hotpatches from your EFI bootloader.
8) Do a time machine restore after formatting the SSD
9) After booting, disable again hibernatemode:

Code:
    sudo pmset -a hibernatemode 0
    sudo rm /private/var/vm/sleepimage
    sudo touch /private/var/vm/sleepimage
    sudo chflags uchg /private/var/vm/sleepimage
10) You are now running 100% vanilla storage drivers. Trim is enabled by default.
Here's the thermal scan for my Toshiba drive. Notice that PM is not working:
toshiba-ts.png

C) SATA M.2 drive (like all the Samsung 850 series M.2 drives)
These drives are a tad slower but work almost natively. Power management works very good. If you plan a SSD upgrade, go for this kind of drives, you'll experience 10% more battery life and completely cold bottom lid.
Remember to enable trim by typing: sudo trimforce enable.

Here's the thermal scan for my Samsung 850 Evo drive. Notice that PM is working very good:
samsung-ts.png

A note on Wifi Country-Code:

For those outside the US, the super-country-code (aka local unknown) "#a" patch seems to be ideal if you want zero-issue, full speed 5GHz Wifi connectivity.
Add this to your Clover patches to remove Wifi channels regional limitations:

Code:
<dict>
    <key>Comment</key>
    <string>Patch CC to #a</string>
    <key>Disabled</key>
    <false/>
    <key>Find</key>
    <data>
    QYP8/3QsSA==
    </data>
    <key>Name</key>
    <string>AirPortBrcm4360</string>
    <key>Replace</key>
    <data>
    ZscGI2HrKw==
    </data>
</dict>

A note on external monitors:

DisplayPort/HDMI works via USB-C connector and "DP alternate mode" adapter.
It's also hot-pluggable and HDMI audio works perfectly.

USB-C socket provides many functionalities. Among the many cables that run through a (compliant) USB-C cable, there are some lanes that work natively as USB 3.1 data lanes. These lanes can be switched to other functionalities (aka "alternate modes") if requested by an active adapter. DisplayPort alternate mode works out of the box, providing us with full external monitor functionality. You just need a cheap USB-C -> HDMI/DP adapter that supports the alternate mode.




A note on USB-C charging (aka USB Power Delivery aka USB PD):

Here's a really good news: we can charge this laptop with increasingly-common USB PD chargers.
USB Power Delivery is a standard aimed at providing different voltages/currents on the same USB-C cable, after a digital negotiation between the host (the adapter) and the client (the laptop).

This laptop natively charges at 20V/2.25A, but it is able to accept less current, also supporting the 20V/1.5A profile.
That's very good because you can carry a very small wall adapter with you and still charge it, even while using it.



BE CAREFUL! FIRE HAZARD! Since USB-PD is a young standard, many adapters on the market now - even some of the most famous ones - do not negotiate the current properly and they tend to burn or overheat because they syndicate more current than they're able to deliver. Use a charger only after you are sure it is able to correctly negotiate the 20V/1.5A profile or above. Read the reviews and do your own research.

To check how much current your charger syndicates during the handshake, open BIOS settings and go to battery details. You'll see how much power the laptop will draw from the PSU. If that value is higher than the advertised power of the charger, throw it away immediately.

Note: on 30W chargers, you'll notice 5-10% reduced peak multicore performance, as "TDP-UP" CPU states will be disabled/decreased to reduce peak CPU power consumption to 15W max.

Another good news is that USB PD is reversible. The laptop can become the host, at maximum 5V/3A.


Upgrade-resilience:

You'll have to keep an eye on many things before a minor (or major) OS upgrade:

=> NVME patching (if you use it): not caring about this may lead to unrecoverable filesystem corruption.
As per RM guide, the update has to be carried this way:
- update via App Store
- wait for RehabMan to update the patch-nvme github project
- update your copy of the patch script
- generate new kext and swap the old one
The good about this method is that you are going to use the old kext until you manually re-patch the new one, so your system should remain bootable after minor upgrades, giving you time to safely swap the new kext.

=> Hibernation: Check that hibernation is still disabled (0) after update:
Code:
sudo pmset -g custom | grep "hibernatemode \|standby \|autopoweroff "
=> All the rest: Do your research and don't be the first-on-the-line to upgrade.


Further notes:

- Kaby Lake architecture and IPC are the same as Skylake. 10.12.6 finally does support Kaby Lake natively, and thanks to this, we get more performance and more battery life compared to our previous method of spoofing our Kaby Lake architecture to Skylake.
- DVMT patching is used instead of kext hotpatching as it's tricky to patch the framebuffer via Clover if it drops out of cache. Patching DVMT is dangerous. Do your research!
- No HWPEnabler kext nor Clover HWPEnable nor SSDPrGen are used. Paired with Macbook9,1 SMBIOS the system is snappy and CPU+GPU power management works pretty well.
- As many DELL machines, 9360 suffers from SMBIOS truncation bug, so Macbook9,1 is used. Clover has recently introduced a flag to overcome this limitation. If you want to USE a SMBIOS longer than Macbook9,1, enable that flag.
- Current BIOS 1.3.7 seems to break sleep for some systems. In that case, downgrade to 1.3.5.
- Current BIOS 1.3.7 might not be compatible with IFR extractor. In that case, downgrade to 1.3.5.
- New BIOS in the future = ideally, no need to patch ACPI again, as everything is hotpatched.
- HFSPlus.efi driver is not included in attached files for obvious reasons. Do your research.
- Standby is very deep, seems to lose just 1% battery every 3 hours, even with USB Powershare enabled in BIOS.
- The trackpad sensitivity and precision are horrible. The worst trackpad I ever used. But we managed to find a very good solution!
- To disable/enable the trackpad while using an external pointing device, press PrtScr key on internal keyboard (fantastic undocumented feature of RM VoodooPS2Controller).
- The webcam white LED correctly shuts down when the app using the camera is closed, thanks to a custom kext injection.
- I didn't install RM VoodooPS2Controller daemon as I don't need trackpad auto-disable when external mouse is connected.
- I prefer to leave S/L/E almost vanilla, so all the kext are injected via Clover. I know that some kexts don't like on-the-fly injection, but I didn't encounter issues so far.
- Custom keyboard layout is created with Ukelele app, and matches Euro and Rupee symbols on ANSI-INTL English keyboards. For different layouts, create your own layout.
- Complete the iMessage configuration with proper system serials before connecting to the internet for the first time.
- With battery level below 20%, CPU package TDP may be hard-limited to 15W, even with the charger connected, so performance will be slightly reduced. Do benchmarks with full battery!
- [Trivia] Dell's Fn+F7 "Unobtrusive Mode" is pretty cool.
- [Trivia] Dell's Fn+Ins puts the system into standby.
- [Trivia] Dell's Ctrl+Ins shuts down the system.
- [Trivia] The laptop can be fast-charged in ~1 hour by enabling "Fast Charging" in BIOS. Not recommended, faster battery wear will occur.
- [Trivia] The IGZO display in this laptop, compared to standard IPS ones, saves 30-40% of power while displaying moving images and up to 90% while displaying still images.


STEPS


Thoroughly inspect all the files in my archive:

I placed some dummy, empty files across the folders, to give you hints on some actions you have to do.
These files always start with "<" and always end with ">". E.g.:" <Put HFSPlus.efi here>".
Remove all these dummy files before trying to boot your build!


Read the generic How-To guide:

Read all this guide with care and attention: https://www.tonymacx86.com/threads/faq-read-first-laptop-frequent-questions.164990
Trivial questions or issues that can easily be resolved by reading the guide or looking at dedicated threads will be redirected and won't be answered here to avoid information duplication.


Wifi+BT card swap:

Swap the card to a BCM94352z (Dell branded one has code DW1560).
IMPORTANT: The NGFF slot is A-keyed. Some generic BCM cards are E-keyed only and won't fit.



Be careful when disassembling the lower aluminum plate. Use some plastic prying tool or a worn-out business card.
There are some flimsy plastic hooks in the central composite chassis that can be easily broken.
Be also careful, the bottom lid is aluminum and the edges are very sharp.
My advice is to always work with antistatic gloves when touching electronics.


BIOS Settings:

- Sata: AHCI
- Enable SMART Reporting
- Disable thunderbolt boot and pre-boot support
- USB security level: disabled
- Enable USB powershare
- Enable Unobtrusive mode
- Disable SD card reader (saves 0.5W of power)
- TPM Off
- Deactivate Computrace
- Enable CPU XD
- Disable Secure Boot
- Disable Intel SGX
- Enable Multi Core Support
- Enable Speedstep
- Enable C-States
- Enable TurboBoost
- Enable HyperThread
- Disable Wake on USB-C Dell Dock
- Battery charge profile: Standard
- Numlock Enable
- FN-lock mode: Disable/Standard
- Fastboot: minimal
- BIOS POST Time: 0s
- Enable VT
- Disable VT-D
- Wireless switch OFF for Wifi and BT
- Enable Wireless Wifi and BT
- Allow BIOS Downgrade
- Allow BIOS Recovery from HD, disable Auto-recovery
- Auto-OS recovery threshold: OFF
- SupportAssist OS Recovery: OFF


DVMT patching:

This is the first thing you have to do after properly updating your BIOS to the version referred in this guide and configuring it as above.
DVMT is 32MB and has to be set to 64M otherwise SKLFramebuffer kext will panic during boot.
This machine runs an InsydeH2O BIOS. Search for the guides.
The only difference is that the BIOS cannot be extracted from official BIOS update packages. If you open BIOS update package with Phoenix tools, only a portion of the bios gets decrypted and you won't find the DXE Core section that contains the DVMT variable. You have to extract the BIOS from your machine running windows with Universal BIOS Backup Kit 2.0.
Then, you can proceed as the guides tell you.
Use the following info just to confirm that you did things correctly: 1.3.5 BIOS DVMT var should be 0x785.

A note for QHD screens:
User @jkbuha reports that QHD screens require slightly different values. Be careful, var addresses may be different for you. It is advised to disassemble BIOS and check.
All screen glitches are now fixed on Sierra 10.12.6 with native Kaby Lake drivers on the i7-7500U with UHD. The solution involves a number of fixes, namely:

1) BIOS DVMT pre-alloc patching from 32MB to 128MB (setup_var 0x785 0x04)
2) BIOS DVMT max-alloc patching from 256MB to MAX (setup_var 0x786 0x03)
3) DVMT Framebuffer kext patch for ig-platform-id 59160000 - increase to 80MB and Cursor buffer to 12MB Cursor
4) Change SMBIOS to MacBookPro14,1


NVME ACPI path (if you need NVME patching):

Find your NVME ACPI path in Windows, write it down and put it aside.
This is the last step requiring Windows. You can wipe the partition.
Optionally, you can backup your Windows serial for future use. Search the web on how to do it.


Important: DSDT Patches not needed anymore, as we are using hotpatching now. Leaving all this work for reference, with strikethrough text formatting.

Click to expand said:
DSDT - Intro:

- Use Clover v4000+
- Extract original DSDT and SSDT tables with Cover->F4. Do this after updating BIOS and setting up BIOS options.
- Place DSDT.and SSDT*.aml tables in a directory, use iasl -da -dl *.aml to decompile into .dsl files.
- Open DSDT.dsl with MacIasl RM1.31+ set with ACPI 6.1 compiler.


DSDT - Initial compiling fixes:

Change:
Code:
If (LEqual (PM6H, One))
{
    CreateBitField (BUF0, \_SB.PCI0._Y0C._RW, ECRW)  // _RW_: Read-Write Status
    Store (Zero, ECRW (If (PM0H)
            {
                CreateDWordField (BUF0, \_SB.PCI0._Y0D._LEN, F0LN)  // _LEN: Length
                Store (Zero, F0LN)
            }))
}
To:
Code:
If (LEqual (PM6H, One))
{
    CreateBitField (BUF0, \_SB.PCI0._Y0C._RW, ECRW)  // _RW_: Read-Write Status
    Store (Zero, ECRW)
}
If (PM0H)
{
    CreateDWordField (BUF0, \_SB.PCI0._Y0D._LEN, F0LN)  // _LEN: Length
    Store (Zero, F0LN)
}
Remove/comment lines:
Code:
External (BNUM, UnknownObj)    // (from opcode)
External (IDMN, UnknownObj)    // (from opcode)
External (IDPC, UnknownObj)    // (from opcode)
External (DLPN, UnknownObj)    // (from opcode)
The DSDT will now compile. Ignore compile warnings.


DSDT - OSX patches:

Patches marked with [R] are credits of RehabMan, taken from his superb Laptop Patches repo. You are encouraged to use them off the live repo. They are reported here for persistence and exact-version matching purposes.

[R] [syn] Rename _DSM methods to XDSM
Code:
into_all method label _DSM set_label begin XDSM end;
into_all method code_regex _DSM replaceall_matched begin XDSM end;
*Notes: this is a generic prep-patch.*


[R] [igpu] Brightness fix
Code:
into_all device label PNLF remove_entry;
into definitionblock code_regex . insert
begin
Scope (_SB)\n
{\n
    Device (PNLF)\n
    {\n
        Name (_ADR, Zero)\n
        Name (_HID, EisaId ("APP0002"))\n
        Name (_CID, "backlight")\n
        Name (_UID, 10)\n
        Name (_STA, 0x0B)\n
    }\n
}\n
end;
*Notes: this enables lid-sleep and brightness slider in MacOS. It's not enough to gain full brightness control, see "keyboard patch" and "OSIS patch" below.*


[R] [sys] Fix _WAK Arg0 v2
Code:
into method label _WAK code_regex ([\s\S]*) replace_matched
begin
If (LOr(LLess(Arg0,1),LGreater(Arg0,5))) { Store(3,Arg0) }\n
%1
end;

into method label \_WAK code_regex ([\s\S]*) replace_matched
begin
If (LOr(LLess(Arg0,1),LGreater(Arg0,5))) { Store(3,Arg0) }\n
%1
end;
*Notes: this may be unnecessary (?) in 10.12.*


[R] [sys] Fix Mutex with non-zero SyncLevel
Code:
into_all all code_regex Mutex\s+\(([^,]*),\s+[^)]*\) replaceall_matched begin Mutex(%1, 0) end;
into_all all code_regex Mutex\s+\(([^,]*),\s+[^)]*\) replaceall_matched begin Mutex(%1, 0) end;
into_all all code_regex Mutex\s+\(([^,]*),\s+[^)]*\) replaceall_matched begin Mutex(%1, 0) end;
into_all all code_regex Mutex\s+\(([^,]*),\s+[^)]*\) replaceall_matched begin Mutex(%1, 0) end;
into_all all code_regex Mutex\s+\(([^,]*),\s+[^)]*\) replaceall_matched begin Mutex(%1, 0) end;
into_all all code_regex Mutex\s+\(([^,]*),\s+[^)]*\) replaceall_matched begin Mutex(%1, 0) end;
into_all all code_regex Mutex\s+\(([^,]*),\s+[^)]*\) replaceall_matched begin Mutex(%1, 0) end;
into_all all code_regex Mutex\s+\(([^,]*),\s+[^)]*\) replaceall_matched begin Mutex(%1, 0) end;
into_all all code_regex Mutex\s+\(([^,]*),\s+[^)]*\) replaceall_matched begin Mutex(%1, 0) end;
into_all all code_regex Mutex\s+\(([^,]*),\s+[^)]*\) replaceall_matched begin Mutex(%1, 0) end;
*Notes: this is a generic prep-patch.*


[R] [sys] HPET Fix
Code:
into method label _STA parent_hid PNP0103 remove_entry;
into device name_hid PNP0103 code_regex Name\s\(_STA\,\s+0x0F\) remove_matched;
into device name_hid PNP0103 insert
begin
Name (_STA, 0x0F)\n
end;

into method label _CRS parent_hid PNP0103 remove_entry;
into device name_hid PNP0103 insert
begin
Method (_CRS, 0, NotSerialized)\n
{\n
    Return (BUF0)\n
}\n
end;
*Notes: this is a generic prep-patch.*


[R] [sys] IRQ Fix
Code:
into device name_hid PNP0000 code_regex IRQNoFlags\s\(\)\n\s+\{(\d+)\} remove_matched;
into device name_hid PNP0100 code_regex IRQNoFlags\s\(\)\n\s+\{(\d+)\} remove_matched;
into device name_hid PNP0B00 code_regex IRQNoFlags\s\(\)\n\s+\{(\d+)\} remove_matched;
into device name_hid PNP0103 code_regex IRQNoFlags\s\(\)\n\s+\{.*\} removeall_matched;
into device name_hid PNP0103 code_regex Name\s\(([^,]+),\sResourceTemplate\s\(\).*\n\s+\{((?:.|\n)*)\}\) replace_matched
begin
Name (%1, ResourceTemplate()\n
{\n
    IRQNoFlags() { 0, 8, 11, 15 }\n
%2
})\n
end;
*Notes: this is a generic prep-patch.*


[R] [sys] RTC Fix
Code:
into device name_hid PNP0B00 code_regex (IO\s\((?:\s*[^,]+,\s*(?:\/\/\s.*)?\s*\n)+\s*)(\dx\d+)(,\s*(?:\/\/\s.*)?\s*\n\s*\)) replace_matched begin %10x02%3 end;
*Notes: this is a generic prep-patch.*


[R] [sys] Skylake LPC
Code:
into method label _DSM parent_adr 0x001F0000 remove_entry;
into device name_adr 0x001F0000 insert
begin
Method (_DSM, 4, NotSerialized)\n
{\n
    If (LEqual (Arg2, Zero)) { Return (Buffer() { 0x03 } ) }\n
    Return (Package()\n
    {\n
        "compatible", "pci8086,9cc1",\n
    })\n
}\n
end;
*Notes: this is a generic prep-patch.*


[R] [sys] SMBUS Fix
Code:
into device label BUS0 parent_adr 0x001F0003 remove_entry;
into device name_adr 0x001F0003 insert
begin
Device (BUS0)\n
{\n
    Name (_CID, "smbus")\n
    Name (_ADR, Zero)\n
    Device (DVL0)\n
    {\n
        Name (_ADR, 0x57)\n
        Name (_CID, "diagsvault")\n
        Method (_DSM, 4, NotSerialized)\n
        {\n
            If (LEqual (Arg2, Zero)) { Return (Buffer() { 0x03 } ) }\n
            Return (Package() { "address", 0x57 })\n
        }\n
    }\n
}\n
end;
*Notes: this is a generic prep-patch.*


[R] [usb] usb_prw_0x6d_xhc_skl
Code:
into device label XHC1 name_adr 0x00140000 remove_entry;

into method label _PRW parent_adr 0x00140000 remove_entry;
into method label _PRW parent_adr 0x00140001 remove_entry;
into method label _PRW parent_adr 0x001F0003 remove_entry;

into method label _PRW parent_adr 0x00190000 remove_entry;
into method label _PRW parent_adr 0x001F0006 remove_entry;

into method label _PRW parent_label _SB.PCI0.EHC1 remove_entry;
into method label _PRW parent_label _SB.PCI0.EHC2 remove_entry;
into method label _PRW parent_label _SB.PCI0.XHC remove_entry;
into method label _PRW parent_label \_SB.PCI0.EHC1 remove_entry;
into method label _PRW parent_label \_SB.PCI0.EHC2 remove_entry;
into method label _PRW parent_label \_SB.PCI0.XHC remove_entry;

into device name_adr 0x00140000 code_regex Name.*_PRW.*\n.*\n.*\n.*\n.*\}\) remove_matched;
into device name_adr 0x00140001 code_regex Name.*_PRW.*\n.*\n.*\n.*\n.*\}\) remove_matched;
into device name_adr 0x001F0003 code_regex Name.*_PRW.*\n.*\n.*\n.*\n.*\}\) remove_matched;
into device name_adr 0x00190000 code_regex Name.*_PRW.*\n.*\n.*\n.*\n.*\}\) remove_matched;

into device name_adr 0x00140000 code_regex Name.*_PRW.*\n.*\n.*\n.*\n.*\n.*\}\) remove_matched;
into device name_adr 0x00140001 code_regex Name.*_PRW.*\n.*\n.*\n.*\n.*\n.*\}\) remove_matched;
into device name_adr 0x001F0003 code_regex Name.*_PRW.*\n.*\n.*\n.*\n.*\n.*\}\) remove_matched;
into device name_adr 0x00190000 code_regex Name.*_PRW.*\n.*\n.*\n.*\n.*\n.*\}\) remove_matched;

into device name_adr 0x00140000 insert begin Method(_PRW) { Return(Package() { 0x6D, 0 }) } end;
into device name_adr 0x00140001 insert begin Method(_PRW) { Return(Package() { 0x6D, 0 }) } end;
into device name_adr 0x001F0003 insert begin Method(_PRW) { Return(Package() { 0x6D, 0 }) } end;
into device name_adr 0x00190000 insert begin Method(_PRW) { Return(Package() { 0x6D, 0 }) } end;
into device name_adr 0x001F0006 insert begin Method(_PRW) { Return(Package() { 0x6D, 0 }) } end;

into method label _DSM parent_adr 0x00140000 remove_entry;
into device name_adr 0x00140000 insert
begin
Method (_DSM, 4, NotSerialized)\n
{\n
    If (LEqual (Arg2, Zero)) { Return (Buffer() { 0x03 } ) }\n
    Return (Package()\n
    {\n
        "subsystem-id", Buffer() { 0x70, 0x72, 0x00, 0x00 },\n
        "subsystem-vendor-id", Buffer() { 0x86, 0x80, 0x00, 0x00 },\n
        "AAPL,current-available", 2100,\n
        "AAPL,current-extra", 2200,\n
        "AAPL,current-extra-in-sleep", 1600,\n
        "AAPL,device-internal", 0x02,\n
        "AAPL,max-port-current-in-sleep", 2100,\n
    })\n
}\n
end;
*Notes: these properties should enable extra-current for Apple devices. On 10.12, even if System Properties tells that no extra current is being fed to iOS devices, each USB port outputs 1A.*




[R] Fix Shutdown->reboot

Code:
into method label _PTS code_regex ([\s\S]*) replace_matched
begin
If (LNotEqual(Arg0,5)) {\n
%1\n
}\n
end;
*Notes: this fixes immediate wake from sleep if a mass storage USB device is attached when the computer is put to sleep.


MATH device (credit syscl)
Code:
into method label _STA parent_hid PNP0C04 remove_entry;
*Notes: this is a generic prep-patch.*


Set OSIS to linux (credit VBO)
Code:
into_all method code_regex If\s+\([\\]?_OSI\s+\(\"Linux\"\)\) replace_matched begin If(LOr(_OSI("Darwin"),_OSI("Linux"))) end;

into_all method code_regex If\s+\([\\]?_OSI\s+\(LINX\)\) replace_matched begin If(LOr(_OSI("Darwin"),_OSI(LINX))) end;
*Notes: this is needed for correct behaviour of brightness keys in combination with IntelBacklight ad VoodooPS2Controller kexts. Brightness levels are smooth and brightness can go very, very low, almost dark. NO PWM noticeable.*


Keyboard patch (credit VBO)
Code:
into method label SMEE replace_content
begin
        Local0 = Arg0\n
        Local0 = GENS (0x11, Zero, Zero)\n
        If ((\_SB.OSID () >= 0x20))\n
        {\n
            If ((Local0 & 0x04))\n
            {\n
                // Brightness up\n
                Notify(\_SB.PCI0.LPCB.PS2K, 0x0206)\n
                Notify(\_SB.PCI0.LPCB.PS2K, 0x0286)\n
                EV5 (One, Zero)\n
            }\n
            If ((Local0 & 0x02))\n
            {\n
                // Brightness down\n
               Notify(\_SB.PCI0.LPCB.PS2K, 0x0205)\n
               Notify(\_SB.PCI0.LPCB.PS2K, 0x0285)\n
               EV5 (0x02, Zero)\n
            }\n
        }\n
        If ((Local0 & 0x08))\n
        {\n
            Local0 = GENS (0x1D, Zero, Zero)\n
            EV16 (Local0, Zero)\n
        }\n
end;
*Notes: this is needed to make brightness keys work again after applying "OSIS Linux patch".*

Save patched DSDT.aml. Remember to keep original and edited DSDT.dsl in case you need to apply/revert some patches.
Put your patched DSDT.aml, and all the SSDT*.aml you find in my files archive, in CLOVER/ACPI/patched dir.
All these .aml files will be automatically loaded.
Do not copy your SSDT origin table to /patched folder! We don't drop original SSDTs, so you don't need to inject them again. Problems would arise.
Continue in next post
 

Attachments

Last edited:
Joined
Oct 23, 2012
Messages
446
Motherboard
Dell XPS 13 9360 (Clover)
CPU
i7-7500U
Graphics
HD 620, 1920x1080
POST-INSTALL

=> Disable hibernation:
Code:
sudo pmset -a hibernatemode 0
sudo pmset -a autopoweroff 0
sudo pmset -a standby 0
sudo rm /private/var/vm/sleepimage
sudo touch /private/var/vm/sleepimage
sudo chflags uchg /private/var/vm/sleepimage
BEWARE! This is a MUST for systems running the NVME 512b patches and you have to check it is still disabled after every OS update (also the minor ones), and every time you tinker with SMBIOS plist values. Failing to do this can lead to unrecoverable filesystem corruption. The first time your laptop enters hibernation during sleep, unrecoverable filesystem corruption will occur.


=> Move kexts from POST-INSTALL/S-L-E to System/Library/Extensions and then fix file ownership and permissions.


=> Install correct keyboard layout and swap Alt and Cmd keys (optional):

- Sysprefs->Keyboard->Type->"ANSI Keyboard".
- Sysprefs->Keyboard->Modifier Keys.
- Place layout file in /Library/Keyboard layouts.
- Reboot.
- Sysprefs->Keyboard->Input Sources->Other->US International - DELL XPS 9360 layout.
- Reboot.

NOTE: The provided layout is only valid for this physical keyboard layout:




=> Enable "Install from anywhere" (optional): sudo spctl --master-disable.


=> Install internal bootloader:

- Install Clover r4000+ with Nvram in EFI partition and NVRAM daemon.
- Once installed, mount the hidden EFI partition and copy the CLOVER directory provided in my attachments.
- Remember what I wrote above regarding HFSPlus.efi.
- For convenience, EFIMount.app is a script that automatically searches and mounts the EFI partition.


=> Generate correct SSDT-NVMe-Pcc.aml with the NVME ACPI path you wrote down previously (if you need NVME patches): https://www.tonymacx86.com/threads/guide-hackrnvmefamily-co-existence-with-ionvmefamily-using-class-code-spoof.210316


=> Generate correct HackNVMEFamily kext on a system with same OS version as the target one (if you need NVME patches).

./patch_nvme.sh --spoof 10_12_*

Checksums have to match.
Place generated kext in CLOVER/kext/Other.


=> Set up iMessage: https://www.tonymacx86.com/threads/an-idiots-guide-to-imessage.196827


=> Automatic updates:

Disable Automatic updates install via Sysprefs->App Store->Automatically check for updates.
Do your research before updating anything OS-related.


=> Make the trackpad perfect:

The trackpad in this laptop could be better. However, we can manage to render it a very good one.
The trackpad is managed via RehabMan's VoodooPS2Controller.kext.
This kext does not enable most of the vanilla multitouch gestures, and when operated with multiple touches it outputs keystroke combinations instead. You can do what you want with these combos, and even personalise them.
Syscl managed to tailor the kext responsiveness to our trackpad via a custom build of this kext, and even adding a consistent middle-click (3 fingers tap) functionality.
Syscl also changed the default keystrokes thrown when doing three finger swipes, making them not ideal.
Given all this, my archive contains a hybrid VoodooPS2Controller kext, with Syscl tweaks and RM's default multitouch keystrokes.
This, in combination with a nifty third-party app called "SizeUp", enables you to move windows around the screen with 3-finger swipes (in addition to keyboard combos).



This below is my trackpad configuration, and it works beautifully.
For optimal trackpad responsiveness, I also changed tracking and scrolling speed, also enabling dragging.
You have to dig in Accessibility settings for most of these tweaks.






Supported actions in my exact configuration:
- Left click-tap
- Right click-tap
- Vertical and horizontal scroll with two fingers swipe
- Dragging with tree fingers or drag lock
- Middle click with three fingers tap
- Window center-expand-pan with three fingers swipe

A few notes:
- If you see a blank tab in trackpad PrefPane instead of the native settings, reboot a few times.
- You can toggle the trackpad ON-OFF by pressing the PrtScr key.
- You need SizeUp or similar software to gain window pan and resize functionality.


=> Remove the Eject button from menu bar:

For some unknown reasons I find impossible to remove the Eject button from the menu bar.
Pretty raw but effective solution, since we don't have any optical disc drive, is to remove (backup it first) this file:

/System/Library/CoreServices/Menu Extras/Eject.menu

And then reboot. No more Eject disc icon.


=> Enable Retina / HiDPI scaled resolutions:

This laptop has a 1080p screen (and a very good one: search for IGZO display technology and you'll understand why this laptop lasts so much on battery). If you want the UI to be bigger, you can't simply feed the panel a lower resolution, it will become blurry because of pixel interpolation.
You cannot simply activate HiDPI mode, because you'd get halved 960x540 resolution.

Retina Macs have a cool feature called "scaled retina resolutions". Basically, the screen will be rendered off-screen at a very high resolution, and the resulting frame is then scaled-down to the screen's native resolution. That means it's still interpolated, but starting from a way bigger resolution, so it will be way more crisp.
It also means that your GPU has to:
1) Render the UI at huge resolution
2) Interpolate it down to 1080p

That's a lot of work. My advice is to avoid running at scaled resolutions, it bogs performances and not worth it.
use app-specific scaling (Chrome, for example, offers a "default zoom level" for web browsing).

Anyway, if you want to enable Retina scaled resolutions, you can use the plist included in the attached file archive.
Steps to install:
1) Enable HiDPI mode: sudo defaults write /Library/Preferences/com.apple.windowserver.plist DisplayResolutionEnabled -bool true
2) Place .plist file in ~/Downloads
3) Run this command: sudo cp ~/Downloads/DisplayProductID-1449.plist /System/Library/Displays/Contents/Resources/Overrides/DisplayVendorID-4d10/DisplayProductID-1449
4) Reboot
5) Install RDM (retina Display Menu) app and select a resolution among the ones with a yellow lightning icon next to it. No, you won't be able to select these new resolutions directly from Display PrefPane.
6) You are now in HiDPI mode

A few points to note:
- It's tailored for my display Vendor Id (4d10) and Product Id (1449). Yours may be different. Do your research
- It won't be as sharp as native Retina (doubled) resolutions
- For the curious, you can manually create the Plist file or use an online generator. Remember that the plist has to include your panel's native resolution without HiDPI flag, the target retina resolution(s) with HiDPI flag, the exact double of (each of) your target resolution(s) with HiDPI flag.
- A cool side feature is that now your display has a proper name:




=> Clear caches:

After installing every kext and setting up every new kext patch, remember to invalidate and rebuild kext caches:

sudo touch /System/Library/Extensions && sudo kextcache -u /

And then reboot.




END RESULT

You'll get a (very) fast and reliable machine able to pull 12+ hours of real office workload on full battery.

Benchmarks:








BONUS STEPS:
If you want to slightly improve battery life, computing and power performance, you can undervolt and re-paste the laptop.
Do this at your very own risk!

Re-paste:


Undervolt:
User @jkbuha proposes these modifications.
Hi all, after some research it is becoming clear that the latest generation of Dell XPS BIOSes (9350/9360/9550/9560) are fitted with BootGuard, which means that even if we manage to successfully repack any modded ME or BIOS, the laptop won't boot.

Until we figure out a way how to bypass this protection we are limited to patching IFR variables via UEFI.

With this in mind, and following the requests by a number of users in this forum, I have attached the first set of variable changes (based on BIOS v2.1.0 ONLY) for cautious users to experiment with. Warning - these settings should not be taken lightly. The wrong settings can - and will - brick your board making recovery hard or impossible.

Here is a brief summary of what's working so far:

1) CPU and GPU undervolted by 50mV (works well on the i7-7500U). OSX does run at a lower temperature and with longer battery life (in my case around 15-20%). You *can* increase these settings but there is a significant risk that the board will not power up. Use with extreme caution.

2) Overclock enable. These settings allow you to use XTU freely within Windows, but most changes will not be preserved on boot into OSX. Use these to experiment with what settings work on your machine and then apply them via UEFI.

3) DVMT patch and MAX fix to remove framebuffer issues. Self-explanatory.

4) Ring Max OC. Normally set to Turbo-2, can be increased slightly beyond this, unknown if this has any real-world effect.

There are a couple of protection mechanisms to fall back on (but not guaranteed to work). If one setting renders the board unbootable (POST fail, and white/yellow flashes):
(i) disconnect the battery
(ii) disconnect the CMOS battery (on the right of the board)
(iii) press power for 30 sec to discharge EC/NVRAM
(iv) reconnect, press CTRL+ESC, plug in power

If the above fails there is also the (undocumented) possibility of putting the DELL BIOS on a USB stick, inserting it into the LEFT port and pressing CTRL+ESC before inserting power. No reports of this working successfully yet, but please post back if you have any results.

There are a lot more variables and configuration to experiment with, in particular how ConfigTDP works to overclock the multipliers for the CPU and GT, and forcing ASPM for the NVMe controller saving even more power.

Thus this project can now become one of contribution, where anyone who is willing to experiment (within defined bounds of risk) can post their successes and/or questions.

Again - this is not for most users. Those who are fully aware of the implications (and have successfully done this in the past) are welcome to try, experiment cautiously, and post back.
Modifications:
UEFI IFR

TESTED & WORKING
=======
*Undervolt CPU
(0x653) -> 32 (-0.05V)
(0x655) -> 01

*Undervolt GPU
(0x85A) -> 32 (-0.05V)
(0x85C) -> 01

*Overclock, CFG lock disable, WDT & XTU enable
(0x4DE) -> 00
(0x64D) -> 01
(0x64E) -> 01

*DVMT patch
(0x785) -> 06
(0x786) -> 03

*Ring Max OC Ratio
(0x659) -> 0x24

FLASH/REGISTER PROTECTION DISABLE
========

BIOS Guard Support 0xF56 -> 00 (disabled)
OC Lock 0x58d -> 00 (disabled)
Unlock PCH P2SB, Variable: 0xE8E -> 01 (enabled)
Flash Protection Range Registers (FPRR), Variable: 0xE8F -> 00 (disabled)
PMC READ DISABLE, Variable: 0x884 -> 00 (disabled)

MEMORY OVERCLOCK ENABLE
==========

SPD Write Disable, Variable: 0xE8D -> 00 (FALSE)


NEEDS MORE RESEARCH
=========

Max GT frequency,
(0x6EF) -> 0x18 (1200MHz). Still locks to 1050Mhz

1-Core Ratio Limit Override
0x588 ->0x25 (x37). Still locks to 35
2-Core Ratio Limit Override
0x589 -> 0x24 (x36). Still locks to 35
BIOS Recovery (credit @hackintose):
If anyone is to attempt BIOS recovery the drive should be formatted to FAT (fat32 may work) and most importantly the BIOS file must be renamed from XPS9360xxx.exe to BIOS_IMG.rcv.

Disable CABC in FHD screens:
Dell has finally released the tool to reflash Sharp FHD screen and disable CABC. The improvement in maximum brightness is huge!


Final thanks:
Many thanks to the whole community, especially to RehabMan and Pike'rAlpha, whose guides, tools and repositories represent most of our current knowledge on Hackintoshes and MacOS in general.

---
Guide versioning scheme:

You'll always find the latest version of the files in the attachments.
[n].x - Major changes. Requires a full re-read of the guide and a full swap of the files.
x.[n] - Minor changes and adds-up in the guide for a better explanation. No need to update the files.

Guide revision: v9.03 - 20180312
 
Last edited:

RehabMan

Moderator
Joined
May 3, 2012
Messages
191,109
Motherboard
Intel DH67BL
CPU
Core i7-2600K
Graphics
Intel HD 3000
Mac
MacBook Air
Mobile Phone
iOS
- Native CPU+GPU power management [1.0GHz @ 0.5W idle <-> 3.5GHz @ 24W+ under load, 3800|8400 GeekBench3 score]
...
- No HWPEnabler kext nor Clover HWPEnable nor SSDRprGen are used. Paired with Macbook9,1 SMBIOS the system is snappy and CPU power management works pretty well.
Without plugin-type injected on CPU0, you will not have IGPU PM.

- I didn't install RM VoodooPS2Controller daemon as I don't understand what it does. The kext seems to work properly even without it.
Documented in the README/changelog (currently not working correctly on 10.12).

- I prefer to leave S/L/E vanilla, so all the kext are injected via Clover. I know that some kexts don't like on-the-fly injection, but I didn't encounter issues so far. Essential Kexts are tagged with RED.
...
- I prefer to leave SIP partially enabled (0x3 flag) instead of totally disabled (0x67 flag).
Your choice, but will probably lead to problems.
 

RehabMan

Moderator
Joined
May 3, 2012
Messages
191,109
Motherboard
Intel DH67BL
CPU
Core i7-2600K
Graphics
Intel HD 3000
Mac
MacBook Air
Mobile Phone
iOS
There's always something to learn, thank you.
What's the proper way to check for iGPU PM? Will Pike's kext do the job?
You can check in ioreg. If X86PlatformPlugin and AGPMEnabler+AGPMController is not loaded, then no IGPU PM.
You can verify it is working (eg. see IGPU pstates) with AppleIntelInfo.kext, assuming it has been updated for Kaby Lake (probably not).
 
Joined
Oct 23, 2012
Messages
446
Motherboard
Dell XPS 13 9360 (Clover)
CPU
i7-7500U
Graphics
HD 620, 1920x1080
I see no IGPU in Power gadget.
I thought it was due to incomplete Kaby Lake support in IPG, but I was wrong.
I will experiment this evening and I'll report back asap.
 
Joined
Nov 16, 2013
Messages
58
Mac
iMac, Mac mini
Mobile Phone
Android, iOS
Wow, awesome work, dude!
What about touchpad multitouch gestures?
 
Top