diff --git a/Utilities/ocvalidate/README.md b/Utilities/ocvalidate/README.md index 777089171d4a2b43349c18d0f82601f953ff5a48..671f363d73a3ca46f8b9b397f6f59ee7992f5dc8 100644 --- a/Utilities/ocvalidate/README.md +++ b/Utilities/ocvalidate/README.md @@ -18,6 +18,7 @@ Utility to validate whether a `config.plist` matches requirements and convention - All strings (fields with plist `String` format) 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](https://github.com/acidanthera/OpenCorePkg/blob/master/Docs/Configuration.pdf). - Most binary patches must have `Find`, `Replace`, `Mask` (if used), and `ReplaceMask` (if used) identical size set. Also, `Find` requires `Mask` (or `Replace` requires `ReplaceMask`) to be active (set to non-zero) for corresponding bits. - `MinKernel` and `MaxKernel` entries should follow conventions specified in [Configuration.pdf](https://github.com/acidanthera/OpenCorePkg/blob/master/Docs/Configuration.pdf). (TODO: Bring decent checks for this) +- `MinKernel` cannot 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 '/'`. diff --git a/Utilities/ocvalidate/ValidateKernel.c b/Utilities/ocvalidate/ValidateKernel.c index 01aa165bf3f63820a29b7ed8ba04cfa8db1200cf..b122967c53bc05752cdbb1c8eb859968918d0ebe 100644 --- a/Utilities/ocvalidate/ValidateKernel.c +++ b/Utilities/ocvalidate/ValidateKernel.c @@ -196,6 +196,14 @@ CheckKernelAdd ( ++ErrorCount; } + // + // MinKernel must not be below macOS 10.4 (Darwin version 8). + // + if (!OcMatchDarwinVersion (OcParseDarwinVersion (MinKernel), KERNEL_VERSION_TIGER_MIN, 0)) { + DEBUG ((DEBUG_WARN, "Kernel->Add[%u]->MinKernel has a Darwin version %a, which is below 8 (macOS 10.4)!\n", Index, MinKernel)); + ++ErrorCount; + } + // // FIXME: Handle correct kernel version checking. // @@ -321,6 +329,14 @@ CheckKernelBlock ( ++ErrorCount; } + // + // MinKernel must not be below macOS 10.4 (Darwin version 8). + // + if (!OcMatchDarwinVersion (OcParseDarwinVersion (MinKernel), KERNEL_VERSION_TIGER_MIN, 0)) { + DEBUG ((DEBUG_WARN, "Kernel->Block[%u]->MinKernel has a Darwin version %a, which is below 8 (macOS 10.4)!\n", Index, MinKernel)); + ++ErrorCount; + } + // // FIXME: Handle correct kernel version checking. // @@ -362,11 +378,19 @@ CheckKernelEmulate ( ErrorCount = 0; UserKernel = &Config->Kernel; + MaxKernel = OC_BLOB_GET (&UserKernel->Emulate.MaxKernel); + MinKernel = OC_BLOB_GET (&UserKernel->Emulate.MinKernel); + + // + // MinKernel must not be below macOS 10.4 (Darwin version 8). + // + if (!OcMatchDarwinVersion (OcParseDarwinVersion (MinKernel), KERNEL_VERSION_TIGER_MIN, 0)) { + DEBUG ((DEBUG_WARN, "Kernel->Emulate->MinKernel has a Darwin version %a, which is below 8 (macOS 10.4)!\n", MinKernel)); + ++ErrorCount; + } // // FIXME: Handle correct kernel version checking. // - MaxKernel = OC_BLOB_GET (&UserKernel->Emulate.MaxKernel); - MinKernel = OC_BLOB_GET (&UserKernel->Emulate.MinKernel); if (MaxKernel[0] != '\0' && OcParseDarwinVersion (MaxKernel) == 0) { DEBUG ((DEBUG_WARN, "Kernel->Emulate->MaxKernel (currently set to %a) is borked!\n", MaxKernel)); ++ErrorCount; @@ -466,6 +490,14 @@ CheckKernelForce ( ++ErrorCount; } + // + // MinKernel must not be below macOS 10.4 (Darwin version 8). + // + if (!OcMatchDarwinVersion (OcParseDarwinVersion (MinKernel), KERNEL_VERSION_TIGER_MIN, 0)) { + DEBUG ((DEBUG_WARN, "Kernel->Force[%u]->MinKernel has a Darwin version %a, which is below 8 (macOS 10.4)!\n", Index, MinKernel)); + ++ErrorCount; + } + // // FIXME: Handle correct kernel version checking. // @@ -551,6 +583,14 @@ CheckKernelPatch ( ++ErrorCount; } + // + // MinKernel must not be below macOS 10.4 (Darwin version 8). + // + if (!OcMatchDarwinVersion (OcParseDarwinVersion (MinKernel), KERNEL_VERSION_TIGER_MIN, 0)) { + DEBUG ((DEBUG_WARN, "Kernel->Patch[%u]->MinKernel has a Darwin version %a, which is below 8 (macOS 10.4)!\n", Index, MinKernel)); + ++ErrorCount; + } + // // FIXME: Handle correct kernel version checking. //