How OCLP-Mod Manages Patch Priorities for Multiple Hardware Variants

OCLP-Mod resolves conflicting patches through a deterministic three-tier priority system where SMBIOS spoofing levels cascade from Minimal to Advanced, hardware-variant arrays process from generic to specific, and the EFI builder sequences operations so that later writes automatically override earlier configurations.

When modernizing legacy Macs with the OpenCore Legacy Patcher Mod (OCLP-Mod), systems often present multiple hardware variants—such as mixed GPU families, dual board IDs, or combinations of legacy and modern components—that require conflicting patches. The laobamac/oclp-mod repository implements a strict, deterministic priority scheme to ensure the most specific and aggressive patches take precedence. This article examines the exact mechanisms governing OCLP-Mod patch priorities, referencing the actual source implementation.

The Three-Tier Priority Mechanism in OCLP-Mod

OCLP-Mod implements patch prioritization through three interconnected mechanisms that all follow the same fundamental principle: last-write-wins within a deterministic processing order.

SMBIOS Spoofing Levels: Minimal, Moderate, and Advanced

The first layer of priority control resides in oclp_mod/efi_builder/smbios.py. The BuildSMBIOS class implements three distinct handlers: _handle_minimal(), _handle_moderate(), and _handle_advanced(). These methods are invoked sequentially based on the self.constants.serial_settings value, with each level overwriting the same configuration keys in the self.config["PlatformInfo"] dictionary.

Because each handler explicitly sets identical keys—such as SystemProductName, BoardProduct, and UpdateSMBIOS—the Advanced level automatically supersedes Moderate, which in turn supersedes Minimal. This cascading overwrite ensures that when users select higher spoofing levels, the corresponding patches take absolute priority.

Hardware-Variant Arrays and Dataset Ordering

The second priority mechanism operates through ordered arrays in oclp_mod/datasets/model_array.py. This file defines SupportedSMBIOS and related hardware-variant lists as sequential Python arrays. The entries are deliberately ordered from generic to specific—for example, MacPro3,1 appears before MacPro6,1, which precedes MacBookPro8,2.

When the patcher iterates through these arrays, it processes matches from top to bottom. Later entries in the array—representing more specific hardware variants—overwrite earlier, more generic configurations in the same configuration dictionary. This top-to-bottom processing order guarantees that highly specific patches always take precedence over generic fallback patches when a system matches multiple hardware profiles.

Patch-Application Order in the EFI Builder

The final tier of priority control occurs in oclp_mod/efi_builder/build.py. The main build orchestrator instantiates multiple builder classes—including BuildSMBIOS and graphics/audio builders from oclp_mod/efi_builder/graphics_audio.py—and calls their configuration methods in a specific sequence.

Critically, BuildSMBIOS executes after other builders have populated the configuration. The set_smbios() method is invoked late in the build process (around lines 81-163 in build.py), ensuring that SMBIOS patches represent the final write to shared configuration keys. Because every builder writes to the same OpenCore configuration dictionary—targeting keys like PlatformInfo → SMBIOS and DeviceProperties—the last write wins principle applies deterministically.

Step-by-Step Patch Resolution Flow

Understanding how these mechanisms interact requires examining the exact execution flow:

  1. Hardware Detection: The system identifies real hardware via oclp_mod/support/utilities.py, gathering the actual model identifier (self.constants.computer.real_model) and board IDs through sysctl calls.

  2. SMBIOS Level Selection: Command-line arguments (--minimal_smbios, --moderate_smbios, --advanced_smbios) set self.constants.serial_settings. If unspecified, the default "Minimal" level applies.

  3. Sequential Handler Execution: In BuildSMBIOS.set_smbios() (lines 121-127 in smbios.py), conditional blocks select the appropriate handler. Each handler updates identical configuration keys, causing progressive overwrites:


# Lines 121-127 in oclp_mod/efi_builder/smbios.py

if self.constants.serial_settings == "Minimal":
    self._handle_minimal()
elif self.constants.serial_settings == "Moderate":
    self._handle_moderate()      # overwrites Minimal values

elif self.constants.serial_settings == "Advanced":
    self._handle_advanced()      # overwrites both previous levels

Each handler method (lines 148-300) sets identical keys:


# From _handle_advanced() - overwrites previous levels

self.config["PlatformInfo"]["UpdateSMBIOS"] = True
self.config["PlatformInfo"]["SystemProductName"] = "MacBookPro14,3"
self.config["PlatformInfo"]["BoardProduct"] = "Mac-551B86E5744E2388"
  1. Variant Array Processing: The patcher iterates through SupportedSMBIOS in model_array.py, applying matches in array order. Specific variants appearing later in the list overwrite generic entries processed earlier:

# oclp_mod/datasets/model_array.py

SupportedSMBIOS = [
    "MacPro3,1",        # Generic Nehalem-era workstation

    "MacPro6,1",        # More specific trash can model

    "MacBookPro8,2",    # Highly specific Sandy Bridge laptop

    # Later entries overwrite earlier ones when matched

]
  1. Final Configuration Assembly: In build.py, the BuildSMBIOS instance executes after graphics and audio builders, ensuring SMBIOS patches constitute the final write to the OpenCore configuration before output to OpenCore/config.plist.

Why Specific Patches Win Over Generic Ones

The priority system relies on deterministic overwriting rather than conditional logic or merge algorithms. When multiple hardware variants match a single system, OCLP-Mod does not attempt to combine patches or select the "best" match through complex heuristics. Instead, it processes entries in a fixed order and allows subsequent writes to identical dictionary keys to replace previous values.

This architecture provides three critical advantages:

  • Predictability: Behavior is identical across every build because the processing order is hardcoded in the source files.
  • Auditability: Developers can trace exactly which patch will apply by examining the array order in model_array.py and the handler sequence in smbios.py.
  • Specificity Guarantee: Because specific variants are listed after generic ones in the datasets, they always receive the final write, ensuring tailored patches override broad compatibility fixes.

Practical Implementation Examples

The following code excerpts demonstrate the actual priority logic implemented in OCLP-Mod:

SMBIOS Level Hierarchy:


# oclp_mod/efi_builder/smbios.py (lines 121-127)

if self.constants.serial_settings == "Minimal":
    self._handle_minimal()
elif self.constants.serial_settings == "Moderate":
    self._handle_moderate()      # Overwrites Minimal values

elif self.constants.serial_settings == "Advanced":
    self._handle_advanced()      # Overwrites both previous levels

Configuration Key Overwrites:


# From _handle_advanced() method

self.config["PlatformInfo"]["UpdateSMBIOS"] = True
self.config["PlatformInfo"]["SystemProductName"] = "MacBookPro14,3"
self.config["PlatformInfo"]["BoardProduct"] = "Mac-551B86E5744E2388"

Build Orchestration Sequence:


# oclp_mod/efi_builder/build.py (lines 81-163)

# Graphics and audio builders execute first

self.build_graphics_audio()
self.build_firmware()

# SMBIOS builder executes last for final priority

smbios_builder = BuildSMBIOS(self.constants)
smbios_builder.set_smbios()

Summary

OCLP-Mod manages patch priorities for multiple hardware variants through a deterministic, three-tiered overwriting system:

  • SMBIOS spoofing levels cascade from Minimal to Advanced, with each higher level overwriting the configuration keys set by previous handlers in smbios.py.
  • Hardware-variant arrays in model_array.py are ordered from generic to specific, ensuring that later, more specific entries overwrite earlier matches during iteration.
  • Build orchestration in build.py sequences the SMBIOS builder to execute after other patch builders, guaranteeing that the final write to shared OpenCore configuration keys determines the active patch set.

This architecture ensures that when a single system presents multiple hardware variants, the most appropriate and specific patches take precedence through deterministic, last-write-wins logic.

Frequently Asked Questions

How does OCLP-Mod handle conflicting patches from different hardware variants?

When conflicting patches exist, OCLP-Mod does not merge them or use selection heuristics. Instead, it processes hardware variants in the order they appear in oclp_mod/datasets/model_array.py, with later entries overwriting earlier ones. Similarly, SMBIOS handlers in smbios.py overwrite previous levels. The last write to any configuration key wins, ensuring deterministic resolution.

Can I force a specific SMBIOS level to override automatic detection?

Yes. OCLP-Mod provides command-line flags that directly control SMBIOS priority. Passing --advanced_smbios forces the _handle_advanced() method to execute, overwriting any values set by Minimal or Moderate handlers. The --moderate_smbios flag similarly supersedes Minimal settings. If no flag is specified, the system defaults to the Minimal level.

Why does the build order in build.py matter for patch priority?

The sequence in oclp_mod/efi_builder/build.py determines which component writes last to the shared OpenCore configuration dictionary. Graphics and audio builders execute before BuildSMBIOS, meaning their patches populate the config first. Because BuildSMBIOS.set_smbios() runs last (around lines 81-163), its writes to keys like PlatformInfo and DeviceProperties override any previous values, establishing final patch priority.

Where are hardware-variant priorities defined in the source code?

Hardware-variant priorities are primarily defined in oclp_mod/datasets/model_array.py through the ordering of the SupportedSMBIOS list. Generic entries like MacPro3,1 appear early in the array, while specific variants like MacBookPro8,2 appear later. Additionally, SMBIOS spoofing priorities are defined in oclp_mod/efi_builder/smbios.py, where the handler methods are structured to overwrite previous configuration levels progressively.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →