Building a hackintosh - Intel 9600kf, Gigabyte Aorus Z390 Pro, Radeon RX590

Picking the most compatible hardware is essential for a Hackintosh, so I went with an Intel 9600kf CPU, a Gigabyte Aorus Z390 PRO motherboard, and a Radeon RX590 graphics card, and a 970 Evo Plus SSD.
The onboard Intel ethernet works with a custom driver (kext), and WiFi and Bluetooth work with an extra Fenvi T919 card installed.

Steps - high level


  1. Download Catalina Installer from MacOS store on any real Mac
  2. Create a USB installer of Catalina (you need a 16Gb or larger USB drive for Catalina)
  3. Find the custom drivers you need (the kexts)
  4. Change BIOS settings on the new hardware
  5. Patch the USB installer with Clover so it can boot on a non-Mac hardware
  6. Install it on the new hardware
  7. Install Clover on the new hardware so it can boot
  8. Fix potential USB issues by disabling some of the unused USB ports using a custom generated kext from USBMap 

Steps - details


Read the Vanilla Guide before starting. It's not too long, but you need to understand every step. Make sure you understand NOT to install Clover on a real mac - only on a USB drive and on a Hackintosh.

USB installer


Download Catalina Installer from MacOS store on any real Mac and put it on the USB drive using the Vanilla guide.

Find the custom drivers you need (the kexts)



Change BIOS settings on the new hardware


The most important setting is XHCI Hand-off : Enabled.

Patch the USB installer with Clover so it can boot on a non-Mac hardware


Get Clover and Clover configurator http://mackie100projects.altervista.org/download-clover-configurator/. 
Get macserial to generate a valid but unused serial number 

Use the Vanilla guide to select the right settings in Clover, but make sure to install EmuVariableUefi driver as well.
Load the Coffee Lake defaults from the Vanilla guide, then follow cmer's step-by-step to customise it to your settings.

Once the setup is done, copy the kexts to /EFI/CLOVER/kexts/Other and the customised Config.plist to /EFI/CLOVER/

Install it on the new hardware


Boot from the USB. If you get a corrupted screen with a prohibited sign, it's probably the USB port getting ejected during install. Plug the key into the USB hub of the motherboard or an external USB 2.0 hub and try again.

Dual boot setup


The easiest is to pre-allocate the space for Windows during MacOS install. During install, use the advanced setup and create two MacOS partitions - the second one you can name "Free" and choose another filesystem for it. During the Windows install later, select this partition as a target, and reformat it to NTFS.

Install Clover on the new hardware so it can boot


After the installation, you have to install Clover with the same settings to the Hackintosh. Copy your EFIs and Config.plist to your EFI partition.

The easiest way to mount the EFI partition is to use Clover Configurator, but you can do it from the command line as well using the 

diskutil list
sudo diskutil mount /dev/diskXsY
command.

Post-install fixes


Check the system log


There are many reasons you would want to see what was happening that resulted in an error.

sudo pmset -g log 

Fix potential USB issues by disabling some of the unused USB ports using a custom generated kext from USBMap 


The USB Inject kext injects all USB ports, even though the limit is 15. The downside is that all of the ports are slow ports (HS, high-speed, USB 2.0) instead of fast ports (SS, superspeed, USB 3.0).
Each physical superspeed port is a high-speed port as well, so a physical port uses two USB slots from the available 15.

To fix this, get USBMap and any USB device, and plug it into all the available ports you want to use. The rest can be disabled. 
However, watch out, one internal USB header is required for Fenvi T919 is you want to use its Bluetooth feature (plug the little cable into this and the card).
Cmer created a great video explaining how to use the USBMap tool, follow this.

For me, I kept the following ports:

HS10 - front 1
HS09 - front 2

HS04 - back
HS03 - back
HS05 - back
HS06 - back, USB-C

HS13 - back hub ports

HS11 - internal USB connector 1 (for Bluetooth on Fenvi T919)
HS12 - internal USB connector 2

And disabled the followings:

HS08 - back - disable (under ethernet)
HS07 - back - disable (under ethernet)

NVRAM native support


UPDATE: this may prevent iMessage from working!

Instead of emulated NVRAM using the EmuVariableUefi.efi driver, it is possible on the Z390 to enable native NVRAM support.
Simply delete the EmuVariableUefi.efi from EFI/CLOVER/drivers/UEFI fodler, and place the SSDT-PMC.aml file into the EFI/CLOVER/ACPI/patched. 

Time on Windows is off


Windows and Mac use different timezones in the BIOS, so we have to force Windows to use the BIOS clock as UTC; otherwise, the two OSes keep displaying the wrong time and setting and resetting the clock:

Reg add HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation /v RealTimeIsUniversal /t REG_QWORD /d 1

Mouse on MacOS is too slow


The fastest mouse "scaling", or speed is 3 on Catalina if you set it from the GUI. You can make it faster by executing the following commands:

defaults read -g com.apple.mouse.scaling   
defaults write -g com.apple.mouse.scaling 4

Prevent hibernate to disk, sleep to memory only


sudo pmset -a hibernatemode 0

Check logs if something is not right


sudo pmset -g log q | grep "XXX"


Kernel panic log is saved to

/Library/Logs/DiagnosticReports

The hard drive, as a UEFI boot option is gone, the system does not boot at all

You probably lost the UEFI setting from the NVRAM of the bios, so you need to re-add your Clover efi file as a boot option, using the efibootmgr command in Linux.

In my case, as it is an NVME drive, I had to execute the following command as root:

efibootmgr -c -d /dev/nvme0n1 -p 1 -L "BOOT" -l '\EFI\BOOT\BOOTX64.efi'

My config.plist

Don't paste this in - it's just a readable text format, not .plist format.

{
  ACPI = {
    DSDT = {
      Fixes = {
        AddMCHC = NO;
        FixHPET = NO;
        FixIPIC = NO;
        FixRTC = YES;
        FixShutdown = YES;
        FixTMR = NO;
      };
      Patches = (
        {
          Comment = "change XHCI to XHC";
          Disabled = NO;
          Find = {length = 4, bytes = 0x58484349};
          Replace = {length = 4, bytes = 0x5848435f};
        },
        {
          Comment = "change XHC1 to XHC";
          Disabled = NO;
          Find = {length = 4, bytes = 0x58484331};
          Replace = {length = 4, bytes = 0x5848435f};
        },
        {
          Comment = "change SAT0 to SATA";
          Disabled = NO;
          Find = {length = 4, bytes = 0x53415430};
          Replace = {length = 4, bytes = 0x53415441};
        },
        {
          Comment = "Fix 300-series RTC Bug";
          Disabled = YES;
          Find = {length = 8, bytes = 0xa00a935354415301};
          Replace = {length = 8, bytes = 0xa00a910aff0bffff};
        },
        {
          Comment = "change HECI to IMEI";
          Disabled = NO;
          Find = {length = 4, bytes = 0x48454349};
          Replace = {length = 4, bytes = 0x494d4549};
        },
      );
    };
    DropTables = (
      {
        Signature = DMAR;
      },
      {
        Signature = MATS;
      },
    );
    FixHeaders = YES;
    HaltEnabler = NO;
    SSDT = {
      Generate = {
        PluginType = YES;
      };
    };
  };
  Boot = {
    Arguments = "keepsyms=1 dart=0 slide=0 darkwake=8 shikigva=32 alcid=11";
    DefaultVolume = MacOS;
    Timeout = 5;
    XMPDetection = Yes;
  };
  Devices = {
    Audio = {
      Inject = No;
      ResetHDA = NO;
    };
    Properties = {
      "PciRoot(0x0)/Pci(0x2,0x0)" = {
        "AAPL,ig-platform-id" = {length = 4, bytes = 0x0300923e};
        "framebuffer-patch-enable" = {length = 4, bytes = 0x01000000};
        "framebuffer-stolenmem" = {length = 4, bytes = 0x00003001};
      };
    };
    USB = {
      FixOwnership = YES;
      HighCurrent = YES;
      Inject = YES;
    };
  };
  GUI = {
    Scan = {
      Entries = YES;
      Tool = YES;
    };
    Theme = embedded;
  };
  Graphics = {
    Inject = {
      ATI = NO;
      Intel = NO;
      NVidia = NO;
    };
  };
  KernelAndKextPatches = {
    AppleIntelCPUPM = NO;
    KernelPm = YES;
    KextsToPatch = (
      {
        Comment = "External icons patch";
        Disabled = NO;
        Find = {length = 8, bytes = 0x45787465726e616c};
        InfoPlistPatch = NO;
        Name = AppleAHCIPort;
        Replace = {length = 8, bytes = 0x496e7465726e616c};
      },
    );
  };
  RtVariables = {
    BooterConfig = 0x28;
    CsrActiveConfig = 0x3E7;
    MLB = C02726902CDH69F1M;
    ROM = UseMacAddr0;
  };
  SMBIOS = {
    BiosReleaseDate = "10/30/2019";
    BiosVendor = "Apple Inc.";
    BiosVersion = "IM191.88Z.F000.B00.1910301745";
    BoardManufacturer = "Apple Inc.";
    BoardType = 10;
    BoardVersion = "1.0";
    ChassisAssetTag = "iMac-Aluminum";
    ChassisManufacturer = "Apple Inc.";
    ChassisType = 0x09;
    EfiVersion = "1037.60.50.0.0";
    Family = iMac;
    FirmwareFeatures = 0xFD8FF576;
    FirmwareFeaturesMask = 0xFFDFFF7F;
    LocationInChassis = "Part Component";
    Manufacturer = "Apple Inc.";
    Mobile = NO;
    PlatformFeature = 0x22;
    ProductName = "iMac19,1";
    Version = "1.0";
  };
  SystemParameters = {
    InjectKexts = Yes;
    InjectSystemID = YES;
  };
}







Comments

Popular posts from this blog

MurMurHash3, an ultra fast hash algorithm for C# / .NET

Quick select algorithm - find the Kth element in a list in linear time

ESP32 - send a push notification from the Arduino ESP32 device to your phone