Source Tree
A map of the repository. src/ holds the system itself, nix/ holds the
build around it, and tools/ holds what the build computer needs to build Darwin at
all.
Many directories hold code that came from Apple or from other projects. The
Credits page says where each came from, and NOTICE in the repository
lists the exact Apple release for each Apple directory.
src/Kernel
src/Kernel/xnu is the kernel, PureDarwin’s version of Apple’s XNU. Beside it are
libkmod, libfirehose_kernel, fbsdkpi and src/Kernel/Extensions, which holds the
kernel extensions, or kexts. Kexts are Darwin’s drivers and kernel modules, and they fall into groups:
- Platform. The code that describes the machine to the kernel.
PDACPIPlatform(built on uACPI),AppleI386GenericPlatform,AppleAPIC,AppleI386PCI,IOACPIFamily,IOPCIFamily,PDEcamPCI, and for ARM and RISC-VPDArmPlatformExpert,PDArmPCIandPDRiscvPlatformExpert. - Storage.
IOStorageFamily,IOATAFamily,IOATABlockStorage,IONVMEFamily,RavynAHCIPort,IOVirtIOBlock, the SD card drivers for the boards, and the optical disc families. - Filesystems.
ext4andExt4FileSystemDriver,hfswithHFSEncodings,apfsandApfsFileSystemDriver,msdosfs,cd9660andAppleFileSystemDriver. - Graphics.
IOGraphicsFamily,IOGOPFramebuffer,IOVirtIOGPU,IONDRVSupport,PDIOSurface, and the GPU driversPDDRMamdgpu,PDDRMi915andPDDRMnouveauwithPDDRMDri, which provides/dev/dri. NVIDIA’s own driver is loaded byPDNVLoader. - Network.
IONetworkingFamily,IO80211Family,IOVirtIONet,PDE1000,PDRealtek8111,PDRalinkUSB, and the FreeBSD drivers whose names start withPDFBSD. - Input, USB and audio.
IOHIDFamily,ApplePS2Controller,IOUSBFamily,RavynXHCIPort,IOAudioFamilyandRavynHDAudio. - Support.
corecrypto,pthread,Sandbox,amfiand others.
fbsdkpi lets FreeBSD drivers, and the Linux GPU drivers FreeBSD carries, run on XNU
without changes. It’s built on Haiku’s FreeBSD compatibility code and adds FreeBSD’s
Wi-Fi stack and its Linux compatibility layer. The kexts whose names start with
PDFBSD and PDDRM run on it.
The corecrypto kext is built from the MPL 2.0 fork in external/corecrypto, which
started from NeoDarwin’s corecrypto.
The ext4 driver deserves a mention. Darwin has no ext4, and we use it as our root filesystem, so it’s all our own code. It has caused a long list of subtle bugs over time (see Debugging).
src/Libraries
The base of the userland. Apple publishes some of it, and the rest is written here or comes from other projects.
- The core.
libSystemand its parts,dyldanddyld4,libcxx,libcxxabi,libunwind,llvm-libc,libdarwin,architectureandAvailabilityVersions. - Objective-C and system libraries.
objc4,CoreServices,IOKit,DiskArbitration,SecuritywithlibDER,SystemConfigurationandlibSystemConfiguration,CommonCryptoandlibsandbox. - Services.
XPC(which holds launchd, launchctl and notifyd),syslog,libsystem_trace,mDNSResponder,libresolv,bootp,eap8021xandppp. - Graphics support.
libdrm,libgbm, and our ownPDGOP,PDSurfaceandPDVirglShim. - Swift support.
SwiftFoundation,SwiftFrameworks,SwiftOverlaysandSwiftSupplemental, PureDarwin’s Swift layers over its frameworks.
src/Frameworks
The frameworks that graphical programs use: CoreFoundation, Foundation, AppKit,
Cocoa, CoreGraphics and Onyx2D, CoreText, CoreData, QuartzCore,
CoreVideo, OpenGL, IOSurface, WindowServer, ApplicationServices and many
smaller ones. Several of them started from Cocotron or NeoDarwin, as Credits explains.
src/Userspace
The commands and applications.
- Commands.
shell_cmds,text_cmds,system_cmds,diskdev_cmds,ps,ping,netstat,ioreg,sw_vers,dtrace,netsetup,mdnsd,wifiutil,pdinstall,pdkext,pdpowerd, theext4toolandext4utilmaintenance tools, andtcc. - The desktop.
argon-session,MenuBar,Dock,Finder(shown as Files),Terminal,Settings,Calculator,SystemInformation,TextEditor,ImageViewer,Installer,loginwindowand others. - X11 support.
startxand the two Xorg driversxf86-video-puredarwingopandxf86-input-puredarwin.
src/ThirdParty
Other projects kept in the tree because they needed real porting work: neuswc and
neuwld (the compositor and drawing library under the desktop), wayland,
wayland-protocols, wlroots and sway.
projects/
libapfsrw, the APFS read and write library the apfs kext uses.
external/
corecrypto, the MPL 2.0 fork described above.
nix/
The build. The Nix Flake describes the files. The ported software
is in nix/pkgs/, grouped by kind:
| Group | Contents |
|---|---|
base | Build tools and core libraries, such as autotools, cmake, meson, perl, python, openssl, curl, zsh and git |
apple | Apple components and the test programs for them |
x11 | The X server, its libraries and clients |
apps | Applications, terminals and Wine |
gpu, mesa, wayland, gtk | The graphics stack and desktop libraries |
boot | The shim for Secure Boot images |
toolchain | Compilers, LLVM, the linker, the kernel collection tools and the SDK |
ls nix/pkgs/<group> shows what’s there today.
tools/
Tools for the build computer: cctools, mig, unifdef, dtrace_ctf, xar and
iig-selfhost. See Host Tools and Toolchains.
cmake/
The CMake helper modules. See The CMake Tree.