# sunuwijaya/ios-munch architecture

> Architecture diagram of the GitHub repository sunuwijaya/ios-munch, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sunuwijaya/ios-munch
- Repository: https://github.com/sunuwijaya/ios-munch

## Overview

HakiOS boots XNU and stock iOS 16.5 user space on Qualcomm Android phones, either on-device or in QEMU; it is a RAM-resident research system, not a flashed ROM. The principal flow is to obtain iOS image parts and device firmware, prepare bootable system/APFS images, load the kernel through the device UEFI/loader path, then run iOS services and hardware drivers. The graph also preserves documented graphics, networking, modem, camera, storage, and jailbreak capabilities. Most subsystem links are README-documented; unsampled internals are represented only at supported directory paths.

Main entry points: [`xnu/files`](https://github.com/sunuwijaya/ios-munch/tree/main/xnu/files) (XNU kernel), [`tools/apfs`](https://github.com/sunuwijaya/ios-munch/tree/main/tools/apfs) (APFS image tools), [`xnuloader/loader.c`](https://github.com/sunuwijaya/ios-munch/blob/main/xnuloader/loader.c) (XNU loader), [`sysimage/fetch-from-ipsw.py`](https://github.com/sunuwijaya/ios-munch/blob/main/sysimage/fetch-from-ipsw.py) (IPSW acquisition)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_boot["Boot and platforms"]
  node_uefi["Device UEFI"]
  node_loader["XNU loader<br/>[loader.c]"]
  node_bootimage["Boot image packager<br/>[mkbootimg.py]"]
end

subgraph group_kernel["Kernel and drivers"]
  node_xnu["XNU kernel"]
  node_apfsdriver["APFS driver"]
  node_persistent["Persistent storage<br/>[apfs_write.h]"]
end

subgraph group_images["Images and user space"]
  node_sysfetch["IPSW acquisition<br/>[fetch-from-ipsw.py]"]
  node_systemselect["System selection<br/>[select-system.py]"]
  node_apfsimages["APFS image tools"]
  node_jobs["iOS job setup<br/>[mkjobs.py]"]
  node_iosuserland["iOS user space"]
end

subgraph group_hardware["Device capabilities"]
  node_graphics["OpenGL ES<br/>[eagl.c]"]
  node_display["Display framebuffer"]
  node_wifi["Wi-Fi driver<br/>[lx_80211.c]"]
  node_cellular["Cellular stack"]
  node_camera["Camera drivers"]
  node_audio["Audio and DSP"]
end

subgraph group_tools["Developer tools"]
  node_apfstool["APFS host tool<br/>[apfs-tool.c]"]
  node_mkxnuimg["Kernel image tool<br/>[mkxnuimg.py]"]
end

node_operator(("Operator"))
node_phone(("Qualcomm phone"))
node_qemu(("QEMU host"))
node_ipsw["Apple IPSW"]
node_vendorfw["Phone firmware"]

node_operator -->|"requests image"| node_sysfetch
node_ipsw -->|"provides source"| node_sysfetch
node_sysfetch -.->|"unpacks parts"| node_systemselect
node_operator -->|"starts session"| node_phone
node_phone -->|"supplies firmware"| node_vendorfw
node_operator -->|"packages boot"| node_bootimage
node_bootimage -.->|"builds platform"| node_uefi
node_uefi -.->|"starts loader"| node_loader
node_loader -->|"loads kernel"| node_xnu
node_systemselect -.->|"prepares inputs"| node_apfsimages
node_apfsimages -.->|"builds images"| node_iosuserland
node_jobs -->|"configures jobs"| node_iosuserland
node_xnu -.->|"mounts volumes"| node_apfsdriver
node_apfsdriver -->|"supports writes"| node_persistent
node_apfsimages -->|"checks images"| node_apfstool
node_xnu -->|"provides display"| node_display
node_iosuserland -->|"renders via GLES"| node_graphics
node_xnu -.->|"hosts networking"| node_wifi
node_xnu -->|"hosts modem stack"| node_cellular
node_xnu -->|"provides camera"| node_camera
node_xnu -->|"provides audio"| node_audio
node_operator -->|"runs emulation"| node_qemu
node_mkxnuimg -.->|"prepares payload"| node_loader

click node_uefi "https://github.com/sunuwijaya/ios-munch/tree/main/devices/poco-x5-pro/uefi"
click node_loader "https://github.com/sunuwijaya/ios-munch/blob/main/xnuloader/loader.c"
click node_bootimage "https://github.com/sunuwijaya/ios-munch/blob/main/devices/poco-x5-pro/prebuilt/mkbootimg.py"
click node_xnu "https://github.com/sunuwijaya/ios-munch/tree/main/xnu/files"
click node_apfsdriver "https://github.com/sunuwijaya/ios-munch/tree/main/xnu/files/bsd/miscfs/apfs"
click node_sysfetch "https://github.com/sunuwijaya/ios-munch/blob/main/sysimage/fetch-from-ipsw.py"
click node_systemselect "https://github.com/sunuwijaya/ios-munch/blob/main/sysimage/select-system.py"
click node_apfsimages "https://github.com/sunuwijaya/ios-munch/tree/main/tools/apfs"
click node_jobs "https://github.com/sunuwijaya/ios-munch/blob/main/userland/mkjobs.py"
click node_iosuserland "https://github.com/sunuwijaya/ios-munch/tree/main/userland/src"
click node_graphics "https://github.com/sunuwijaya/ios-munch/blob/main/userland/src/eagl.c"
click node_display "https://github.com/sunuwijaya/ios-munch/blob/main/xnu/files/iokit/Kernel/MiniIOMobileFramebuffer.cpp"
click node_wifi "https://github.com/sunuwijaya/ios-munch/blob/main/wifi/lx/src/lx_80211.c"
click node_cellular "https://github.com/sunuwijaya/ios-munch/tree/main/xnu/files/bsd/dev"
click node_camera "https://github.com/sunuwijaya/ios-munch/tree/main/xnu/files/bsd/dev"
click node_audio "https://github.com/sunuwijaya/ios-munch/tree/main/xnu/files/bsd/dev"
click node_persistent "https://github.com/sunuwijaya/ios-munch/blob/main/xnu/files/bsd/miscfs/apfs/apfs_write.h"
click node_apfstool "https://github.com/sunuwijaya/ios-munch/blob/main/tools/apfs/apfs-tool.c"
click node_mkxnuimg "https://github.com/sunuwijaya/ios-munch/blob/main/mkxnuimg.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_uefi,node_loader,node_bootimage toneBlue
class node_xnu,node_apfsdriver,node_persistent toneAmber
class node_sysfetch,node_systemselect,node_apfsimages,node_jobs,node_iosuserland toneMint
class node_graphics,node_display,node_wifi,node_cellular,node_camera,node_audio toneRose
class node_apfstool,node_mkxnuimg,node_operator,node_phone,node_qemu,node_ipsw,node_vendorfw toneIndigo
```

## Components

### Boot and platforms

- [Device UEFI](https://github.com/sunuwijaya/ios-munch/tree/main/devices/poco-x5-pro/uefi): `devices/poco-x5-pro/uefi`
- [XNU loader](https://github.com/sunuwijaya/ios-munch/blob/main/xnuloader/loader.c): `xnuloader/loader.c`
- [Boot image packager](https://github.com/sunuwijaya/ios-munch/blob/main/devices/poco-x5-pro/prebuilt/mkbootimg.py): `devices/poco-x5-pro/prebuilt/mkbootimg.py`

### Kernel and drivers

- [XNU kernel](https://github.com/sunuwijaya/ios-munch/tree/main/xnu/files): `xnu/files`
- [APFS driver](https://github.com/sunuwijaya/ios-munch/tree/main/xnu/files/bsd/miscfs/apfs): `xnu/files/bsd/miscfs/apfs`
- [Persistent storage](https://github.com/sunuwijaya/ios-munch/blob/main/xnu/files/bsd/miscfs/apfs/apfs_write.h): `xnu/files/bsd/miscfs/apfs/apfs_write.h`

### Images and user space

- [IPSW acquisition](https://github.com/sunuwijaya/ios-munch/blob/main/sysimage/fetch-from-ipsw.py): `sysimage/fetch-from-ipsw.py`
- [System selection](https://github.com/sunuwijaya/ios-munch/blob/main/sysimage/select-system.py): `sysimage/select-system.py`
- [APFS image tools](https://github.com/sunuwijaya/ios-munch/tree/main/tools/apfs): `tools/apfs`
- [iOS job setup](https://github.com/sunuwijaya/ios-munch/blob/main/userland/mkjobs.py): `userland/mkjobs.py`
- [iOS user space](https://github.com/sunuwijaya/ios-munch/tree/main/userland/src): `userland/src`

### Device capabilities

- [OpenGL ES](https://github.com/sunuwijaya/ios-munch/blob/main/userland/src/eagl.c): `userland/src/eagl.c`
- [Display framebuffer](https://github.com/sunuwijaya/ios-munch/blob/main/xnu/files/iokit/Kernel/MiniIOMobileFramebuffer.cpp): `xnu/files/iokit/Kernel/MiniIOMobileFramebuffer.cpp`
- [Wi-Fi driver](https://github.com/sunuwijaya/ios-munch/blob/main/wifi/lx/src/lx_80211.c): `wifi/lx/src/lx_80211.c`
- [Cellular stack](https://github.com/sunuwijaya/ios-munch/tree/main/xnu/files/bsd/dev): `xnu/files/bsd/dev`
- [Camera drivers](https://github.com/sunuwijaya/ios-munch/tree/main/xnu/files/bsd/dev): `xnu/files/bsd/dev`
- [Audio and DSP](https://github.com/sunuwijaya/ios-munch/tree/main/xnu/files/bsd/dev): `xnu/files/bsd/dev`

### Developer tools

- [APFS host tool](https://github.com/sunuwijaya/ios-munch/blob/main/tools/apfs/apfs-tool.c): `tools/apfs/apfs-tool.c`
- [Kernel image tool](https://github.com/sunuwijaya/ios-munch/blob/main/mkxnuimg.py): `mkxnuimg.py`

### Other components

- **Operator**
- **Qualcomm phone**
- **QEMU host**
- **Apple IPSW**
- **Phone firmware**

## Connections

- Operator → IPSW acquisition: requests image (evidence: `README.md`)
- Apple IPSW → IPSW acquisition: provides source (evidence: `README.md`)
- IPSW acquisition → System selection: unpacks parts
- Operator → Qualcomm phone: starts session (evidence: `README.md`)
- Qualcomm phone → Phone firmware: supplies firmware (evidence: `README.md`)
- Operator → Boot image packager: packages boot (evidence: `README.md`)
- Boot image packager → Device UEFI: builds platform
- Device UEFI → XNU loader: starts loader
- XNU loader → XNU kernel: loads kernel (evidence: `README.md`)
- System selection → APFS image tools: prepares inputs
- APFS image tools → iOS user space: builds images
- iOS job setup → iOS user space: configures jobs (evidence: `userland/mkjobs.py`)
- XNU kernel → APFS driver: mounts volumes (evidence: `xnu/files/bsd/miscfs/apfs/apfs_lib.h`)
- APFS driver → Persistent storage: supports writes (evidence: `xnu/files/bsd/miscfs/apfs/apfs_write.h`)
- APFS image tools → APFS host tool: checks images (evidence: `tools/apfs/apfs-tool.c`)
- XNU kernel → Display framebuffer: provides display (evidence: `xnu/files/iokit/Kernel/MiniIOMobileFramebuffer.cpp`)
- iOS user space → OpenGL ES: renders via GLES (evidence: `userland/src/eagl.c`)
- XNU kernel → Wi-Fi driver: hosts networking
- XNU kernel → Cellular stack: hosts modem stack (evidence: `README.md`)
- XNU kernel → Camera drivers: provides camera (evidence: `README.md`)
- XNU kernel → Audio and DSP: provides audio (evidence: `README.md`)
- Operator → QEMU host: runs emulation (evidence: `README.md`)
- Kernel image tool → XNU loader: prepares payload
