Skip to content

Develop a driver ​

To adapt hardware, follow the driver checklist. It covers component drivers and board-package services in dependency order.

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

Procedure ​

  1. Search the component catalog and existing repositories for the hardware interface. Read the candidate's scope, ABI, dependencies and implementation.
  2. Choose the execution layer from when the capability is needed: firmware, built-in XNU or a supported loader's kext path.
  3. Identify the provider and resources using matching and device-tree rules. Record the actual board values.
  4. Follow the corresponding implementation procedure: UEFI, built-in XNU, or kext staging. Add the component and recipe to the device selection.
  5. Build the affected artifact and follow the subsystem's adaptation checks. Record source/build results and device behavior separately in porting.toml.

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

Drivers and kits are independent repositories. Profiles select catalog components, and feeds or local overrides supply sources. Check the component catalog before adding an implementation.

Next steps ​

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