XNU inside Linux: how two kernels can share one machine

9 steps · about 4 h 35 min · Intermediate

  1. What Is an Operating System? Kernel, System Calls (article, DEV Community (codekairo), 15 min)

    Start with what a kernel is and why user mode and kernel mode exist, since the whole project is about running one kernel beside another.

  2. System Calls: The Kernel's API (article, AlgoMaster, 20 min)

    System calls are the boundary a macOS program crosses, so you need to know how they work before seeing how xnulinux serves them.

  3. The Linux Kernel Module Programming Guide (guide, Linux Kernel Module Programming Guide (maintained edition), 1 h)

    xnulinux ships as a loadable module (xnu.ko), so learn how modules are written, built, loaded and unloaded in Linux.

  4. The XNU Kernel Architecture - macOS and Unix: The Complete Guide (guide, macOS and Unix: The Complete Guide, 20 min)

    This gives the big picture of XNU as a hybrid of Mach, BSD and IOKit, plus its source layout.

  5. XNU Architecture and Build Overview (article, Tan Sanrao, 30 min)

    It covers XNU's startup sequence and build, which shows what a module must provide, such as memory, timers and a CPU, to boot XNU.

  6. XNU IPC - Mach messages (blog, dmcyk, 30 min)

    Mach ports and messages are the part of macOS userspace with no Linux equivalent, so this is where the two systems differ most.

  7. Mac Internals: macOS & XNU Kernel Internals Explained (guide, Mac Internals, 45 min)

    Every claim links to Apple's open-source XNU code, so you can read the real files behind the earlier concepts.

  8. How Rosetta, Wine and DXVK run software on machines it was never built for (article, DEV Community (quantumbreakz), 15 min)

    Compare other approaches to running foreign software, which are translation layers, with xnulinux, which hosts the real kernel.

  9. AFK-surf/xnulinux: XNU as a loadable kernel module inside Linux (repo, AFK-surf (GitHub), 40 min)

    Finish by reading the project itself: how xnu.ko, fki.ko and the boot scripts fit the concepts you've learned.