# 03 - Configuración EFI Detallada

## 📋 Archivos de Configuración EFI

### Estructura Completa EFI/OC/

```
EFI/
├── BOOT/
│   └── BOOTx64.efi
└── OC/
    ├── ACPI/
    │   ├── SSDT-EC.aml           (Fake EC)
    │   ├── SSDT-PLUG.aml         (Power Management)
    │   ├── SSDT-AWAC.aml         (Clock fix B760)
    │   └── SSDT-PMC.aml          (Opcional)
    ├── Kexts/
    │   ├── Lilu.kext
    │   ├── VirtualSMC.kext
    │   ├── WhateverGreen.kext
    │   ├── AppleALC.kext
    │   ├── AppleIGC.kext
    │   ├── AirportItlwm.kext
    │   ├── IntelBluetoothFirmware.kext
    │   ├── IntelBTPatcher.kext
    │   ├── FeatureUnlock.kext
    │   ├── VoodooPS2Controller.kext
    │   ├── SMCProcessor.kext
    │   ├── SMCSuperIO.kext
    │   └── NVMeFix.kext
    ├── Drivers/
    │   ├── OpenRuntime.efi
    │   └── OpenCanopy.efi
    ├── Tools/
    │   └── Haciend.efi            (opcional)
    ├── config.plist
    └── .
```

---

## 📝 Configuración config.plist Completa

### ACPI Section

```xml
<key>ACPI</key>
<dict>
    <key>Add</key>
    <array>
        <dict>
            <key>Comment</key>
            <string>Fake EC</string>
            <key>Enabled</key>
            <true/>
            <key>Path</key>
            <string>SSDT-EC.aml</string>
        </dict>
        <dict>
            <key>Comment</key>
            <string>PluginType</string>
            <key>Enabled</key>
            <true/>
            <key>Path</key>
            <string>SSDT-PLUG.aml</string>
        </dict>
        <dict>
            <key>Comment</key>
            <string>AWAC Fix</string>
            <key>Enabled</key>
            <true/>
            <key>Path</key>
            <string>SSDT-AWAC.aml</string>
        </dict>
    </array>
    <key>Delete</key>
    <array/>
    <key>Patch</key>
    <array/>
    <key>Quirks</key>
    <dict>
        <key>FadtEnableReset</key>
        <false/>
        <key>NormalizeHeaders</key>
        <false/>
        <key>RebaseRegions</key>
        <false/>
        <key>ResetHwSig</key>
        <false/>
        <key>ResetLogoStatus</key>
        <false/>
    </dict>
</dict>
```

---

### Booter Section

```xml
<key>Booter</key>
<dict>
    <key>MmapWhitelist</key>
    <array/>
    <key>Patch</key>
    <array/>
    <key>Quirks</key>
    <dict>
        <key>AvoidRuntimeDefrag</key>
        <true/>
        <key>DevirtualiseMmio</key>
        <false/>
        <key>DisableSingleUser</key>
        <false/>
        <key>DisableVariableWrite</key>
        <false/>
        <key>DiscardHibernateMap</key>
        <false/>
        <key>EnableSafeModeSlide</key>
        <false/>
        <key>EnableWriteUnprotector</key>
        <true/>
        <key>ForceBooterSignature</key>
        <false/>
        <key>ForceExitBootServices</key>
        <false/>
        <key>ProtectMemoryRegions</key>
        <false/>
        <key>ProtectSecureBoot</key>
        <false/>
        <key>ProtectUefiServices</key>
        <false/>
        <key>ProvideCustomSlide</key>
        <true/>
        <key>ProvideMaxSlide</key>
        <integer>0</integer>
        <key>ResizeAppleGpuBars</key>
        <integer>-1</integer>
        <key>RevirtualiseMmio</key>
        <false/>
        <key>SetupVirtualMap</key>
        <true/>
        <key>SignalAppleOS</key>
        <false/>
        <key>SyncRuntimePermissions</key>
        <true/>
    </dict>
</dict>
```

---

### DeviceProperties Section

```xml
<key>DeviceProperties</key>
<dict>
    <key>Add</key>
    <dict>
        <key>PciRoot(0x0)/Pci(0x1B,0x0)</key>  <!-- Audio Realtek -->
        <dict>
            <key>layout-id</key>
            <data>BwAAAA==</data>  <!-- Layout ID 7 -->
        </dict>
        <key>PciRoot(0x0)/Pci(0x2,0x0)</key>   <!-- GPU AMD -->
        <dict>
            <key>enable-backlight-registers-fix</key>
            <data>AQAAAA==</data>
            <key>enable-backlight-smoother</key>
            <data>AQAAAA==</data>
            <key>framebuffer-patch-enable</key>
            <data>AQAAAA==</data>
            <key>framebuffer-cursormem</key>
            <data>AACQAA==</data>
            <key>radpng</key>
            <data>AQAAAA==</data>
        </dict>
    </dict>
    <key>Delete</key>
    <dict/>
</dict>
```

**Layout IDs Comunes para Audio Realtek**:
| Layout ID | Uso |
|-----------|-----|
| 1 | Stereo Output |
| 3 | Speaker + Line Out |
| 5 | Common for desktop |
| 7 | Common for Realtek |
| 11 | Realtek ALC897 |
| 13 | Realtek ALC1220 |
| 28 | Common alternative |
| 99 | Built-in Speaker + Headphone |

---

### Kernel Section

```xml
<key>Kernel</key>
<dict>
    <key>Emulate</key>
    <dict>
        <key>Cpuid1Data</key>
        <data>NxcB/V/QwMA=</data>  <!-- CPUID Data para Raptor Lake -->
        <key>Cpuid1Mask</key>
        <data>////</data>
        <key>DummyPowerManagement</key>
        <false/>
    </dict>
    <key>Force</key>
    <array/>
    <key>Kexts</key>
    <array>
        <!-- Lilu - BASE -->
        <dict>
            <key>BundlePath</key>
            <string>Lilu.kext</string>
            <key>Comment</key>
            <string>Patch engine</string>
            <key>Enabled</key>
            <true/>
            <key>ExecutablePath</key>
            <string>Contents/MacOS/Lilu</string>
            <key>MaxKernel</key>
            <string></string>
            <key>MinKernel</key>
            <string></string>
            <key>PlistPath</key>
            <string>Contents/Info.plist</string>
        </dict>

        <!-- VirtualSMC -->
        <dict>
            <key>BundlePath</key>
            <string>VirtualSMC.kext</string>
            <key>Comment</key>
            <string>SMC emulator</string>
            <key>Enabled</key>
            <true/>
            <key>ExecutablePath</key>
            <string>Contents/MacOS/VirtualSMC</string>
            <key>MaxKernel</key>
            <string></string>
            <key>MinKernel</key>
            <string></string>
            <key>PlistPath</key>
            <string>Contents/Info.plist</string>
        </dict>

        <!-- WhateverGreen - GPU AMD -->
        <dict>
            <key>BundlePath</key>
            <string>WhateverGreen.kext</string>
            <key>Comment</key>
            <string>AMD GPU patches</string>
            <key>Enabled</key>
            <true/>
            <key>ExecutablePath</key>
            <string>Contents/MacOS/WhateverGreen</string>
            <key>MaxKernel</key>
            <string></string>
            <key>MinKernel</key>
            <string></string>
            <key>PlistPath</key>
            <string>Contents/Info.plist</string>
        </dict>

        <!-- AppleALC - Audio -->
        <dict>
            <key>BundlePath</key>
            <string>AppleALC.kext</string>
            <key>Comment</key>
            <string>Realtek Audio</string>
            <key>Enabled</key>
            <true/>
            <key>ExecutablePath</key>
            <string>Contents/MacOS/AppleALC</string>
            <key>MaxKernel</key>
            <string></string>
            <key>MinKernel</key>
            <string></string>
            <key>PlistPath</key>
            <string>Contents/Info.plist</string>
        </dict>

        <!-- AppleIGC - Ethernet I226-V -->
        <dict>
            <key>BundlePath</key>
            <string>AppleIGC.kext</string>
            <key>Comment</key>
            <string>Intel 2.5GbE</string>
            <key>Enabled</key>
            <true/>
            <key>ExecutablePath</key>
            <string>Contents/MacOS/AppleIGC</string>
            <key>MaxKernel</key>
            <string></string>
            <key>MinKernel</key>
            <string>19.0.0</string>
            <key>PlistPath</key>
            <string>Contents/Info.plist</string>
        </dict>

        <!-- AirportItlwm - Wi-Fi Intel -->
        <dict>
            <key>BundlePath</key>
            <string>AirportItlwm.kext</string>
            <key>Comment</key>
            <string>Intel Wi-Fi</string>
            <key>Enabled</key>
            <true/>
            <key>ExecutablePath</key>
            <string>Contents/MacOS/AirportItlwm</string>
            <key>MaxKernel</key>
            <string>23.9.9</string>
            <key>MinKernel</key>
            <string>19.0.0</string>
            <key>PlistPath</key>
            <string>Contents/Info.plist</string>
        </dict>

        <!-- IntelBluetoothFirmware -->
        <dict>
            <key>BundlePath</key>
            <string>IntelBluetoothFirmware.kext</string>
            <key>Comment</key>
            <string>Intel Bluetooth</string>
            <key>Enabled</key>
            <true/>
            <key>ExecutablePath</key>
            <string>Contents/MacOS/IntelBluetoothFirmware</string>
            <key>MaxKernel</key>
            <string></string>
            <key>MinKernel</key>
            <string>19.0.0</string>
            <key>PlistPath</key>
            <string>Contents/Info.plist</string>
        </dict>

        <!-- IntelBTPatcher -->
        <dict>
            <key>BundlePath</key>
            <string>IntelBTPatcher.kext</string>
            <key>Comment</key>
            <string>Intel Bluetooth Patcher</string>
            <key>Enabled</key>
            <true/>
            <key>ExecutablePath</key>
            <string>Contents/MacOS/IntelBTPatcher</string>
            <key>MaxKernel</key>
            <string></string>
            <key>MinKernel</key>
            <string>19.0.0</string>
            <key>PlistPath</key>
            <string>Contents/Info.plist</string>
        </dict>

        <!-- FeatureUnlock -->
        <dict>
            <key>BundlePath</key>
            <string>FeatureUnlock.kext</string>
            <key>Comment</key>
            <string>Unlock macOS features</string>
            <key>Enabled</key>
            <true/>
            <key>ExecutablePath</key>
            <string>Contents/MacOS/FeatureUnlock</string>
            <key>MaxKernel</key>
            <string></string>
            <key>MinKernel</key>
            <string></string>
            <key>PlistPath</key>
            <string>Contents/Info.plist</string>
        </dict>

        <!-- VoodooPS2Controller -->
        <dict>
            <key>BundlePath</key>
            <string>VoodooPS2Controller.kext</string>
            <key>Comment</key>
            <string>PS2 Keyboard/Mouse</string>
            <key>Enabled</key>
            <true/>
            <key>ExecutablePath</key>
            <string>Contents/MacOS/VoodooPS2Controller</string>
            <key>MaxKernel</key>
            <string></string>
            <key>MinKernel</key>
            <string></string>
            <key>PlistPath</key>
            <string>Contents/Info.plist</string>
        </dict>

        <!-- SMCProcessor -->
        <dict>
            <key>BundlePath</key>
            <string>SMCProcessor.kext</string>
            <key>Comment</key>
            <string>VirtualSMC Plugin</string>
            <key>Enabled</key>
            <true/>
            <key>ExecutablePath</key>
            <string>Contents/MacOS/SMCProcessor</string>
            <key>MaxKernel</key>
            <string></string>
            <key>MinKernel</key>
            <string></string>
            <key>PlistPath</key>
            <string>Contents/Info.plist</string>
        </dict>

        <!-- SMCSuperIO -->
        <dict>
            <key>BundlePath</key>
            <string>SMCSuperIO.kext</string>
            <key>Comment</key>
            <string>VirtualSMC Plugin</string>
            <key>Enabled</key>
            <true/>
            <key>ExecutablePath</key>
            <string>Contents/MacOS/SMCSuperIO</string>
            <key>MaxKernel</key>
            <string></string>
            <key>MinKernel</key>
            <string></string>
            <key>PlistPath</key>
            <string>Contents/Info.plist</string>
        </dict>
    </array>
    <key>Patch</key>
    <array/>
    <key>Quirks</key>
    <dict>
        <key>AppleCpuPmCfgLock</key>
        <false/>
        <key>AppleXcpmCfgLock</key>
        <false/>
        <key>AppleXcpmExtraMsrs</key>
        <false/>
        <key>AppleXcpmForceBoost</key>
        <false/>
        <key>CustomSMBIOSGuid</key>
        <false/>
        <key>DisableIoMapper</key>
        <true/>
        <key>DisableLinkeditJettison</key>
        <true/>
        <key>DisableRtcChecksum</key>
        <false/>
        <key>ExtendBTFeatureFlags</key>
        <false/>
        <key>ExternalDiskIcons</key>
        <false/>
        <key>ForceSecureBootScheme</key>
        <false/>
        <key>IncreasePciBarSize</key>
        <false/>
        <key>LapicKernelPanic</key>
        <false/>
        <key>LegacyCommpage</key>
        <false/>
        <key>PanicNoKextDump</key>
        <true/>
        <key>PowerTimeoutKernelPanic</key>
        <true/>
        <key>ProvideCurrentCpuInfo</key>
        <true/>
        <key>SetApfsTrimTimeout</key>
        <integer>-1</integer>
        <key>ThirdPartyDrives</key>
        <false/>
        <key>XhciPortLimit</key>
        <false/>
    </dict>
    <key>Scheme</key>
    <dict>
        <key>FuzzyMatch</key>
        <true/>
        <key>KernelArch</key>
        <string>x86_64</string>
        <key>KernelCache</key>
        <string>Auto</string>
    </dict>
</dict>
```

---

### Misc Section

```xml
<key>Misc</key>
<dict>
    <key>BlessOverride</key>
    <array/>
    <key>Boot</key>
    <dict>
        <key>ConsoleAttributes</key>
        <integer>0</integer>
        <key>HibernateMode</key>
        <string>None</string>
        <key>HibernateSkipsPicker</key>
        <false/>
        <key>HideAuxiliary</key>
        <false/>
        <key>LauncherOption</key>
        <string>Full</string>
        <key>LauncherPath</key>
        <string>Default</string>
        <key>PickerAttributes</key>
        <integer>0</integer>
        <key>PickerAudioAssist</key>
        <false/>
        <key>PickerMode</key>
        <string>Builtin</string>
        <key>PickerVariant</key>
        <string>Default</string>
        <key>PollAppleHotKeys</key>
        <false/>
        <key>ShowPicker</key>
        <true/>
        <key>TakeoffDelay</key>
        <integer>0</integer>
        <key>Timeout</key>
        <integer>5</integer>
    </dict>
    <key>Debug</key>
    <dict>
        <key>AppleDebug</key>
        <false/>
        <key>ApplePanic</key>
        <false/>
        <key>DisableWatchDog</key>
        <false/>
        <key>DisplayDelay</key>
        <integer>0</integer>
        <key>DisplayLevel</key>
        <integer>2147483650</integer>
        <key>LogModules</key>
        <string>*</string>
        <key>SerialInit</key>
        <false/>
        <key>SysReport</key>
        <false/>
        <key>Target</key>
        <integer>3</integer>
    </dict>
    <key>Entries</key>
    <array/>
    <key>Security</key>
    <dict>
        <keyAllowNvramReset</key>
        <true/>
        <key>AllowSetDefault</key>
        <true/>
        <key>ApECID</key>
        <integer>0</integer>
        <key>AuthRestart</key>
        <false/>
        <key>BlacklistAppleUpdate</key>
        <true/>
        <key>DmgLoading</key>
        <string>Signed</string>
        <key>EnablePassword</key>
        <false/>
        <key>ExposeSensitiveData</key>
        <integer>6</integer>
        <key>HaltLevel</key>
        <integer>2147483648</integer>
        <key>PasswordHash</key>
        <data></data>
        <key>PasswordSalt</key>
        <data></data>
        <key>ScanPolicy</key>
        <integer>0</integer>
        <key>SecureBootModel</key>
        <string>Disabled</string>
        <key>Vault</key>
        <string>Optional</string>
    </dict>
    <key>Serial</key>
    <dict>
        <key>Init</key>
        <false/>
        <key>Override</key>
        <false/>
        <key>Swap</key>
        <false/>
    </dict>
    <key>Tools</key>
    <array/>
</dict>
```

---

### PlatformInfo (SMBIOS)

```xml
<key>PlatformInfo</key>
<dict>
    <key>Automatic</key>
    <true/>
    <key>CustomMemory</key>
    <false/>
    <key>Generic</key>
    <dict>
        <key>AdviseFeatures</key>
        <false/>
        <key>MaxBIOSVersion</key>
        <false/>
        <key>ProcessorType</key>
        <integer>0</integer>
        <key>SpoofVendor</key>
        <true/>
        <key>SystemMemoryStatus</key>
        <string>Auto</string>
        <key>SystemProductName</key>
        <string>iMacPro1,1</string>
        <key>SystemSerialNumber</key>
        <string>GENERATED_WITH_GENSMBIOS</string>
        <key>SystemUUID</key>
        <string>GENERATED_WITH_GENSMBIOS</string>
        <key>MLB</key>
        <string>GENERATED_WITH_GENSMBIOS</string>
        <key>ROM</key>
        <data>GENERATED_WITH_GENSMBIOS</data>
    </dict>
    <key>UpdateDataHub</key>
    <true/>
    <key>UpdateNVRAM</key>
    <true/>
    <key>UpdateSMBIOS</key>
    <true/>
    <key>UpdateSMBIOSMode</key>
    <string>Create</string>
</dict>
```

**Generar SMBIOS válido**:
```bash
# Usar GenSMBIOS
python3 gensmbios.py

# O usar
./gensmbios
```

---

### UEFI Section

```xml
<key>UEFI</key>
<dict>
    <key>APFS</key>
    <dict>
        <key>EnableJumpstart</key>
        <true/>
        <key>GlobalConnect</key>
        <false/>
        <key>HideVerbose</key>
        <true/>
        <key>JumpstartHotPlug</key>
        <false/>
        <key>MinDate</key>
        <integer>0</integer>
        <key>MinVersion</key>
        <integer>0</integer>
    </dict>
    <key>Audio</key>
    <dict>
        <key>AudioCodec</key>
        <integer>0</integer>
        <key>AudioDevice</key>
        <string>PciRoot(0x0)/Pci(0x1F,0x3)</string>
        <key>AudioOut</key>
        <integer>0</integer>
        <key>AudioSupport</key>
        <false/>
        <key>MinimumVolume</key>
        <integer>20</integer>
        <key>PlayChime</key>
        <string>Auto</string>
        <key>ResetTrafficClass</key>
        <false/>
        <key>SetupDelay</key>
        <integer>0</integer>
        <key>VolumeAmplifier</key>
        <integer>0</integer>
    </dict>
    <key>ConnectDrivers</key>
    <true/>
    <key>Drivers</key>
    <array>
        <dict>
            <key>Arguments</key>
            <string>agdpmod=pikera</string>
            <key>Comment</key>
            <string></string>
            <key>Enabled</key>
            <true/>
            <key>LoadEarly</key>
            <false/>
            <key>Path</key>
            <string>OpenRuntime.efi</string>
        </dict>
    </array>
    <key>Input</key>
    <dict>
        <key>KeyFiltering</key>
        <false/>
        <key>KeyForgetThreshold</key>
        <integer>5</integer>
        <key>KeyMergeThreshold</key>
        <integer>2</integer>
        <key>KeySupport</key>
        <true/>
        <key>KeySupportMode</key>
        <string>Auto</string>
        <key>KeySwap</key>
        <false/>
        <key>PointerSupport</key>
        <false/>
        <key>PointerSupportMode</key>
        <string></string>
        <key>TimerResolution</key>
        <integer>50000</integer>
    </dict>
    <key>Output</key>
    <dict>
        <key>ClearScreenOnModeSwitch</key>
        <false/>
        <key>ConsoleMode</key>
        <string></string>
        <key>DirectGopRendering</key>
        <false/>
        <key>ForceResolution</key>
        <false/>
        <key>GopBurstMode</key>
        <false/>
        <key>GopPassThrough</key>
        <string>Disabled</string>
        <key>IgnoreTextInGraphics</key>
        <false/>
        <key>InitialMode</key>
        <integer>3</integer>
        <key>ReconnectGraphicsOnResChange</key>
        <false/>
        <key>ReplaceTabWithSpace</key>
        <false/>
        <key>Resolution</key>
        <string>Max</string>
        <key>SanitiseClearScreen</key>
        <false/>
        <key>TextRenderer</key>
        <string>BuiltinGraphics</string>
        <key>UgaPassThrough</key>
        <false/>
    </dict>
    <key>ProtocolOverrides</key>
    <dict>
        <key>AppleAudio</key>
        <false/>
        <key>AppleBootPolicy</key>
        <false/>
        <key>AppleDebugLog</key>
        <false/>
        <key>AppleEg2Info</key>
        <false/>
        <key>AppleFramebufferInfo</key>
        <false/>
        <key>AppleImg4Verification</key>
        <false/>
        <key>AppleKeyMap</key>
        <false/>
        <key>AppleRtcRam</key>
        <false/>
        <key>AppleSecureBoot</key>
        <false/>
        <key>AppleSmcIo</key>
        <false/>
        <key>AppleUserInterfaceTheme</key>
        <false/>
        <key>DataHub</key>
        <false/>
        <key>DeviceProperties</key>
        <false/>
        <key>FirmwareVolume</key>
        <false/>
        <key>HashServices</key>
        <false/>
        <key>OSInfo</key>
        <false/>
        <key>PciIo</key>
        <false/>
        <key>UnicodeCollation</key>
        <false/>
    </dict>
    <key>Quirks</key>
    <dict>
        <key>ActivateHpetSupport</key>
        <false/>
        <key>DisableSecurityPolicy</key>
        <false/>
        <key>EnableVectorAcceleration</key>
        <false/>
        <key>ExitBootServicesDelay</key>
        <integer>0</integer>
        <key>ForceOcWriteFlash</key>
        <false/>
        <key>ForgeUefiSupport</key>
        <false/>
        <key>IgnoreInvalidFlexRatio</key>
        <false/>
        <key>ReleaseUsbOwnership</key>
        <false/>
        <key>ReloadOptionRoms</key>
        <false/>
        <key>RequestBootVarRouting</key>
        <true/>
        <key>ResizeGpuBars</key>
        <integer>-1</integer>
        <key>TscSyncTimeout</key>
        <integer>0</integer>
        <key>UnblockFsConnect</key>
        <false/>
    </dict>
    <key>ReservedMemory</key>
    <array/>
</dict>
```

---

## 🔍 Verificar config.plist

### Usar ProperTree u OCAuxiliaryTools

```bash
# Validar config.plist
plutil -lint config.plist
```

**Salida esperada**:
```
config.plist: OK
```

---

## 📝 Archivos SSDT Necesarios

### SSDT-EC.aml (Fake EC)

Necesario porque macOS espera un Embedded Controller.

### SSDT-PLUG.aml (Plugin Type)

Necesario para power management correcto del CPU.

### SSDT-AWAC.aml (RTC Fix)

**CRÍTICO PARA B760**: Corrige el reloj del sistema. Sin esto, macOS no arrancará.

### Generar SSDTs

```bash
# Usar SSDTTime
./SSDTTime.sh

# O usar GenPMC
./gen-pmc.sh
```

---

## 📋 Checklist EFI Completo

- [ ] EFI/BOOT/BOOTx64.efi presente
- [ ] EFI/OC/OpenCore.efi presente
- [ ] EFI/OC/Drivers/OpenRuntime.efi presente
- [ ] EFI/OC/Kexts/ tiene todos los kexts (incluyendo NVMeFix)
- [ ] EFI/OC/ACPI/ tiene SSDT-EC.aml, SSDT-PLUG.aml y SSDT-AWAC.aml
- [ ] config.plist validado con plutil
- [ ] SMBIOS generado con GenSMBIOS
- [ ] Cpuid1Data configurado para Raptor Lake

---

**Siguiente paso: [04 - Instalación](04-installation.md)**
