Skip to content

Driver layers ​

UniXNU has three driver layers. Each layer runs in a different environment and has a different build and load path.

LayerRuns inBuilt asLoaded by
UEFI driverUEFI boot servicesEDK II .efiFirmware dispatch, UniXNU [[driver]], or a kit
Built-in XNU driverXNU kernelStatic archive linked into the kernelThe kernel at boot
Kext bundleXNU kernel, staged by UEFI.kext bundleAn XNU loader that implements the protocol

Choosing a layer ​

NeedLayer
Display, input or storage available before XNUUEFI driver
Platform expert, CPU, interrupt controller, storage, display or GPU inside XNUBuilt-in XNU driver
A bundle that an external loader validates and injects at runtimeKext bundle

A UEFI driver can provide the framebuffer and input for the UniXNU menu. It can also publish a protocol that another UEFI driver consumes.

A built-in XNU driver has full kernel API access. It is compiled against the exact XNU build ABI and force-loaded into the kernel.

A kext bundle keeps the standard bundle layout. UniXNU stages the plist and the executable and passes them to the loader. The loader owns validation, dependency resolution and injection.

Matching ​

UEFI drivers bind through the UEFI driver model or run as applications.

XNU drivers bind through IOKitPersonalities. A personality names the provider class, the driver class, an optional name match and a probe score.

KeyMeaning
IOClassDriver class
IOProviderClassProvider class
IONameMatchProvider name or compatible value
IOProbeScoreHigher scores probe first
IOMatchCategoryAllows a second driver to match the same provider
IOResourceMatchWaits for a named resource, for example IOBSD

Built-in personalities live in iokit/KernelConfigTables.cpp. Kext personalities live in the bundle Info.plist.

Device tree ​

The ADT describes the hardware. The platform expert publishes a nub for each arm-io child. A driver reads its resources from the provider:

cpp
OSData *reg = OSDynamicCast(OSData, provider->getProperty("reg"));

The compatible property selects a driver. IONameMatch compares against the provider name.

Driver directories ​

DirectoryContents
drivers/<Name>Built-in XNU driver source and reference Info.plist
kits/<Name>Kernel library linked into a driver or the kernel
package/UniXNUPkg/DriverUEFI drivers
package/UniXNUPkg/TestUEFI test drivers and payloads

A device repository can override any of these directories with its own version.

Next steps ​

Released under the BSD-2-Clause-Patent License.