Skip to content

J-x-Z/hurd-xnu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Hurd on XNU

Running GNU Hurd userspace on Apple's XNU kernel

Status Tests License

Overview

This project ports GNU Hurd's microkernel-based userspace to run on Apple's XNU kernel, combining:

  • XNU: Apple's hybrid kernel (Mach + BSD) with modern hardware support
  • Hurd: GNU's microkernel OS with translator-based architecture

Current Status (v0.3-alpha) πŸŽ‰

Core Servers (5)

Server Status Description
auth βœ… Working Authentication with root handle
proc βœ… Working Process management, PID/task conversion
exec βœ… Working ELF execution (stubbed)
pfinet βœ… Working Network (BSD socket wrapper)
ext2fs βœ… Working Filesystem (POSIX wrapper)

Translators (4)

Translator Status Description
term βœ… Working PTY + console (/dev/ttys*)
symlink βœ… Working Symbolic links
devnull βœ… Working /dev/null, zero, full, random, urandom
tmpfs βœ… Working In-memory filesystem (64MB)

Bootstrap & Init

Component Status Description
startup βœ… Working Essential task registration, shutdown notify
init βœ… Working Runlevel 0-3, service ordering
bootstrap βœ… Working Server startup management

Driver Layer

Component Status Description
rumpuser βœ… Working NetBSD Rump hypercalls for XNU
machdev βœ… Working Mach device layer compatibility
rumpdisk βœ… Working Block devices (wd0, wd1)
rumpnet βœ… Working Network interfaces (eth0, lo0)
LKL bridge βœ… Working Linux Kernel Library integration

Integration Testing

═══════════════════════════════════════════════════════════
   TEST SUMMARY
═══════════════════════════════════════════════════════════
   Passed: 27
   Failed: 0
   Total:  27
═══════════════════════════════════════════════════════════
πŸŽ‰ ALL USERSPACE TESTS PASSED!

Quick Start

Prerequisites

  • macOS (tested on Sequoia 15.x, M4 Mac)
  • Xcode Command Line Tools
  • QEMU (optional, for boot testing)

Build & Test

# Clone
git clone --recursive https://github.com/J-x-Z/hurd-xnu
cd hurd-xnu

# Build all tests
make tests

# Run userspace integration test (27 tests)
./tests/userspace_test

# Run individual translator tests
./compat/term_test
./compat/tmpfs_test
./compat/devnull_test

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  Hurd Userspace Tests                   β”‚
β”‚    (shell, coreutils, network, multi-user, PTY)        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                     Translators                         β”‚
β”‚      term β”‚ symlink β”‚ devnull β”‚ tmpfs                   β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                    Core Servers                         β”‚
β”‚    auth β”‚ proc β”‚ exec β”‚ pfinet β”‚ ext2fs β”‚ startup      β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚               Bootstrap / Init                          β”‚
β”‚         hurd_bootstrap.c β”‚ init_xnu.c                  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                   Driver Layer                          β”‚
β”‚    rumpuser β”‚ machdev β”‚ LKL bridge                     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚              Compatibility Layer                        β”‚
β”‚    libports β”‚ MIG stubs β”‚ mach.h β”‚ ports.h             β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                    XNU Kernel                           β”‚
β”‚         (Mach microkernel + BSD + IOKit)               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Directory Structure

hurd-xnu/
β”œβ”€β”€ compat/                 # XNU compatibility layer (~6000 lines)
β”‚   β”œβ”€β”€ auth_xnu.c          # Auth server
β”‚   β”œβ”€β”€ proc_xnu.c          # Proc server
β”‚   β”œβ”€β”€ exec_xnu.c          # Exec server
β”‚   β”œβ”€β”€ pfinet_xnu.c        # Network server
β”‚   β”œβ”€β”€ ext2fs_xnu.c        # Filesystem translator
β”‚   β”œβ”€β”€ startup_xnu.c       # Startup server
β”‚   β”œβ”€β”€ init_xnu.c          # Init process
β”‚   β”œβ”€β”€ hurd_bootstrap.c    # Bootstrap manager
β”‚   β”œβ”€β”€ term_xnu.c          # Terminal translator
β”‚   β”œβ”€β”€ symlink_xnu.c       # Symlink translator
β”‚   β”œβ”€β”€ devnull_xnu.c       # /dev/null, zero, random
β”‚   β”œβ”€β”€ tmpfs_xnu.c         # In-memory filesystem
β”‚   β”œβ”€β”€ rumpuser_xnu.c      # Rump hypercalls
β”‚   β”œβ”€β”€ machdev_xnu.c       # Mach device layer
β”‚   β”œβ”€β”€ lkl_hurd_bridge.c   # LKL integration
β”‚   β”œβ”€β”€ mach.h              # Mach type definitions
β”‚   β”œβ”€β”€ ports.h             # libports interface
β”‚   └── hurd/               # MIG .defs files
β”œβ”€β”€ tests/                  # Test programs
β”‚   β”œβ”€β”€ hurd_userspace_test.c  # Integration test (27 tests)
β”‚   └── rump_integration_test.c
β”œβ”€β”€ hurd/                   # Original Hurd source (submodule)
β”œβ”€β”€ xnu/                    # XNU kernel source (submodule)
└── qemu/                   # QEMU boot infrastructure

Roadmap

  • Phase 1-5: Environment, Mach IPC, libports, QEMU boot βœ…
  • Phase 6: Core Hurd servers (auth, proc, exec, pfinet, ext2fs) βœ…
  • Phase 7: Rump Kernels (rumpdisk, rumpnet) βœ…
  • Phase 8: Bootstrap + Startup + Init βœ…
  • Phase 9: Translators (term, symlink, devnull, tmpfs) βœ…
  • Phase 10: Userspace integration (27/27 tests) βœ…
  • Phase 11: Bare metal Hurd on XNU (launchd, Kext, boot image)

Code Statistics

Category Files Lines
Core Servers 6 ~1,400
Translators 4 ~950
Bootstrap/Init 3 ~720
Driver Layer 5 ~1,600
Compatibility 10+ ~1,500
Tests 5+ ~800
Total 30+ ~7,000

Related Projects

License

  • Hurd components: GPL-2.0
  • XNU: APSL-2.0
  • This compatibility layer: GPL-2.0

Contributing

This is an experimental research project. Contributions welcome!

  1. Fork this repository
  2. Create a feature branch
  3. Submit a Pull Request

Acknowledgments

  • GNU Hurd developers
  • Apple XNU team (open source kernel)
  • OSX-KVM / DarwinKVM communities
  • NetBSD Rump and LKL projects