mirror of
https://github.com/acidanthera/OpenCorePkg.git
synced 2025-12-08 19:25:01 +00:00
ocvalidate
Utility to validate whether a config.plist matches requirements and conventions imposed by OpenCore.
Usage
- Pass one single path to
config.plistto verify it. - Pass
--versionfor current supported OpenCore version.
Technical background
At a glance
- ocvalidate firstly calls
OcSerializeLibwhich performs fundamental checks in terms of syntax and semantics. After that, the following will be checked. - The error message
<OCS: No schema for xxx>complained byOcSerializeLibindicates unknown keys that can be deprecated in new versions of OpenCore. Such keys should be removed in order to avoid undefined behaviours. - Under active development, newer versions of OpenCore hardly have backward compatibility at this moment. As a result, please first run
ocvalidate --versionto check which version of OpenCore is supported, and thus please only use the specific version.
Global Rules
- All entries must be set once only. Duplication is strictly prohibited.
- All strings (fields with plist
Stringformat) throughout the whole config only accept ASCII printable characters at most. Stricter rules may apply. For instance, some fields only accept specified values, as indicated in Configuration.pdf. - All the paths relative to OpenCore root must be less than or equal to 128 bytes (
OC_STORAGE_SAFE_PATH_MAX) in total including '\0' terminator. - Most binary patches must have
Find,Replace,Mask(if used), andReplaceMask(if used) identical size set. Also,FindrequiresMask(orReplacerequiresReplaceMask) to be active (set to non-zero) for corresponding bits. MinKernelandMaxKernelentries should follow conventions specified in Configuration.pdf. (TODO: Bring decent checks for this)MinKernelcannot be a value that is below macOS 10.4 (Darwin version 8).- Entries taking file system path only accept
0-9, A-Z, a-z, '_', '-', '.', '/', and '\'. - Device Paths (e.g.
PciRoot(0x0)/Pci(0x1b,0x0)) only accept strings in canonic string format. - Paths of UEFI Drivers only accept
0-9, A-Z, a-z, '_', '-', '.', and '/'. - Entries requiring bitwise operations (e.g.
ConsoleAttributes,PickerAttributes, orScanPolicy) only allow known bits stated in Configuration.pdf to be set. - Entries involving GUID (mainly in Section
NVRAM) must have correct format set.
ACPI
Add
- Entry[N]->Path: Only
.amland.binfilename suffix are accepted.
Booter
MmioWhitelist
- Entry[N]->Enabled: When at least one entry is enabled,
DevirtualiseMmioinBooter->Quirksshould be enabled.
Patch
- Entry[N]->Arch: Only
Any,i386, orx86_64are accepted. - Entry[N]->Identifier: Only
Any,Apple, or a specified bootloader with.efisufffix, are accepted.
Quirks
- When
AllowRelocationBlockis enabled,ProvideCustomSlideshould be enabled altogether. - When
EnableSafeModeSlideis enabled,ProvideCustomSlideshould be enabled altogether. - If
ProvideMaxSlideis set to a number greater than zero,ProvideCustomSlideshould be enabled altogether. ResizeAppleGpuBarsmust be set to0or-1.- When
DisableVariableWrite,EnableWriteUnprotector, orProvideCustomSlideis enabled,OpenRuntime.efishould be loaded inUEFI->Drivers.
DeviceProperties
- Requirements here all follow Global Rules.
Kernel
Add
- Entry[N]->Arch: Only
Any,i386, orx86_64are accepted. - Entry[N]->BundlePath: Filename should have
.kextsuffix. - Entry[N]->PlistPath: Filename should have
.plistsuffix. - Entry[N]: If
Lilu.kextis used,DisableLinkeditJettisonshould be enabled inKernel->Quirks. - For some known kexts, their
BundlePath,ExecutablePath, andPlistPathmust match against each other. Current list of rules can be found here. - Plugin kext must be placed after parent kext. For example, plugins of Lilu must be placed after
Lilu.kext.
Delete
- Entry[N]->Arch: Only
Any,i386, orx86_64are accepted. - Entry[N]->Identifier: At least one dot (
.) should exist, because any identifier looks like a domain sequence (vendor.product).
Quirks
CustomSMBIOSGuidrequiresPlatformInfo->UpdateSMBIOSModeset toCustom.SetApfsTrimTimeoutcannot be a value that is greater thanMAX_UINT32, or less than-1.
Scheme
- KernelArch: Only
Auto,i386,i386-user32, orx86_64are accepted. - KernelCache: Only
Auto,Cacheless,Mkext, orPrelinkedare accepted.
Misc
BlessOverride
- Entries cannot be
\EFI\Microsoft\Boot\bootmgfw.efior\System\Library\CoreServices\boot.efisince OpenCore knows these paths.
Boot
- HibernateMode: Only
None,Auto,RTC, orNVRAMare accepted. - PickerMode: Only
Builtin,External, orAppleare accepted. PickerAudioAssistrequiresAudioSupportinUEFI->Audioto be enabled.- LauncherOption: Only
Disabled,Full,Short, orSystemare accepted. LauncherPathcannot be empty string.
Security
- AuthRestart: If enabled,
VirtualSMC.kextshould be present inKernel->Add. - DmgLoading: Only
Disabled,Signed, orAnyare accepted. - Vault: Only
Optional,Basic, orSecureare accepted. - SecureBootModel: Only
Default,Disabled,j137,j680,j132,j174,j140k,j780,j213,j140a,j152f,j160,j230k,j214k,j223,j215,j185,j185f, orx86legacyare accepted.
Serial
- RegisterAccessWidth: Only
8or32are accepted. - BaudRate: Only
921600,460800,230400,115200,57600,38400,19200,9600,7200,4800,3600,2400,2000,1800,1200,600,300,150,134,110,75, or50are accepted. - PciDeviceInfo: The last byte must be
0xFF. - PciDeviceInfo: Excluding the last byte
0xFF, the rest must be divisible by 4. - PciDeviceInfo: Maximum allowed size is 41.
NVRAM
- Requirements here all follow Global Rules. In addition, the following keys and values are checked:
gAppleBootVariableGuid (7C436110-AB2A-4BBB-A880-FE41995C9F82)
nvda_drvmust have typePlist Datawith the value of0x30or0x31.boot-argsmust be an ASCII string (thusPlist String) without trailing\0.bootercfgmust be an ASCII string (thusPlist String) without trailing\0.csr-active-configmust have typePlist Dataand have length of 4 bytes.StartupMutemust have typePlist Dataand have length of 1 byte.SystemAudioVolumemust have typePlist Dataand have length of 1 byte.
gAppleVendorVariableGuid (4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14)
UIScalemust have typePlist Datawith the value of0x01or0x02.FirmwareFeaturesmust have typePlist Dataand have length of 4 bytes.ExtendedFirmwareFeaturesmust have typePlist Dataand have length of 8 bytes.FirmwareFeaturesMaskmust have typePlist Dataand have length of 4 bytes.ExtendedFirmwareFeaturesmust have typePlist Dataand have length of 8 bytes.DefaultBackgroundColormust have typePlist Dataand have length of 4 bytes. Also, its last byte must be0x00.
PlatformInfo
- UpdateSMBIOSMode: Only
TryOverwrite,Create,Overwrite, orCustomare accepted.
Generic
- SystemProductName: Only real Mac models are accepted.
- SystemMemoryStatus: Only
Auto,Upgradable, orSolderedare accepted. - SystemUUID: Only empty string,
OEMor valid UUID are accepted. - ProcessorType: Only known first byte can be set.
UEFI
APFS
- When
EnableJumpstartis enabled,ScanPolicyinMisc->Securityshould haveOC_SCAN_ALLOW_FS_APFS(bit 8) set, together withOC_SCAN_FILE_SYSTEM_LOCK(bit 0) set. OrScanPolicyshould be0(failsafe value).
Audio
- When
AudioSupportis enabled,AudioDevicemust be either empty or a valid path. - When
AudioSupportis enabled,AudioOutMaskmust be non-zero.
Quirks
- When
RequestBootVarRoutingis enabled,OpenRuntime.efishould be loaded inUEFI->Drivers. ResizeGpuBarsmust be set to an integer value between-1and19.
Drivers
- When
OpenUsbKbDxe.efiis in use,KeySupportinUEFI->Inputshould never be enabled altogether. - When
Ps2KeyboardDxe.efiis in use,KeySupportinUEFI->Inputshould always be enabled altogether. OpenUsbKbDxe.efiandPs2KeyboardDxe.efishould never co-exist.- When HFS+ filesystem driver or
AudioDxe.efiis in use,ConnectDriversshould be enabled altogether. - When
OpenCanopy.efiis in use,PickerModeinMisc->Bootshould be set toExternal.
Input
- KeySupportMode: Only
Auto,V1,V2, orAMIare accepted. - When
PointerSupportis enabled, the value ofPointerSupportModeshould only beASUS.
Output
ClearScreenOnModeSwitch,IgnoreTextInGraphics,ReplaceTabWithSpace, andSanitiseClearScreenonly apply toSystemTextRendererResolutionshould matchNUMBERxNUMBERorNUMBERxNUMBER@NUMBERsequences (unless it is anEmpty stringor is set toMax).UIScalemust be set to an integer value between-1and2.
ReservedMemory
- Type: Only
Reserved,LoaderCode,LoaderData,BootServiceCode,BootServiceData,RuntimeCode,RuntimeData,Available,Persistent,UnusableMemory,ACPIReclaimMemory,ACPIMemoryNVS,MemoryMappedIO,MemoryMappedIOPortSpace, orPalCodeare accepted.