hieplpvip / Asus-Zenbook-Hackintosh

Run macOS on Asus Zenbook with OpenCore
199 stars 44 forks source link

Add UX430UA-R config part, enables hibernation, proper sleep and AppleALC correct codec patch #83

Closed Ubsefor closed 3 years ago

Ubsefor commented 3 years ago

Add UX430UA-R config part, enables hibernation, proper sleep and AppleALC correct codec patch

hieplpvip commented 3 years ago

Hi, thank you very much for the pull request (I really appreciate that). However, I'm sorry to say I wouldn't merge this, as I'm planning to remove Clover support and merge opencore branch to master. I have made some big changes in opencore branch, so please wait for that. I will merge some of your changes manually (e.g. layout-id). Meanwhile, I have some questions for you:

Ubsefor commented 3 years ago

Hello, thank you for responding. I actually changed the OpenCore branch, the clover one remains unchanged. I see now that I have mistaken when selecting pull requests and selected merge to your master, sorry for that

NormalizeHeaders option is used to enable proper sleeping and native hibernation, it is actually handled pretty good in OC

Hibernation is actually achieved in a different ways in mac os: there is no «Hibernation» term here. Instead, there is a «Safe Sleep» – the machine firstly enters normal sleep, without cutting power supply to ram and other components, then the RAM gets copied to sleepimage (usually /var/vm/sleepimage), while RAM is still powered on. Next, after a certain time, Mac OS enters S4 sleep a.k.a hibernation, the problem with hackintoshes is that either mac os or bootloader can't make S4 boot, loading the sleepimage, however, with certain tweaks it's possible. The usual tweaks include fixing power management, fixing TSC registry (in my case) and having a correct ports mapping.

TL;DR: OC uses RTC and NVRAM to detect whether mac os is in hibernated state and correctly executes S4 boot, you can read about it in official configuration.pdf

hieplpvip commented 3 years ago

I don't think NormalizeHeaders has anything to do with sleep and hibernation. It's only for fixing SSDT headers. If you can boot without it, you shouldn't need it.

I have created a new config file for your model here. I also rewrite scripts. Now you can run ./download.sh then ./build.sh and it will build EFI folder for you.

Please test it and create a new pull request. This should be closed as it's outdated.

And please don't pollute the config with Hardware ACPI dump.

Ubsefor commented 3 years ago

I do believe, that hibernation and sleep did not work for me without NormalizeHeaders, will test this a bit later, too busy with studies rn.

hieplpvip commented 3 years ago

Ok, I will enable NormalizeHeaders as it does no harm.

hieplpvip commented 3 years ago

Still, can you tell me how hibernation works for you on macOS? I have only used hibernation on Windows, so I don't know much about it on macOS.

Ubsefor commented 3 years ago

It just sleeps, for pmset I use the following options: System-wide power settings: VACTDisabled 0 Currently in use: standby 1 womp 1 halfdim 1 hibernatefile /var/vm/sleepimage proximitywake 1 powernap 1 gpuswitch 2 networkoversleep 1 disksleep 10 standbydelayhigh 21600 sleep 1 (sleep prevented by coreaudiod, coreaudiod, apfsd) autopoweroffdelay 43200 hibernatemode 3 autopoweroff 1 ttyskeepawake 1 displaysleep 15 (display sleep prevented by zoom.us) tcpkeepalive 1 highstandbythreshold 40 standbydelaylow 10800

Basically, this means that when I close the LID, Mac OS firstly sleeps (fast wake when LID open), after 21600 (when charge is above 40%) or after 10800 seconds it enters «deep sleep» – powers off ram, saving it’s contents to /var/vm/sleepimage, then, after 43200 seconds, the PC powers off most of it’s elements, to boot next time from sleep image. Note that during «phase 2» the wake from sleep is longer, and after «hibernation wake» the programms open up just like after powering off (but actually restoring their contents after a short amount of time). Note that using safe sleep is slightly better than normal sleep, as if the power loss occurs, the things you’ve been working on aren’t lost.

Also, you can completely turn off hibernation by setting via pmset the hibernatemode to 0 – the system will use only normal sleep.

Also note, that Apple has broken Intel Graphics drivers a bit, so 1) There is no way to enable DRM content play in iTunes, as certain registers are not getting accessed for decoding data streams, and 2) after sleep/hibernation it is common to see GFX capped at certain frequency, usually the same with that, specified for your iGPU on ark.intel.com.

hieplpvip commented 3 years ago

Thanks, I'll update the configs to properly support hibernation,

Ubsefor commented 3 years ago

I do not promise that it will work, need futher testing, as it could potentially panic right after wake

hieplpvip commented 3 years ago

By default hibernatemode is 3, so I think it shouldn't break anything

Ubsefor commented 3 years ago

Just tested booting without NormalizeHeaders – did not succeed in it :(

So I guess UX430UAR needs that option

hieplpvip commented 3 years ago

OK, I have enabled NormalizeHeaders. Could you please test master branch? Create a file named smbios.txt in src, similar to smbios-sample.txt, then put your serial in it. Run ./download.sh && ./build.sh and it will build EFI folder for you.

Ubsefor commented 3 years ago

I will test as soon as I am able to, thank you

Ubsefor commented 3 years ago

I made some wizardy with configs, turns out that we don’t need NormalizeHeaders and any other quirks in ACPI

The thing that was interfering with these options is DisableLinkedJettison in kernel section, so we should turn it off

hieplpvip commented 3 years ago

DisableLinkedJettison is a better replacement for keepsyms=1. It's necessary on Big Sur.

Can you boot with it turned on?