# thenickdude/kvm-opencore architecture

> Architecture diagram of the GitHub repository thenickdude/kvm-opencore, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/thenickdude/kvm-opencore
- Repository: https://github.com/thenickdude/kvm-opencore

## Overview

##### Main Components
- Build System & Automation: Represented by the Makefile which coordinates building modules from source.
- Source Modules: Found in the “src” directory with subdirectories including AppleALC, BrcmPatchRAM, CryptexFixup, Lilu, MacKernelSDK, OcBinaryData, OpenCorePkg, VirtualSMC, and WhateverGreen. These are the building blocks of the bootloader, drivers, and other essential modules.
- EFI Boot Environment: The EFI directory under which “OC” contains subfolders like ACPI (with SSDT files), Kexts (with various device drivers), and the “config.plist”. These components form the final bootable EFI image.
- Virtualization Configuration: Indicated by the libvirt.xml file, which defines how the disk image is integrated with QEMU/KVM (and by extension with Proxmox).
- External Dependencies & Integration: Although not explicitly shown as additional folders, the README points to external guides (e.g., Proxmox Hackintosh) and upstream changes in OpenCore, meaning there is an integration with external sources and environments.

##### Relationships & Data Flow
- The Build Process: Use the Makefile to orchestrate the compilation of source modules (from the “src” folder). Each module (e.g., OpenCorePkg, VirtualSMC, etc.) produces artifacts that are compiled/assembled.
- Configuration Management: The config.plist under EFI/OC serves as a central configuration point for booting via OpenCore.
- Virtualization Integration: The final disk image (packaged as a raw image despite the .iso extension) is deployed according to the settings in libvirt.xml. This image is then used by QEMU/KVM (or Proxmox) to boot the macOS environment.

##### Architectural Patterns & Design Principles
- Modular Architecture: The system is clearly divided into source modules, each responsible for a specific function (e.g., kernel extensions, patches, bootloader components). This separation ensures maintainability and scalability.
- Automated Build & Integration: The build system (via the Makefile) automates the process of pulling in updates and building the EFI image using modules sourced from the “src” directory.
- Virtualization-Centric: With libvirt.xml and a focus on QEMU/KVM, the project is tailored to virtualized environments, ensuring clean abstraction layers between bootloader functionality and the hypervisor.

## Diagram (Mermaid)

```mermaid
graph TD
  %% Source Modules Layer
  subgraph "Source Modules"
    AppleALC["AppleALC"]:::module
    BrcmPatchRAM["BrcmPatchRAM"]:::module
    CryptexFixup["CryptexFixup"]:::module
    Lilu["Lilu"]:::module
    MacKernelSDK["MacKernelSDK"]:::module
    OcBinaryData["OcBinaryData"]:::module
    OpenCorePkg["OpenCorePkg"]:::module
    VirtualSMC["VirtualSMC"]:::module
    WhateverGreen["WhateverGreen"]:::module
  end

  %% Build and Compilation Layer
  subgraph "Build & Compilation Layer"
    Makefile["Makefile"]:::build
  end

  %% EFI Boot Environment Layer
  subgraph "EFI Boot Environment"
    subgraph "OC Structure"
      ACPI["ACPI Components"]:::efi
      Kexts["Kexts"]:::efi
      Config["Configuration (config.plist)"]:::efi
    end
  end

  %% Virtualized Deployment Layer
  subgraph "Virtualized Deployment"
    VirtualConfig["libvirt.xml/QEMU-KVM"]:::virtual
  end

  %% Data Flow
  AppleALC --> Makefile
  BrcmPatchRAM --> Makefile
  CryptexFixup --> Makefile
  Lilu --> Makefile
  MacKernelSDK --> Makefile
  OcBinaryData --> Makefile
  OpenCorePkg --> Makefile
  VirtualSMC --> Makefile
  WhateverGreen --> Makefile

  Makefile --> ACPI
  Makefile --> Kexts
  Makefile --> Config

  ACPI --> VirtualConfig
  Kexts --> VirtualConfig
  Config --> VirtualConfig

  %% Click Events
  click Makefile "https://github.com/thenickdude/kvm-opencore/tree/master/Makefile"
  click AppleALC "https://github.com/thenickdude/kvm-opencore/tree/master/src/AppleALC"
  click BrcmPatchRAM "https://github.com/thenickdude/kvm-opencore/tree/master/src/BrcmPatchRAM"
  click CryptexFixup "https://github.com/thenickdude/kvm-opencore/tree/master/src/CryptexFixup"
  click Lilu "https://github.com/thenickdude/kvm-opencore/tree/master/src/Lilu"
  click MacKernelSDK "https://github.com/thenickdude/kvm-opencore/tree/master/src/MacKernelSDK"
  click OcBinaryData "https://github.com/thenickdude/kvm-opencore/tree/master/src/OcBinaryData"
  click OpenCorePkg "https://github.com/thenickdude/kvm-opencore/tree/master/src/OpenCorePkg"
  click VirtualSMC "https://github.com/thenickdude/kvm-opencore/tree/master/src/VirtualSMC"
  click WhateverGreen "https://github.com/thenickdude/kvm-opencore/tree/master/src/WhateverGreen"
  click ACPI "https://github.com/thenickdude/kvm-opencore/tree/master/EFI/OC/ACPI"
  click Kexts "https://github.com/thenickdude/kvm-opencore/tree/master/EFI/OC/Kexts"
  click Config "https://github.com/thenickdude/kvm-opencore/blob/master/EFI/OC/config.plist"
  click VirtualConfig "https://github.com/thenickdude/kvm-opencore/blob/master/libvirt.xml"

  %% Styles
  classDef module fill:#cce5ff,stroke:#003366,stroke-width:2px;
  classDef build fill:#d4edda,stroke:#155724,stroke-width:2px;
  classDef efi fill:#fff3cd,stroke:#856404,stroke-width:2px;
  classDef virtual fill:#f8d7da,stroke:#721c24,stroke-width:2px;
```
