Skip to content

Latest commit

 

History

History
820 lines (623 loc) · 36.1 KB

ENVIRONMENT.air.md

File metadata and controls

820 lines (623 loc) · 36.1 KB

Working with a Hackintosh

This is how I setup my environment in order to work with hackintoshes.

Table of Contents

environment directory structure

up up up

define a HACK environment variable for all your hackintosh work. Add $HACK/bin for all the hack binaries.

binaries

  • $HACK/bin compiled versions of tools including MaciASL, IOJones, IORegistryExplorer etc
  • $HACK/git git repositories used

iasl

up up up

October 2020

follow this and get iasl from acidanthera/MaciASL

cd $HACK/bin
rm acpi*
rm iasl
cp /Bit/macos/bin/MaciASL.app/Contents/MacOS/iasl-stable $HACK/bin/iasl

legacy

goto RehabMan/Intel-iasl and

mkdir -p $HACK/git/Rehabman.git
cd $HACK/git/Rehabman.git
git clone https://github.com/RehabMan/Intel-iasl.git iasl.git
cd iasl.git
make
cd $HACK
mkdir bin && cd bin
cp $HACK/git/Rehabman.git/iasl.git/generate/unix/bin/* $HACK/bin

MaciASL

up up up

October 2020

follow this and get MaciASL from acidanthera/MaciASL

mv MaciASL.app $HACK/bin

legacy

check RehabMan/OS-X-MaciASL-patchmatic

and download RehabMan-MaciASL-2018-0507.zip, RehabMan-patchmatic-2018-0507.zip

now get it from acidanthera /MaciASL

mv MaciASL.app $HACK/bin

acidanthera/WhateverGreen

up up up

cd $HACK/git
git clone https://github.com/acidanthera/WhateverGreen.git WhateverGreen.git

Hardening

up up up

check this

cd $HACK/git
git clone https://github.com/kristovatlas/osx-config-check osx-config-check.git
git clone https://github.com/drduh/macOS-Security-and-Privacy-Guide.git macOS-Security-and-Privacy-Guide.git

corpnewt/GenSMBIOS

up up up

cd $HACK/git
git clone https://github.com/corpnewt/GenSMBIOS GenSMBIOS.git
cd GenSMBIOS.git
cp GenSMBIOS.command $HACK/bin/GenSMBIOS
chmod +x $HACK/bin/GenSMBIOS

andyvand/FixEDID

up up up

cd $HACK/git
git clone https://github.com/andyvand/FixEDID.git FixEDID.git

smut.c

cd $HACK/git
mkdir smut.git && cd smut.git
# copy from 'http://newosxbook.com/src.jl?tree=listings&file=smut.c'
wget http://newosxbook.com/code/listings/SMBIOS.h
gcc smut.c -o bios -framework IOKit -framework CoreFoundation

michalmalik/osx-re-101

cd $HACK/git
git clone https://github.com/michalmalik/osx-re-101.git osx-re-101.git

xzhih/one-key-hidpi

up up up

This script can simulate macOS HiDPI on a non-retina display, and have a "Native" Scaled in System Preferences. Home page is here

cd $HACK/git
git clone https://github.com/xzhih/one-key-hidpi.git one-key-hidpi.git

syscl/Enable-HiDPI-OSX

up up up

Hola, this is an ongoing project targets at enable the support of HiDPI for display with a high resolution under macOS.

cd $HACK/git
git clone https://github.com/syscl/Enable-HiDPI-OSX.git Enable-HiDPI-OSX.git

Benjamin-Dobell/nvidia-update.sh

up up up

cd $HACK/git
git clone https://github.com/Benjamin-Dobell/nvidia-update.git nvidia-update.git
cd nvidia-update.git
cp nvidia-update.sh $HACK/bin

vulgo/webdriver.sh

up up up

cd $HACK/git
git clone https://github.com/vulgo/webdriver.sh.git webdriver.sh.git
cd webdriver.sh.git
cp webdriver $HACK/bin

syscl/CPUTune

up up up

An open source kernel extension enables dynamic CPU performance tuning at runtime for macOS.

cd $HACK/git
git clone https://github.com/syscl/CPUTune.git CPUTune.git

avibrazil/RDM

up up up

cd $HACK/git
git clone https://github.com/avibrazil/RDM.git RDM.git
cd RDM.git
make
mv RDM.app $HACK/bin

gfxutl

up up up

Download 1.77b.RELEASE.zip

unzip 1.77b.RELEASE.zip
mv gfxutil $HACK/bin
$HACK/bin/gfxutil -f IGPU
$HACK/bin/gfxutil -f HDEF

Hackintool

up up up

check code @ headkaze/Hackintool

cp /Downloads
wget https://github.com/headkaze/Hackintool/releases/download/3.4.7/Hackintool.zip
unzip Hackintool.zip
\rm -rf  \$HACK/bin/Hackintool.app/
mv Hackintool.app $HACK/bin
open $HACK/bin/Hackintool.app

ProperTree

up up up

check code @ corpnewt/ProperTree

Download Hackintool

cd $HACK/git
git clone https://github.com/corpnewt/ProperTree.git ProperTree.git
function proper()
{
  $HACK/git/ProperTree.git/ProperTree.command $1
}

DarwinDumper

up up up

Download DarwinDumper_v3.0.4.zip

Chrome consider this a malware, so I passed on it

macserial

up up up

Download macserial-2.0.4-mac.zip

unzip macserial-2.0.4-mac.zip
mv macserial $HACK/bin
$HACK/bin/macserial

ACPIDebug.kext

up up up

A kernel extension and DSDT patches to enable debug tracing from ACPI code (DSDT) to system.log

you can see what is going on here and download it RehabMan-Debug-2015-1230.zip

mv /Downloads/RehabMan-Debug-2015-1230.zip $HACK/sources/kexts

Clover laptop config.plist and hotpatch

up up up

cd $HACK/git/Rehabman.git
git clone https://github.com/RehabMan/OS-X-Clover-Laptop-Config.git OS-X-Clover-Laptop-Config.git

This project contains config.plist files for common laptops with Intel graphics. (from README.md)

DSDT patches for HP ProBook/EliteBook/ZBook series laptops

up up up

cd $HACK/git/Rehabman.git
git clone https://github.com/RehabMan/HP-ProBook-4x30s-DSDT-Patch.git HP-ProBook-4x30s-DSDT-Patch.git

This set of patches/makefile can be used to patch your HP ProBook/EliteBook/ZBook DSDTs. There are also post install scripts that can be used to create and install the kexts the are required for this laptop series. (from README.md)

RehabMan's laptop patch repository

up up up

cd $HACK/git/Rehabman.git
git clone https://github.com/RehabMan/Laptop-DSDT-Patch.git Laptop-DSDT-Patch.git

This set of patches can be used in DSDT Editor or (preferably) MaciASL to apply some common patches to your laptop for running OS X. These patches are common for Sandy Bridge or Ivy Bridge laptops. (from README.md)

black-dragon74/OSX-Debug.git gen_debug.sh

up up up

ekalinin/github-markdown-toc

up up up

gh-md-toc — is for you if you want to generate TOC for README.md or GitHub's wiki page and don't want to install any additional software.

cd $HACK/bin
curl https://raw.githubusercontent.com/ekalinin/github-markdown-toc/master/gh-md-toc -o gh-md-toc
chmod a+x gh-md-toc
$HACK/bin/gh-md-toc ./README.md

RehabMan-MaciASL-2018-0507.zip

up up up

from here

cd ~/Downloads
wget https://bitbucket.org/RehabMan/os-x-maciasl-patchmatic/downloads/RehabMan-MaciASL-2018-0507.zip
unzip RehabMan-MaciASL-2018-0507.zip
mv /Downloads/MaciASL.app $HACK/bin

RehabMan-patchmatic-2018-0507.zip

up up up

from here

cd ~/Downloads
wget https://bitbucket.org/RehabMan/os-x-maciasl-patchmatic/downloads/RehabMan-patchmatic-2018-0507.zip
unzip RehabMan-patchmatic-2018-0507.zip
mv /Downloads/patchmatic $HACK/bin

mount_efi.sh

up up up

cd ~/Downloads
wget https://raw.githubusercontent.com/RehabMan/hack-tools/master/mount_efi.sh
# make edits to support a second argument
mv /Downloads/mount_efi.sh $HACK/bin

MountEFI

up up up

cd $HACK/git
git clone https://github.com/corpnewt/MountEFI MountEFI.git
cd MountEFI.git
cp MountEFI.command $HACK/bin
cp -R Scripts $HACK/bin/
chmod +x $HACK/bin/MountEFI.command

hack_tools

up up up

tools for various reasons:

  • mount_efi.sh
  • _install_subs.sh
  • update_lilufriend.sh
  • create_lilufriend.sh
  • template_kexts/LiluFriendLiteTemplate.kext
  • template_kexts/LiluFriendTemplate.kext
mkdir -p $HACK/git/Rehabman.git
cd $HACK/git/Rehabman.git
git clone https://github.com/RehabMan/hack-tools.git hack-tools.git
cd hack-tools.git
# make edits to mount_efi.sh to support second argument
# make edits to _install_sub.sh
# make edits to update_lilufriend.sh
# make edits to create_lilufriend.sh
# make edits to template_kexts/LiluFriendLiteTemplate.kext
# make edits to template_kexts/LiluFriendTemplate.kext
cp mount_efi.sh $HACK/bin
cp _install_subs.sh $HACK/bin
cp update_lilufriend.sh $HACK/bin
cp create_lilufriend.sh $HACK/bin
cp -r template_kexts $HACK/bin

IOJones

up up up

from here

unzip it in $HACK/bin

IORegistryExplorer.app v2.1

up up up

Interim (IORegistryExplorer.app_v3+ is broken; it can't open files it creates) IORegistryExplorer.app_v2.1; extracted from the Snow Leopard Retail Install Disc_v10.6.3

download from here

unzip it in $HACK/bin

where to install kexts

up up up

According to the second post paragraph titled Installing Kexts and this sakoula's post:

The kernelcache is an optimised and pre-linked version of the kernel with its extensions (kexts), which is then stored in /System/Library/PrelinkedKernels/prelinkedkernel, which is pointed to from its more traditional location of /System/Library/Caches/com.apple.kext.caches/Startup/kernelcache (definition from here).

According to this article Rehabman says:

Yes. Some kexts don't work well when injected (some don't work at all). It is also next to impossible to verify that the set of kexts a user has in EFI are compatible with each other. The output of kextcache provides excellent diagnostics of user mistakes/mismatches.

I tend to use injection early in the development process especially if I'm testing across multiple versions (recently tested the NUC8 with 4 different macOS versions, tweaking things here and there, and it was handy to have everything on USB, and injecting kexts from there as I was updating them, and testing with each of the 4 versions of macOS).

Then when I finalize, I install everything to /L/E.

So always place your kexts in /L/E

On the clover installation on the hard disk have all the configuration plus the bare minimum in kexts/Other directory in order to boot the installer or recovery plus SystemParameters/InjectKexts="Detect" in order to avoid clover injecting the kexts if already in the kernel cache.

A backup USB stick needs the exact same configuration as the hard disk.

With SystemParameters/InjectKexts="Detect" kexts in EFI/Clover/kexts are not injected when FakeSMC.kext or VirtualSMC.kext is in kernal cache.

Because FakeSMC.kext is always a "kext you need", you will always install it to the system volume, which will put it in kernel cache. Kernel cache, of course, will not have FakeSMC.kext when booting the installer or recovery, so in these cases the kexts in EFI/Clover/kexts will be injected as you would expect.

After putting kexts in /L/E then run chown -R root:wheel ACPIBatteryManager.kext AppleALC.kext CPUFriend.kext CPUFriendDataProvider.kext CodecCommander.kext HibernationFixup.kext Lilu.kext NullEthernet.kext SATA-unsupported.kext USBPorts.kext VirtualSMC.kext VoodooPS2Controller.kext WhateverGreen.kext, chmod -r 755 ACPIBatteryManager.kext AppleALC.kext CPUFriend.kext CPUFriendDataProvider.kext CodecCommander.kext HibernationFixup.kext Lilu.kext NullEthernet.kext SATA-unsupported.kext USBPorts.kext VirtualSMC.kext VoodooPS2Controller.kext WhateverGreen.kext and sudo kextcache -i /

LiluFriend

up up up

In order to have all the kexts installed in /L/E like Rehabman is writing you need for Lilu kexts and especially for CPUFriend Data provider LiluFriend:

It's highly recommended to let the bootloader inject CPUFriend, otherwise you'll need LiluFriend to ensure CPUFriend will work properly. Also, theoretically both ACPI_SMC_PlatformPlugin.kext and X86PlatformPlugin.kext should be untouched. You'd better use the original ones. (Well, CPUFriend will hook configResourceCallback(unsigned int, int, void const*, unsigned int, void*) in either ACPI_SMC_PlatformPlugin or X86PlatformPlugin, which parses IOKit personalities from Resources, so no problem to use a modified one if you do not really care for the signature, which will be restored in an upcoming system upgrade anyway) reference

Hi. For now, yes. I haven't found a better solution yet.Installing everything to /L/E uses Apple's native way, otherwise no. Clover's kext injection can be just for necessary and convenience. (installer/recovery)Also, it's simply wrong to leave lots of kexts outside kernel cache (Using the current way to inject kexts). A kernel cache should be the right eventual place where all kexts should go into. reference

LiluFriend.kext/Contents/Info.plist:

  <key>OSBundleLibraries</key>
  <dict>
    <key>com.apple.kpi.bsd</key>
    <string>12.0.0</string>
    <key>com.apple.kpi.iokit</key>
    <string>12.0.0</string>
    <key>com.apple.kpi.libkern</key>
    <string>12.0.0</string>
    <key>com.apple.kpi.mach</key>
    <string>12.0.0</string>
    <key>com.apple.kpi.unsupported</key>
    <string>12.0.0</string>
    <key>as.vit9696.Lilu</key>
    <string>1.2.0</string>
    <key>org.vanilla.driver.CPUFriend</key>
    <string>1.0</string>
    <key>org.vanilla.driver.CPUFriendDataProvider</key>
    <string>1.0.0</string>
    <key>as.vit9696.AppleALC</key>
    <string>1.0</string>
    <key>as.vit9696.WhateverGreen</key>
    <string>1.0</string>
  </dict>

added in CPUFriendDataProvider.kext/Contents/Info.plist in order for kextcache -i not to have an warning

<key>OSBundleCompatibleVersion</key>
<string>1.0.0</string>

based on the post the procedure to install is:

It has to contain references to each Lilu plugin (and Lilu itself) in its OSBundleLibraries dictionary, so yes, any change to the set of Lilu kexts installed results in a change to the LiluFriend (or LiluFriendLite) Info.plist. This is why I install all kexts first (with a cache rebuild), then generate LiluFriendLite, then install it, then rebuild cache again. It is quick and easy with the create_lilufriend.sh script.

Proccess you need to follow for LiluFriend:

  1. move all kexts except LiluFriend.kext to /L/E
  2. rebuild caches with sudo kextcache -i /
  3. copy LiluFriend.kext to /L/E
  4. rebuild caches again sudo kextcache -i /

Note: In order to construct the LiluFriend.kext and install it you can use RehabMan/hack-tools which are installed in $HACK/bin. Check the scripts there si a LiluFriend.kext and a codeless LiluFriendLite.kext by Rehabman. The procedure of the script is:

  1. move all kexts except LiluFriend.kext or LiluFriendLite.kext to /L/E
  2. rebuild caches with sudo kextcache -i /
  3. run $HACK/bin/create_lilufriend.sh to generate on the running directory LiluFriend.kext or LiluFriendLite.kext
  4. inspect LiluFriend.kext/Contents/Info.plist and LiluFriendLite.kext/Contents/Info.plist
  5. copy LiluFriend.kext or LiluFriendLite.kext to /L/E
  6. rebuild caches again sudo kextcache -i /

where to install kexts January 2019

up up up

It turns out that various kexts do not work always from the system location (/L/E). From the kernel logs I have seen that LiluFriend does not load (10.13.6). Also based on this it seems that VoodooI2C do no work from the system locations unless you disable some kexts that they be loaded. So I decided to inject everything from clover 'Other' directory and remove the Detect from clover Inject kexts

check this also XXX

https://www.tonymacx86.com/threads/guide-lenovo-z50-70-z40-70-g50-70-g40-70-using-clover-uefi.261787/page-4#post-1830517

It has to contain references to each Lilu plugin (and Lilu itself) in its OSBundleLibraries dictionary, so yes, any change to the set of Lilu kexts installed results in a change to the LiluFriend (or LiluFriendLite) Info.plist. This is why I install all kexts first (with a cache rebuild), then generate LiluFriendLite, then install it, then rebuild cache again. It is quick and easy with the create_lilufriend.sh script.

create DSL of stock tables

up up up

get the ACPI tables by hitting F4 in clover on a fat32 stick or on the default EFI partition. Tables will be saved in CLOVER/ACPI/origin. Hit F2 in clover to save the preboot file in CLOVER/misc/preboot.log.

create DSL files for both stock ACPI.air.bios.a06

refs.txt

External(_GPE.MMTB, MethodObj, 0)
External(_SB.PCI0.LPCB.H_EC.ECWT, MethodObj, 2)
External(_SB.PCI0.LPCB.H_EC.ECRD, MethodObj, 1)
External(_SB.PCI0.LPCB.H_EC.ECMD, MethodObj, 1)
External(_SB.PCI0.PEG0.PEGP.SGPO, MethodObj, 2)
External(_SB.PCI0.GFX0.DD02._BCM, MethodObj, 1)
External(_SB.PCI0.SAT0.SDSM, MethodObj, 4)
External(_GPE.VHOV, MethodObj, 3)
External(_SB.PCI0.XHC.RHUB.TPLD, MethodObj, 2)
cd ACPI.air.bios.a06/
../bin/iasl -da -dl -fe refs.txt DSDT.aml SSDT*.aml >iasl.output.txt 2>&1
cd ..
mkdir patches.air
cp ACPI.air.bios.a06/*dsl patches.air/

I always use ACPI 6.1 (it is referenced in patchmatic repo)

compile DSL

../bin/iasl -ve DSDT.dsl
../bin/iasl -p SSDT-USBX -ve SSDT-USBX.dsl
../bin/iasl -p SSDT-XHC -ve SSDT-XHC.dsl

string conversion

up up up

for config.plist you always use base64 format. Useful commands:

echo -n GFX0 | openssl base64 # R0ZYMA==
echo R0ZYMA== | openssl base64 -d # GFX0

for clover configurator you always use hex format. Useful commands:

echo -n GFX0|xxd -g 100 -p # 47465830
echo 47465830 | xxd -r -g 100 -p # GFX0
$ echo -n GFX0|xxd
00000000: 4746 5830                                GFX0

$ echo -n GFX0|xxd -b
00000000: 01000111 01000110 01011000 00110000                    GFX0

$ echo -n "00000000: 4746 5830" | xxd -r
GFX0

LSPCI using WMI (WMIC)

gwmi win32_pnpentity | where{$_.deviceid -match "PCI"} | select name,deviceid

clover unhide all volumes with F3

up up up

to unhide hidden entries in clover press F3

also check this for preboot partitions

AppleHDA/AppleALC patching

up up up

references

Debugging

up up up

log show --debug --info --start "2018-08-18 23:00:00" | grep -E 'kernel:|loginwindow:|sakoula'
log show --predicate 'process == "kernel" AND (eventMessage CONTAINS "AppleALC" OR eventMessage CONTAINS "Lilu")' --style syslog --source
log show --predicate 'process == "kernel"' --style syslog --source
log show --debug --info --start "2018-08-19 10:00:00" | grep -E 'sakoula'
log stream --source --level debug | grep -E 'kernel:|loginwindow:|ACPIDebug:'
log stream --source --level debug | grep -E 'kernel:|loginwindow:|ACPIDebug:'
log show --source --debug --info --start "2018-08-19 10:00:00" | grep -E 'kernel:|loginwindow:|ACPIDebug:'
log show --source --start "2018-08-19 10:00:00" | grep -E 'kernel:|loginwindow:|ACPIDebug:'
log show --source --start "2018-08-19 10:00:00" | grep -E 'ACPIDebug:'

log show --source --debug --info --last boot | grep -E 'kernel:|loginwindow:|ACPIDebug:'
log show --source --debug --info --last 1m | grep -E 'kernel:|loginwindow:|ACPIDebug:'
log show --source --debug --info --last 2h | grep -E 'kernel:|loginwindow:|ACPIDebug:'
log show --source --debug --info --last 2d | grep -E 'kernel:|loginwindow:|ACPIDebug:'
log show --debug --info --start "2018-08-22 09:38:00" | grep -E 'kernel:|loginwindow:|ACPIDebug:'
log show --predicate 'process == "kernel" AND (eventMessage CONTAINS "AppleALC" OR eventMessage CONTAINS "Lilu")' --style syslog --source
log show --predicate 'process == "kernel"' --style syslog --source

references

up up up

software

up up up

macOS guides on Xiaomi

up up up

macOS guides on other hardware

up up up

Troubleshooting with lid

up up up

linux guides

up up up

Interesting Hackintosh Sites

up up up

Guides etc

up up up

DSDT related references

up up up

BIOS related information

up up up

Various

up up up

HiDPI

up up up