HN
Today

XNU Linux: Full OS X GUI Userspace on Linux

This project achieves the seemingly impossible: running a full macOS GUI userspace natively on Linux by loading Apple's XNU kernel as a Linux module. It's a mind-bending technical feat that blurs OS boundaries, showcasing incredible kernel-level ingenuity. Hacker News is buzzing about the implications for OS interoperability, Apple's walled garden, and the sheer audacity of the engineering involved.

283
Score
130
Comments
#1
Highest Rank
8h
on Front Page
First Seen
Nov 23, 4:00 AM
Last Seen
Nov 23, 11:00 AM
Rank Over Time
152222112

The Lowdown

XNU Linux is an ambitious project that enables a complete macOS GUI userspace to run directly on an arm64 Linux system. It accomplishes this by compiling XNU, the open-source kernel of macOS, and loading it as a kernel module (xnu.ko) into an unmodified Linux kernel. This isn't virtualization; the hosted XNU kernel takes direct control of the CPU and MMU, allowing macOS processes to run natively alongside Linux processes on the same hardware.

Here's how it works and what it achieves:

  • Co-kernel Architecture: XNU runs as a peer to the Linux kernel, leveraging Linux for core services like memory allocation, timers, file access, networking, and GPU through a small interface module (fki.ko).
  • Native Execution: macOS applications like Safari, Finder, and WindowServer run directly on the hardware, not within a hypervisor, offering potentially better performance and integration.
  • GPU Acceleration: It supports Metal applications in macOS by bridging to the Linux host's GPU via Vulkan (using Mesa's Venus driver), falling back to CPU rendering if a GPU bridge isn't available.
  • Current Status: Demonstrated working on Apple Silicon Macs (running Linux in a VM), booting macOS 27.2.1 to the desktop in under a minute, and handling stress tests without crashes.
  • Requirements: Requires an arm64 Linux host with PAC (like Apple Silicon), significant RAM, and a user-provided macOS installation disk; no Apple binaries are distributed by the project.

This project represents a significant leap in operating system interoperability, pushing the boundaries of what's thought possible when integrating two distinct kernel architectures. It's a testament to low-level systems programming and reverse-engineering prowess.

The Gossip

Kernel Kinks and Compatibility Quandaries

The discussion often circles back to the sheer technical marvel of the project, with many expressing awe at the ingenuity involved. Commenters dissect the mechanics of how XNU runs as a loadable module alongside the Linux kernel, comparing it to traditional virtualization methods like KVM and pondering the performance or integration benefits for users of projects like Asahi Linux. There's a mix of admiration for the 'how' and probing questions about the 'why,' especially regarding practical applications beyond the impressive technical feat.

Apple's Openness and Iron Curtain

A significant portion of the debate centers on Apple's contradictory stance: releasing the XNU kernel as open source while maintaining a tightly controlled hardware and software ecosystem. Commenters speculate on Apple's motivations for open-sourcing XNU and how they might react to projects like this, drawing parallels to their historical approach to Hackintosh. Some foresee a future where Apple further hardens its systems with hardware-level encryption, while others express satisfaction that Apple's 'god-like' design and platform moat are increasingly being eroded by such community efforts.

OS Overlaps and Alternative Aspirations

This theme explores the project in the context of past and present efforts to bridge OSes. Commenters recall projects like CoLinux and ponder the feasibility of running Windows' NTOSKRNL in a similar fashion, acknowledging the greater difficulty due to its closed-source nature. Comparisons are made to GNUstep and Darling, projects that aim to replicate macOS APIs or run macOS binaries on Linux, with a discussion on which approach is more practical or desirable. The overall sentiment reflects a strong desire for greater OS interoperability and cross-platform development capabilities.