The EFI system partition (ESP) is a disk storage partition fundamental for any macOS USB Flash Drive installer or MacOS System disk in order to successfully boot any macOS Hackintosh system based on the Unified Extensible Firmware Interface (UEFI).
When booting an UEFI based computer system, the combination of Clover boot loader and UEFI firmware enables the implementation of the macOS operating system or MacOS System Installer, by also initialising non standard hardware or software components if necessary and configured such.
Following the UEFI convention, the EFI system partition needs to be formatted with a FAT file system. Each EFI system partition has a Globally Unique Identifier (GUID) in the GUID Partition Table ( GPT). It also has a certain ID in the master boot record (MBR). UEFI provides backwards compatibly with legacy systems. Thus, if any of your hardware components or it’s firmware is not fully macOS UEFI compatible, booting in legacy BIOS mode by enabling the Legacy “Compatibility Support Module” (CSM) in your UEFI Mainboard BIOS many times resolves related issues (e.g. issues with multi-monitor support in case of Nvida GPUs and related web drivers).
How to properly format a future USB Flash Drive Installer or MacOS System disk?
Any USB Flash Drive installer or future macOS system disk needs to formatted with HFS+ (Mac OS Extended; Journaled) and a GUID partition table primer oder during the MacOS Installation, which will create both an empty HFS+ System partition and an empty FAT EFI-partition.
While the according procedure with Apple’s Disk utility is detailed in “How to use Disk Utility”, one finds below the respective terminal equivalents. It is evident, that, provided the ability of an alternative and functional Apple or Hackintosh system and also provided the ability of occasionally required adopters, any USB, HDD or SSD disk can be formatted such primarily to the MacOS Installation. In contrary, M.2/NVME drives many times will have to be formatted during the MacOS Installation procedure, by using either Apple’s Disk utility or the respective terminal commands from within the macOS Installer’s Graphical User Interface (GUI).
Disk Utility Terminal equivalents:
In the output of the terminal command
which can be read by scrolling backwards, one finds all internal and external disks named /dev/disk0, /dev/disk1, etc. connected to your system.
Now unmount the Disk with the disk identifier for which you would like to create the System and EFI-Folder partitions.
diskutil unmount /dev/diskX
diskutil partitionDisk /dev/diskX 1 GPT jhfs+ "iMacPro" R
Alternatively one can also use the following terminal command:
diskutil partitionDisk /dev/diskX GPT JHFS+ iMacPro 0b
Finally remount the freshly formatted disk with:
diskutil apfs convert /dev/diskX
You now have a yet empty HFS+ formatted disk with a yet empty FAT formatted EFI-Partition.
The empty EFI-Partition can now be populated with a pre-configured and likely adopted EFI-Folder being part of some EFI-Folder distribution likely attached to some Desktop Installation guideline. Such EFI-Folder naturally would also already include the most recent UEFI Clover Boot Loader distribution, absolutely mandatory for booting any UEFI based Hackintosh system.
If the primer is not the case, the EFI-Folder with the most recent UEFI Clover Boot Loader distribution can be created separately within a standard UEFI Clover Boot Loader installation.
How to mount/anmount an EFI-partition
The EFI-partition can be usually mounted/unmounted with tools like EFI-Mounter v3 or Clover Configurator. However, like always there are also some Terminal command line equivalents.
How to mount/anmount an EFI-partition by means of Clover Configurator:
1.) Download Clover Configurator.app from https://mackie100projects.altervista.org/download-clover-configurator/, copy Clover Configurator.app to your “Applications” folder and run Clover Configurator.app.
2.) Go to Sections “Tools”, “Mount EFI” and “EFI-Partitions” and click with your mouse on the “Mount Partition” button assigned to the disk of your choice:
3.) To open a Finder Window, showing the content of the respective disk’s EFI-partition, click with the mouse on button “Open Partition”
1.) Discover the disk with the EFI-partition to be mounted with
/dev/disk0 #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *251.0 GB disk0 1: EFI 209.7 MB disk0s1 2: Apple_HFS Macintosh HD 500.2 GB disk0s2 3: Apple_Boot Recovery HD 650.0 MB disk0s3
2.) To mount the EFI-Partition use the following terminal commands:
mkdir /Volumes/efi sudo mount -t msdos /dev/disk0s1 /Volumes/efi
Basic and Fundamental Structure of an EFI-Folder
Any EFI-Folder must have the following basic but fundamental structure:
1.) Mandatory Clover Boot Loader Files:
a.) /EFI/BOOT/BOOTX64.efi (boot loader file)
b.) /EFI/CLOVER/CLOVERX64.efi (same file as BOOTX64.efi but different naming)
c.) Following optional 64-bit UEFI drivers to be manually selected during the Clover installation and installed under /EFI/CLOVER/drivers64UEFI/:
A basic config.plist is automatically created if not already present in /EFI/CLOVER/ during any UEFI Clover Boot Loader installation. If already present, the config.plist remains untouched during the UEFI Clover Boot Loader installation. The config.plist is an intrinsic system configuration file, absolutely mandatory for successfully booting any UEFI based Hackintosh System. However, the config.plist initially installed with Clover is never optimised, might be incomplete and therefore has to be separately adopted/modified for each specific macOS Hackintosh system. Even a pre-configured config.plist being part of any EFI-Folder distribution might require certain additional modifications/adaptations in dependence on the deviating hardware configuration. The configuration file is written in XML but can be easily edited by means of any text editor, or more easily be means of Clover Configurator.
See the following post How to edit and configure a basic config.plist for booting your MacOS Hackintosh system.
The MacOS kernel can be extended by means of specific kexts implemented in /EFI/Clover/kexts/Other/. Kexts usually are specific drivers for certain hardware components, protocols etc. to be additionally handled/implemented or else handled/implemented by the macOS Kernel. Kexts are usually written in C++ but sometimes only contain a certain plist configuration to be handled by the macOS kernel. A kext usually is part of a framework, platform, nub, etc.forming an OSX driver. A kext can also impose or transfer information to other kexts being part of the default macOS distribution and usually handles ACPI or e.g. CPU, GPU, Audio, LAN, Bluetooth, WIFI, USB hardware. Any loaded kext usually becomes part of the kernel address space, thus small errors within the kext implementation can result in kernel panics (KP) and in a system wide freeze of the entire respective MacOS Hackintosh system.
While after standard Clover Boot Loader Installation /EFI/Clover/kexts/Other/ usually remains empty, an EFI-Folder of a pre-configured EFI-Folder distribution can contained all kexts relevant for a certain system configuration. Kexts usually can be added or removed by means of Apple’s Finder application or respective terminal commands. Specific CPU, GPU, Audio, LAN, Bluetooth, WIFI, USB Kext Repositories usually can be found on GitHub.
Fundamental kexts for booting your Hackintosh system are FakeSMC.kext in general and TSCAdjustReset.kext (with the “IOCPUNumber” in it’s “Info.plist” properly adopted to the actual number of CPU threads minus one ) at least in case of Broadwell/Haswell/X99 and Skylake-X/X299 systems.
How to create for instance your own XHC USB Kext is detailed in XHC USB Kext Creation Guideline.
4.) DSDT/SSDT AML-files
Although /EFI/CLOVER/ACPI/original/ and /EFI/CLOVER/ACPI/patched/ remain empty after a standard Clover Boot Loader installation, certain aml-files can be added during the post installation procedure to basically modify/optimise the ACPI (Advanced Configuration and Power Interface) component architecture of e.g. related mainboard, CPU, GPU, Audio, LAN, Bluetooth, WIFI, USB hardware implementations.
One basically defers between:
a.) The DSDT.aml (Differentiated System Description Table) being part of the system ACPI specification. The original system DSDT usually can be dumped by pressing F4 within the Clover Boot Menu, before booting the respective MacOS System partition. The dumped DSDT will be stored by Clover within /EFI/CLOVER/ACPI/original/. Usually one can fix certain errors in or apply certain modifications to the dumped system DSDT and save the patched DSDT.aml in /EFI/CLOVER/ACPI/patched/, with the aim of improving the relevant ACPI specifications during next system boot.
b.) SSDT.amls (Secondary System Description Tables), which usually modify or extend the system ACPI specifications else implemented in the DSDT.
For modifying or patching the system DSDT.aml and for creating or modifying PCI hardware specific SSDT.amls, one usually employs the MaciASL ASL/DSL editor and ASL optimizer/compiler/dissambler.
For further details see How to implement PCI devices by means of SSDTs based on DSDT and IOREG ACPI Information.
Once having at your deposit a complete and fully working EFI-Folder for your specific build and system configuration, ensure regular backups of the latter, especially before performing Clover updates or any other subsequent EFI-Folder modification!
Enjoy and have fun,