Clover EFI

From tonymacx86 Wiki
Jump to: navigation, search

Contents

Overview

Clover EFI is an open source EFI boot project based on Chameleon, rEFIt, XNU, and VirtualBox, with base code provided from the EDK2/Tianocore project.

Technology

Clover is meant to provide a real EFI boot path for hackintoshing, and as a result uses many features and technologies which may be unfamiliar. The central component is EFI, or the Extensible Firmware Interface, meant to thoroughly modernize the previous BIOS system. EFI is capable of providing intelligent boot solutions, full filesystem drivers, a shell, and friendlier interface. One important distinction between EFI and MBR/INT13 boot is that the previous method required chaining several components to boot an operating system: the BIOS called INT13 to gather the storage devices, then found the first with a bootable Master Boot Record, and passed control to it. The MBR then passed to the first eligible partition (often the "active" partition on Windows systems), whose Partition Boot Record then passed control to the operating system loader (NTLDR on XP, boot on hackintoshes using Boot123/Chameleon/Chimera). This method required each component to successfully pass control to the next link in the chain, and also meant that the BIOS would be unaware of the result.

Aptio
"AMI's next-generation BIOS firmware based on the UEFI Specifications and the Intel® Platform Innovation Framework for EFI"
CSM
Compatibility Support Module, required on EFI systems, to boot OSes in legacy BIOS mode
DXE
Driver eXecution Environment
VirtualBox
Provides most of the EFI drivers used by Clover

Config.plist

Clover EFI take its configuration from a config.plist file which contains all necessary sections, located in /EFI or /EFI/OEM/<System Product Name>

A sample config.plist:

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 
<plist version="1.0"> 
<dict> 
    <key>Pointer</key> 
    <dict> 
        <key>Speed</key> 
        <string>20</string> 
        <key>DoubleClickTime</key> 
        <string>500</string> 
    </dict> 
    <key>KernelAndKextPatches</key> 
    <dict> 
        <key>Debug</key> 
        <string>No</string> 
        <key>ATIConnectorInfo</key> 
        <string>No</string> 
        <key>KernelCpu</key> 
        <string>No</string> 
        <key>AsusAICPUPM</key> 
        <string>No</string> 
        <key>AppleRTC</key> 
        <string>Yes</string> 
    </dict> 
    <key>Volumes</key> 
    <dict> 
        <key>HideVolumes</key> 
        <dict> 
            <key>2</key> 
            <dict> 
                <key>VolumeString</key> 
                <string>HD(4,GPT,728CBE62-5DBD-4565-9F77-297906AD6613,0x12D90800,0x3E80000)</string> 
            </dict> 
            <key>1</key> 
            <dict> 
                <key>VolumeString</key> 
                <string>HD(2,MBR,0x9FF6F960,0x24B297B,0x10567535)</string> 
            </dict> 
            <key>0</key> 
            <dict> 
                <key>VolumeString</key> 
                <string>HD(1,MBR,0x9FF6F960,0x2,0x24B2978)</string> 
            </dict> 
        </dict> 
        <key>HideAllLegacy</key> 
        <string>Yes</string> 
    </dict> 
    <key>SystemParameters</key> 
    <dict> 
        <key>iCloudFix</key> 
        <string>Yes</string> 
        <key>boot-args</key> 
        <string>npci=0x2000 darkwake=0 slide=0</string> 
        <key>prev-lang:kbd</key> 
        <string>en:0</string> 
        <key>DefaultBootVolume</key> 
        <string>mLion</string> 
        <key>CustomUUID</key> 
        <string>511CE200-1000-4000-9999-010203040506</string> 
        <key>InjectSystemID</key> 
        <string>Yes</string> 
        <key>LegacyBoot</key> 
        <string>PBR</string> 
        <key>BacklightLevel</key> 
        <string>0x0</string> 
    </dict> 
    <key>SMBIOS</key> 
    <dict> 
        <key>ProductName</key> 
        <string>iMac12,2</string> 
    </dict> 
    <key>CPU</key> 
    <dict> 
        <key>Turbo</key> 
        <string>No</string> 
        <key>ProcessorType</key> 
        <string>0x0201</string> 
        <key>CpuFrequencyMHz</key> 
        <string>2900</string> 
        <key>BusSpeedkHz</key> 
        <string>100000</string> 
        <key>QPI</key> 
        <string>1050</string> 
    </dict> 
    <key>Graphics</key> 
    <dict> 
        <key>CustomEDID</key> 
        <string>00ffffffffffff001e6d98560101010105130103ea312078eaaec5a2574a9c25125054a76b80950081808140714f01010101010101017c2e90a0601a1e4030203600da281100001a21399030621a274068b03600da281100001c000000fd00384b1c530f000a202020202020000000fc0057323238340a20202020202020003e</string> 
        <key>InjectEDID</key> 
        <string>Yes</string> 
        <key>GraphicsInjector</key> 
        <string>Yes</string> 
        <key>VRAM</key> 
        <string>1024</string> 
        <key>LoadVBios</key> 
        <string>No</string> 
        <key>PatchVBios</key> 
        <string>No</string> 
        <key>VideoPorts</key> 
        <string>2</string> 
        <key>FBName</key> 
        <string>Makaka</string> 
        <key>NVCAP</key> 
        <string>04000000000003000C0000000000000A00000000</string> 
        <key>display-cfg</key> 
        <string>03010300FFFF0001</string> 
    </dict> 
    <key>PCI</key> 
    <dict> 
        <key>StringInjector</key> 
        <string>No</string> 
        <key>DeviceProperties</key> 
        <string></string> 
        <key>PCIRootUID</key> 
        <string>0</string> 
        <key>HDAInjection</key> 
        <string>No</string> 
        <key>USBInjection</key> 
        <string>No</string> 
        <key>LpcTune</key> 
        <string>No</string> 
    </dict> 
    <key>ACPI</key> 
    <dict> 
        <key>DsdtName</key> 
        <string>dsdt_clover_u1a.aml</string> 
        <key>DropOemSSDT</key> 
        <string>No</string> 
        <key>DropAPIC</key> 
        <string>No</string> 
        <key>DropMCFG</key> 
        <string>No</string> 
        <key>DropHPET</key> 
        <string>No</string> 
        <key>DropECDT</key> 
        <string>No</string> 
        <key>GenerateCStates</key> 
        <string>Yes</string> 
        <key>GeneratePStates</key> 
        <string>Yes</string> 
        <key>PLimitDict</key> 
        <string>0</string> 
        <key>UnderVoltStep</key> 
        <string>0</string> 
        <key>EnableC6</key> 
        <string>No</string> 
        <key>EnableC4</key> 
        <string>No</string> 
        <key>EnableC2</key> 
        <string>No</string> 
        <key>EnableISS</key> 
        <string>Yes</string> 
        <key>ResetAddress</key> 
        <string>0x64</string> 
        <key>ResetValue</key> 
        <string>0xFE</string> 
        <key>smartUPS</key> 
        <string>No</string> 
        <key>PatchNMI</key> 
        <string>No</string> 
        <key>FixDsdtMask</key> 
        <string>0x0</string> 
    </dict> 
</dict> 
</plist>

Usage

Hotkeys

  • F1 Multilingual Help
  • F2 Save boot.log and preboot.log
  • F4 Save unpatched ACPI tables to /EFI/acpi/patched
  • F5 Save patched DSDT with mask applied
  • F6 Save VBios to /EFI/misc/cNNNN.bin (N is a numeral)
  • F10 Save screenshot
  • F12 Eject optical disc, and refresh on reinsert

Features

Booting

Clover EFI provides two boot modes, BIOS and UEFI:

  • BIOS (32 or 64 bit) BIOS → MBR (boot0) → PBR (boot1h/boot1f32) → BOOT (boot1/boot3/boot6) → CLOVERIA32.efi/CLOVERX64.EFI → OS
  • UEFI (64 bit) UEFI → BOOTX64.EFI → OS

PBR provides two choices, for HFS+ and FAT32 filesystems

UEFI boot may require extra drivers

/EFI/drivers64UEFI:
    DataHubDxe-64.efi
    FSInject-64.efi
    HFSPlus.efi
    OsxAptioFixDrv-64.efi
    OsxFatBinaryDrv-64.efi
    PartitionDxe-64.efi

DSDT Patching

In addition to choosing these options from the boot screen, the patching two-byte bitmask is composed (in increasing order):

DTGP, WARNING, SHUTDOWN, MCHC, HPET, LPC, IPIC, SBUS, DISPLAY, IDE, SATA, FIREWIRE, USB, LAN, WIFI, HDA

You may also specify a pre-edited DSDT with

<key>ACPI</key>
    <dict>
        <key>DsdtName</key>
        <string>dsdt.aml</string>

Kext Patching

Simple binary kext patching proceeds like

  <key>KextsToPatch</key>
  <dict>
   <key>0</key>
   <dict>
        <key>Name</key>
        <string>VoodooHDA</string>
        <key>Find</key>
        <data>SGVhZHBob25lcwA=</data>
        <key>Replace</key>
        <data>VGVsZXBob25lcwA=</data>
   </dict>
  </dict>

This would replace the hex for "Headphones" with the hex for "Telephone" in VoodooHDA.kext

Graphics Injection

Necessary options depend on your graphics card.

Intel

Typically require

<key>Graphics</key>
<dict>
    <key>GraphicsInjector</key>
    <string>Yes</string>

You may also require the DISPLAY DSDT patch

NVidia

Typically only requires GraphicsInjector=Yes, but could be as verbose as

<key>Graphics</key>
<dict>
    <key>GraphicsInjector</key>
    <string>Yes</string>
    <key>LoadVBios</key>
    <string>No</string>
    <key>VideoPorts</key>
    <string>3</string>
    <key>NVCAP</key>
    <string>04000000000003000C0000000000000700000000</string>
    <key>display-cfg</key>
    <string>03010300FFFF0001</string>
</dict>

AMD/ATI

Usually requires more work, but is comparable to Chimera/Chameleon:

<key>Graphics</key>
<dict>
    <key>GraphicsInjector</key>
    <string>Yes</string>
    <key>FBName</key>
    <string>Ipomoea</string>
    <key>LoadVBios</key>
    <string>No</string> 
    <key>VideoPorts</key>
    <string>3</string>
</dict>

Mobile chipsets normally require LoadVBios=Yes

Extended Display Identification Data (EDID)

In rare cases EDID injection is necessary:

    <key>InjectEDID</key>
    <string>Yes</string>
    <key>CustomEDID</key>
    <data>AP///////wAyDADfAAAAAAASAQOAIRV4CunVmVlTjigmUFQAAAABAQEBAQEBAQEBAQEBAQEB3iGgcFCEHzAgIFYAS88QAAAY3iGgcFCEHzAgIFYAS88QAAAAAAAA/gBXNjU3RwAxNTRXUDEKAAAA/gAjMz1IZYSq/wIBCiAgAJo=</data>

SMBIOS Patching

The "SMBIOS" section of config.plist typically is not necessary as the information will be generated by Clover automatically, but the system model, a specific entry (like a serial number) maybe be overridden, or the entire section

<key>SMBIOS</key>
<dict>
    <key>BiosVendor</key>
    <string>Apple Inc.</string>
    <key>BiosVersion</key>
    <string>MB11.88Z.0061.B03.0809221748</string>
    <key>BiosReleaseDate</key>
    <string>05/03/10</string>
    <key>Manufacturer</key>
    <string>Apple Inc.</string>
    <key>ProductName</key>
    <string>Macbook1,1</string>
    <key>Version</key>
    <string>1.0</string>
    <key>Family</key>
    <string>MacBook</string>
    <key>SerialNumber</key>
    <string>4H629LYAU9C</string>
    <key>SmUUID</key>
    <string>00000000-0000-1000-8000-010203040506</string>
    <key>BoardManufacturer</key>
    <string>Apple Inc.</string>
    <key>BoardSerialNumber</key>
    <string>C02032101R5DC771H</string>
    <key>Board-ID</key>
    <string>Mac-F4208CC8</string>
    <key>BoardVersion</key>
    <string>Proto1</string>
    <key>Mobile</key>
    <string>Yes</string>
    <key>LocationInChassis</key>
    <string>Part Component</string>
    <key>ChassisManufacturer</key>
    <string>Apple Inc.</string>
    <key>ChassisAssetTag</key>
    <string>LatitudeD420</string>
    <key>FirmwareFeatures</key>
    <string>0xC0001403</string>

Sections

ACPI

DsdtName=
DropOemSSDT=
DropAPIC=
DropMCFG=
DropHPET=
DropECDT=
GenerateCStates=
GeneratePStates=
PLimitDict=
UnderVoltStep=
EnableC6=
EnableC4=
EnableC2=
EnableISS=
C3Latency=
ResetAddress=
ResetValue=
smartUPS=
PatchAPIC=
FixDsdtMask=

PCI

StringInjector=
DeviceProperties=
PCIRootUID=
HDAInjection=
USBInjection=
LpcTune=

CPU

Turbo=
ProcessorType=
CpuFrequencyMHz=
BusSpeedkHz=
QPI=

Pointer

Speed=<number>
Cursor speed
DoubleClickTime=<number>

Volumes

HideAllOSX=
HideAllOSXInstall=
HideAllRecovery=
HideAllWindowsEFI=
HideAllGrub=
HideAllGentoo=
HideAllRedHat=
HideAllUbuntu=
HideAllSuSe=
HideAllUEFI=
HideAllLegacy=
HideVolumes=

SystemParameters

iCloudFix=Yes | No
boot-args=[-v | arch=i386 ...]
prev-lang:kbd=<lang>:0
DefaultBootVolume=<name>
CustomUUID=<UUID>
InjectSystemID=Yes | No
LegacyBoot=PBR
BacklightLevel=0x<hex>

KernelAndKextPatches

Debug=Yes | No
KernelCpu=Yes | No
ATIConnectorsController=4000 | 5000 | 6000
ATIConnectorsData=<hex>
ATIConnectorsPatch=<hex>
AsusAICPUPM=Yes | No
AppleRTC=Yes | No
KextsToPatch=<dict>
Name=<string>, Find=, Replace=<data> </dl>

SMBIOS

BiosVendor=
BiosVersion=
BiosReleaseDate=
Manufacturer=
ProductName=
Version=
Family=
SerialNumber=
SmUUID=
BoardManufacturer=
BoardSerialNumber=
Board-ID=
BoardVersion=
BoardType=
Mobile=
LocationInChassis=
ChassisManufacturer=
ChassisAssetTag=
FirmwareFeatures=

Graphics

GraphicsInjector=
InjectEDID=
CustomEDID=
VRAM=
LoadVBios=
PatchVBios=
VideoPorts=
FBName=
NVCAP=
display-cfg=