Built with use from agentic coding products.
QEMU-iOS emulates legacy Apple devices well enough to run their stock firmware: from the boot ROM or a kernel bundle to the home screen, with touch, buttons, display, audio, Wi-Fi, USB (usbmux/AFC through libimobiledevice), persistent storage, a fake cellular network on the iPhones, and OpenGL ES through a host GL bridge. It is the emulator inside Light Touch.
Machine (-M) |
Device | SoC | Board docs |
|---|---|---|---|
iPod-Touch-1G |
iPod touch (1st gen, n45ap) | S5L8900 | docs/ipod1g/README.md |
iPhone-2G |
iPhone (m68ap) | S5L8900 | docs/m68/README.md |
iPod-Touch |
iPod touch (2nd gen, n72ap) | S5L8720 | docs/capabilities.md, docs/ipod/ |
n18 |
iPod touch (3rd gen, n18ap) | S5L8922 | docs/n18/README.md |
n88 |
iPhone 3GS (n88ap) | S5L8920 | docs/n88/README.md |
iPod-Touch-4G |
iPod touch (4th gen, n81ap) | A4 (S5L8930) | docs/n81/README.md |
iPhone-4 |
iPhone 4 GSM (n90ap) | A4 (S5L8930) | docs/n90/README.md |
iPhone-5 |
iPhone 5 (n42ap) | A6 (S5L8950) | docs/n42/README.md |
ipad1 |
iPad (k48ap) | A4 (S5L8930) | docs/ipad1/README.md |
Which firmware builds each board runs, and how well, is tracked in Light Touch's firmware catalog
(LightTouchMac/Resources/firmware-catalog.json): every build is prepared from Apple's stock IPSW.
Shared between the boards: the host GL executor (hw/arm/gles-host*.c), the guest-service hypercalls
(hw/arm/guest-services.c, guest-gles.c, guest-pasteboard.c, guest-package.c), the typed guest
agent RPC (hw/arm/ipod-agent.c) and the baseband model (hw/misc/ios_baseband*.c, docs/baseband/).
Light Touch is three repositories: this emulator; the macOS app
LightTouchMac, which links it as libqemu-arm.dylib
and ships the guest tools built from contrib/; and a usbmuxd fork
(branch idle-poll) that carries the emulated USB device to libimobiledevice (docs/tcp-usb-protocol.md
is the wire contract).
| Path | What |
|---|---|
hw/arm/, include/hw/arm/ |
The three machines and their peripherals, plus the shared host pieces above |
contrib/it-* |
Guest helpers for the iPod (armv6, built with contrib/armv6-toolchain): it-agent (the guest agent), it-gles (MBX GL shim), it-boot (guest-package loader), it-pasteboard, it-media, it-keybag, it-seal, … each with its own README |
contrib/gles-public, contrib/ipad1-guest, contrib/appsync |
the GL front end (one OpenGLES.framework replacement for every 2.x-5.x firmware, iPad and iPod; docs/ipad1/gles-public-seam.md); iPad-side helpers: ipad1-guest/build.sh builds it_pbd (pasteboard bridge) and the other iPad helpers for armv7 from the shared sources; the AppSync interposer dylib |
contrib/guest-package |
mkpkg.c and VERSION: the versioned guest-tools package format the loader installs at boot |
contrib/macos-app |
make-dylib-macos.sh (the app's dylib), entitlements.plist (the app's helper entitlements), ipod-helper.c (the app's ipa-chmod) |
imgtools/lldb |
lldb scripting for guest debugging (xnu.py). Devices are made by LightTouchMac's Swift FirmwareKit: firmwarekit create --catalog CATALOG --id BOARD-BUILD --ipsw IPSW --out OUT (CATALOG: LightTouchMac's LightTouchMac/Resources/firmware-catalog.json; k48ap and 4.x n72ap also take --helper with the LightTouchDevice executable) |
tests/slice/, tests/ipod/, tests/ipad1/, tests/guest-package/, tests/lint/ |
The gates below |
scripts/ccninja, scripts/configure-patched-ffmpeg |
Build helpers |
docs/ |
Ours are the .md files; the .rst/.txt tree is upstream QEMU's. See "Documentation" |
Firmware, images and the private work area (~/Developer/qemu-ios-files) are never in the repository.
Configure against the patched FFmpeg, not Homebrew's: the iPod H.264 bridge needs
contrib/ffmpeg/h264-chunk-er.patch, and a tree linked against stock FFmpeg fails
tests/slice/ipod-h264-slices.c while looking identical. The helper defaults
FFMPEG_PREFIX to the prefix ~/Developer/qemu-ios/build-native14 was built with.
mkdir build && cd build
../scripts/configure-patched-ffmpeg # meson configure: arm-softmmu, headless (no SDL)
../scripts/ccninja qemu-system-arm # ninja through ccache, one cache for every worktreescripts/ccninja puts Homebrew's ccache masquerade directory on PATH (the configured compiler is bare
cc) and sets CCACHE_BASEDIR=~/Developer, so a fresh worktree builds in seconds at a warm cache.
The app's library is a relink of the same objects: contrib/macos-app/make-dylib-macos.sh BUILD_DIR
writes BUILD_DIR/libqemu-arm.dylib, exporting only the qemu_ios_* ABI. LightTouchMac's
Configuration/Shared.xcconfig points QEMU_IOS_DIR/QEMU_BUILD_DIR at a checkout and such a build
directory.
The contract with LightTouchMac is contrib/export-guest-artifacts.sh OUT [BUILD_DIR]: it builds every
guest component from a copy of contrib/* (through contrib/guest-package/build.sh, so the checkout is
never written) and stages what the app consumes — guest-tools/ (the iPod set), ipad-guest-tools/ (the
flat set firmwarekit reads: helpers, AppSync, the two GL engines with gles-names.h, the .itpacks
at contrib/guest-package/VERSION's serial), macos-app/entitlements.plist, include/, and with a build
directory dylib/libqemu-arm.dylib — with manifest.json (source commit, branch, dirty flag, sha256 of
every input and every staged file). LightTouchMac pins this repository by commit in
build-support/sources.json; its scripts/build-guest-tools.sh is a thin caller of the export, and its
release build validates the staged tree against the manifest. Bump the pin when the guest tools, the
helper ABI or the entitlements change.
One command, three tiers:
tests/gate.sh --quick # host only: every tests/slice/*.c, tests/*/*-test.sh and the GL name table check, in parallel
tests/gate.sh --models # the device qtests and test-ios-baseband from the build next to QEMU
tests/gate.sh --all # bothOne line per check (PASS or FAIL with seconds); non-zero exit on any FAIL; every log under the printed
directory. QEMU= overrides the emulator (default build/qemu-system-arm).
| Gate | What it covers | Inputs |
|---|---|---|
tests/slice/run.sh tests/slice/<board>-<name>.c |
Host-only unit checks, one file each: the SLICE lines at the top name the code under test, compiled under ASan/UBSan |
No emulator |
tests/*/*-test.sh |
Guest-package, toolchain and loader checks; the guest-values lint ("Guest values" below) | No emulator |
Boots of prepared devices are LightTouchMac's: swift run --package-path tests/sessions sessions single <BASE>
(also phone, local-network, proxy-trust, helper), and its Release plan's prepare matrix (firmwarekit create on each route, then a boot). Every headless boot passes -audio driver=none.
The export for the app (contrib/export-guest-artifacts.sh, "Build" above) is gated on the LightTouchMac side:
its scripts/build-guest-tools.sh runs the export from the commit pinned in build-support/sources.json
and scripts/vendor checks the staged tree against manifest.json; a pin bump is a LightTouchMac commit.
The guest is untrusted: anything it writes can be chosen to hurt the host, and a host write out of bounds runs code as the user. So in every device model and guest service:
- Every index, length, offset and count the guest wrote (a register or bus write, a descriptor or buffer read from
guest memory, an AT command's number, a value another model took from the guest) is bounded before its first use
as an array index, a copy or allocation length, a guest-memory read's length into a host buffer, a loop bound, or
an MMIO handler's offset. Use
IT_IDX,IT_SIZEorIT_RANGE(include/hw/arm/ipod_touch_guard.h) or an explicit test; do size arithmetic in 64 bits or check it for overflow. - Never call an MMIO handler with a guest offset; the memory region's size is the only thing that bounded it.
- Every host allocation whose size the guest drives has a per-device cap (a named constant), and so does every queue the guest can fill without draining.
- No
exit(),abort(),hw_error()org_asserton a path the guest can reach: log atLOG_GUEST_ERRORand refuse the operation. - Copies to and from guest virtual memory go through
guest_copy(hw/arm/guest-services.c), which honors the calling mode's page permissions.
tests/lint/guest-bounds.py (in tests/gate.sh --quick, via tests/lint/guest-bounds-test.sh) follows guest
values through each file and flags an unchecked use. A use it can't see is bounded takes a /* bounded: why */
comment naming the bound.
| Where | What |
|---|---|
docs/capabilities.md |
The iPod board: what works, where it stops, how to verify |
docs/ipad1/README.md |
The iPad board: Sam's principles (vanilla guest, IPSW-agnostic guest changes, Wi-Fi default), the definition of done, the audio and Bluetooth notes, and the index of docs/ipad1/ (iboot.md, wifi.md, usb-keyboard.md, ios4.md, location.md, guest-services.md, app-compat*.md, addresses-7B500.md) |
docs/ipod/ |
from-ipsw.md (the manifest pipeline for the iPod), the 7E18 hardware notes (pmu-7e18.md, ipod-pke.md, ipod-clcd-irqs.md, ipod-native-halt.md, nor-transactions.md), and nand-current-new-verification.md (the staged iPod image, kept until the image swap at the main merge) |
docs/configuration.md |
Typed machine properties and their IT_* aliases |
docs/tcp-usb-protocol.md |
The tcp_usb wire protocol shared with the usbmuxd fork |
docs/networking.md, docs/stock-service-protocol.md, docs/app-ledger.md |
Guest networking and the built-in proxy; the Weather/Stocks gateway; the iPod app ledger |
contrib/*/README.md, imgtools/README-appsync.md |
Per-tool notes |
docs/research/ |
Research that preceded the code (the A4 gap/reference reports, the 7B500 userland and GL notes, the Bluetooth keyboard scoping, the iPod media investigation, the run-on-an-iPhone study). Each file starts with what superseded it |
docs/archive/ |
Superseded plans still cited from code: the iPad milestone plan and the guest-services plan |
docs/ipad1/*.tsv and docs/ipod/*.tsv are GL dispatch tables, build inputs contrib/export-guest-artifacts.sh
stages for LightTouchMac (moving them out of docs/ is on another track). docs/ipad1/screens/
holds the iPad evidence screenshots; put new evidence in qemu-ios-files instead.
QEMU-iOS is built on QEMU and grew out of devos50's
qemu-ios, the emulator for the iPod touch 1G and 2G. devos50's
write-ups are still the best introduction to the S5L8720 peripherals:
running the iPod touch 1G and
the reverse-engineering process. RUNNING.md
is upstream's iPod touch 2G guide, kept with a note on what still applies.
Like QEMU, this repository is licensed under the GNU General Public License version 2 (COPYING); some
files carry other compatible licenses in their headers (LICENSE explains QEMU's licensing). No Apple
firmware is part of the repository.