提交 eb6b52ba 编写于 作者: P PMheart

ocvalidate: Add check for MinKernel >= 10.4

上级 e16a36f6
...@@ -18,6 +18,7 @@ Utility to validate whether a `config.plist` matches requirements and convention ...@@ -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). - 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. - 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` 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 '\'`. - 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. - 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 '/'`. - Paths of UEFI Drivers only accept `0-9, A-Z, a-z, '_', '-', '.', and '/'`.
......
...@@ -196,6 +196,14 @@ CheckKernelAdd ( ...@@ -196,6 +196,14 @@ CheckKernelAdd (
++ErrorCount; ++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. // FIXME: Handle correct kernel version checking.
// //
...@@ -321,6 +329,14 @@ CheckKernelBlock ( ...@@ -321,6 +329,14 @@ CheckKernelBlock (
++ErrorCount; ++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. // FIXME: Handle correct kernel version checking.
// //
...@@ -362,11 +378,19 @@ CheckKernelEmulate ( ...@@ -362,11 +378,19 @@ CheckKernelEmulate (
ErrorCount = 0; ErrorCount = 0;
UserKernel = &Config->Kernel; 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. // 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) { if (MaxKernel[0] != '\0' && OcParseDarwinVersion (MaxKernel) == 0) {
DEBUG ((DEBUG_WARN, "Kernel->Emulate->MaxKernel (currently set to %a) is borked!\n", MaxKernel)); DEBUG ((DEBUG_WARN, "Kernel->Emulate->MaxKernel (currently set to %a) is borked!\n", MaxKernel));
++ErrorCount; ++ErrorCount;
...@@ -466,6 +490,14 @@ CheckKernelForce ( ...@@ -466,6 +490,14 @@ CheckKernelForce (
++ErrorCount; ++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. // FIXME: Handle correct kernel version checking.
// //
...@@ -551,6 +583,14 @@ CheckKernelPatch ( ...@@ -551,6 +583,14 @@ CheckKernelPatch (
++ErrorCount; ++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. // FIXME: Handle correct kernel version checking.
// //
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册