Skip to content
kieroidPublic

Latest commit

 

History

207 Commits

Folders and files

Repository files navigation

Bad Apple

Mainline Linux on the Apple A12 (T8020), tested on the iPhone XS Max. The iPhone XR boots too (BOARD=n841). Boots from DFU through a jig or a PC, with postmarketOS on the NVMe. Hardware notes are in docs.

Written with help from an LLM, including the reverse engineering of Apple firmware, so this is not clean-room work. Human reviewed and tested on real hardware.

Boot chain

SecureROM, pwned by usbliter8
  -> patched iBSS
  -> device tree, empty trustcache, coprocessor firmware
  -> m1n1, in place of a restore kernelcache
  -> Linux, 16K pages

With the jig, a small m1n1 loads the newest .bin from a FAT partition on the NVMe instead, so no PC is needed.

Dependencies

Host For
clang, ld.lld kernel and m1n1
Rust with rust-src m1n1
dtc, cpp make check
python3 tools/
git, curl, unzip make deps, make initramfs
ipsw the IPSW and img4
irecovery recovery mode
germin8 on a Waveshare RP2350-USB-A pwned DFU, booting without a PC

And an iPhone11,6 IPSW.

Build

make deps     # clone the trees, apply patches/
make images IPSW=/path/to/unpacked/ipsw IPSW_FILE=/path/to.ipsw
make boot     # build the rest and boot

make images runs once. IPSW_FILE is the .ipsw itself, for the wifi firmware in its root image.

For the GPU, run make ticket TICKET_IPSW=/path/to/signed.ipsw with the phone in DFU before make images. iBoot loads coprocessor firmware only with a ticket for your phone.

Run

From a PC: put the phone in DFU on the jig and hold BOOTSEL for a second to run only the exploit. Move the cable to the PC and run make boot.

From the NVMe: see postmarketOS.

Either way the phone shows up as 05ac:4142 with telnet on 172.16.42.1. tools/tsh.py "cmd" runs one command. The first USB attach often fails and retries, so give it a minute.

Status

Display Touch USB Storage SMP cpufreq Wifi Bluetooth GPU Audio Sensors Camera Cellular
✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ 🚧 🚧 🚧 ❌ ❌

Full list in docs.

License

GPL-2.0+ OR MIT, see LICENSE. patches/linux-* are GPL-2.0, patches/m1n1-* MIT. Dependencies are in NOTICES.md.