Skip to content

Apple's open-source XNU kernel on Android phones: its own loader and drivers, Metal on the Adreno. Runs from RAM; a reboot gives the phone back to Android.

C

prebuilt/loader.efi carries no Apple data; the iOS run builds its own loader (make loader)

shimokuea5418a33006
diff --git a/README.md b/README.md
index 6115df3..ebf4199 100644
--- a/README.md
+++ b/README.md
@@ -38,7 +38,7 @@ Only my code and my data:
files (`xnu/files/`, `drivers/`), laid over a fresh clone by `xnu/apply.sh`;
- the boot loader (`xnuloader/`), my programs and libraries (`userland/src/`), tools (`tools/`),
build and run scripts;
-- `prebuilt/`: the kernel, loader and libraries built from this repository;
+- `prebuilt/`: the kernel, loader and libraries built from this repository (the loader is built **without** any Apple data: `make loader` makes the one that starts iOS, on your machine, from your own IPSW);
- `devices/redwood/`: what one phone needs (its UEFI port, device tree, firmware script).
Not in the repository, never:
@@ -79,6 +79,7 @@ cd hakios
make doctor # what this machine lacks (QEMU's display device, UEFI firmware, memory), and what to do
sysimage/fetch.sh # the iOS 16.5 IPSW from Apple's servers, the needed parts unpacked (7.4 GB)
REST=1 userland/build.sh # the APFS images: userland/root.apfs and userland/system.apfs
+make loader # the boot loader, with the iPhone's identity taken from YOUR copy of the IPSW (needs clang and lld)
mkdir -p logs
qemu/run-ios.sh 1200 -display gtk > logs/qemu.log # a 20-minute session
```
@@ -89,6 +90,8 @@ the machine. The mouse with the button held is a finger; `H` is Home, `L` is the
**If it stays black** (check these in order):
+0. Did you run `make loader`? `prebuilt/loader.efi` has no Apple data in it on purpose (it boots the open kernel only), and with it
+ iOS does not start: `qemu/run-ios.sh` now refuses to run without your own `xnuloader/loader.efi` and says so.
1. `tail -f logs/qemu.log` in another terminal. It should print `== XNULOADER v3 ==` within seconds and kernel and launchd
lines after that. If it prints nothing, QEMU did not start the loader: run `make doctor`.
2. `qemu/screendump.sh` saves what the guest's screen shows (`logs/qemu-screen.png`), whatever your window does.
@@ -106,6 +109,7 @@ A phone with a port (`devices/redwood/`, POCO X5 Pro 5G), its boot loader unlock
```sh
devices/redwood/pull-firmware.sh # GPU, Wi-Fi, audio/battery, haptics, modem, cameras -> fw-*/
+make loader # (once, the quick start's step) the loader with the identity from your own IPSW
./xl enter # Android -> fastboot -> our loader in RAM
./xl ramdisk userland/system.apfs # the system image into the phone's RAM (~80 s), once per loader session
XL_SB_DELAY=8 XL_SECS=600 \
diff --git a/README.uk.md b/README.uk.md
index 9334c7b..a6a2790 100644
--- a/README.uk.md
+++ b/README.uk.md
@@ -79,6 +79,7 @@ cd hakios
make doctor # чого бракує цьому комп'ютеру (дисплей QEMU, UEFI, пам'ять) і що робити
make fetch # IPSW iOS 16.5 із серверів Apple, потрібне розпаковується (7,4 ГБ)
make images # образи APFS: userland/root.apfs і userland/system.apfs
+make loader # завантажувач з ідентичністю iPhone з ВАШОЇ копії IPSW (потрібні clang і lld)
make qemu # сеанс на 20 хвилин
```
@@ -86,7 +87,7 @@ make qemu # сеанс на 20 хвилин
чорного екрана, потім логотип Apple, потім екран блокування приблизно за 3–10 хвилин залежно від комп'ютера. Миша з
затиснутою кнопкою — палець; `H` — «Додому», `L` — кнопка живлення, `↑`/`↓` — гучність.
-**Якщо екран лишається чорним:** (1) `tail -f logs/qemu.log` в іншому терміналі: за секунди має з'явитись
+**Якщо екран лишається чорним:** (0) чи ви виконали `make loader`? У `prebuilt/loader.efi` навмисно немає даних Apple (він запускає лише відкрите ядро), з ним iOS не стартує; `qemu/run-ios.sh` без вашого `xnuloader/loader.efi` відмовляється працювати й каже про це; (1) `tail -f logs/qemu.log` в іншому терміналі: за секунди має з'явитись
`== XNULOADER v3 ==`, далі рядки ядра і launchd; якщо порожньо — запустіть `make doctor`; (2) `qemu/screendump.sh` зберігає
те, що показує екран гостя (`logs/qemu-screen.png`), що б не робило вікно; (3) якщо вікна немає або воно чорне, а журнал
іде — у вашому QEMU може не бути GTK (WSL без WSLg): `qemu/run-ios.sh 1200 -display vnc=127.0.0.1:0` і VNC-клієнт на
diff --git a/README.zh.md b/README.zh.md
index f196a59..50dd799 100644
--- a/README.zh.md
+++ b/README.zh.md
@@ -71,13 +71,14 @@ cd hakios
make doctor # 检查本机缺什么(QEMU 显示设备、UEFI 固件、内存)以及怎么办
make fetch # 从 Apple 服务器取 iOS 16.5 IPSW,解包所需部分(7.4 GB)
make images # APFS 镜像:userland/root.apfs 和 userland/system.apfs
+make loader # 引导程序,iPhone 的标识取自你自己的 IPSW 副本(需要 clang 和 lld)
make qemu # 20 分钟的会话
```
**你会看到什么。** CPU 是模拟的,所以很慢,窗口一开始是**黑的**,这是正常的:先黑一两分钟,然后出现 Apple 标志,
再过大约 3 到 10 分钟(取决于机器)出现锁屏。按住鼠标键就是手指;`H` 是主屏键,`L` 是电源键,`↑`/`↓` 是音量。
-**如果一直是黑屏:** (1) 在另一个终端运行 `tail -f logs/qemu.log`,几秒内应出现 `== XNULOADER v3 ==`,之后是内核和 launchd 的输出;
+**如果一直是黑屏:** (0) 你运行过 `make loader` 吗?`prebuilt/loader.efi` 里特意不含 Apple 的数据(它只能启动开放内核),用它 iOS 不会启动;没有你自己的 `xnuloader/loader.efi` 时 `qemu/run-ios.sh` 会拒绝运行并说明原因;(1) 在另一个终端运行 `tail -f logs/qemu.log`,几秒内应出现 `== XNULOADER v3 ==`,之后是内核和 launchd 的输出;
没有输出就运行 `make doctor`。(2) `qemu/screendump.sh` 会保存虚拟机屏幕当前的内容(`logs/qemu-screen.png`)。
(3) 日志在走但没有窗口或窗口全黑:你的 QEMU 可能没有 GTK(例如没有 WSLg 的 WSL),用
`qemu/run-ios.sh 1200 -display vnc=127.0.0.1:0`,再用 VNC 客户端连接 `127.0.0.1:5900`。
diff --git a/docs/legal-review.md b/docs/legal-review.md
index 8621e37..8f31457 100644
--- a/docs/legal-review.md
+++ b/docs/legal-review.md
@@ -95,6 +95,15 @@ the storefront `143469-2,8`, and notes that it fetched Apple's bag from `bag.itu
`init.itunes.apple.com` "by hand". `inject_fairplay.c` studies Apple's **FairPlay** daemon. iOS itself,
believing it is an iPhone X, also contacts Apple's servers on its own.
+**Status (27 October 2026).** The App Store and FairPlay experiments were removed from the tree earlier. The Apple data in the
+distributed loader is now gone too: `prebuilt/loader.efi` is built with the placeholder identity (`xnuloader/mkidentity.sh
+--placeholder`, no Apple device-tree data in it; checked by searching the binary for the iPhone model and board names), and
+`tools/update-prebuilt.sh` builds it that way in a temporary copy so that it cannot come back. The loader that starts iOS is built
+by the user (`make loader`), on their own machine, with the identity taken from **their** copy of the IPSW. **Still open:** the
+loader's own source writes two fixed device-tree values (`serial-number` "RDW00POCOX5P", `model-number` "MQAC2", in
+`xnuloader/loader.c`; the second is an Apple model code), and older commits of `prebuilt/loader.efi` in the git history still
+contain the earlier identity data (a history rewrite would be needed to remove them).
+
Whether any of that is unlawful depends on law I have not verified (terms of service, computer-misuse
statutes, DRM rules), but it plainly contradicts the stated promise, and touching FairPlay and the
store is what draws attention. **Fix:** keep these experiments out of the public repository (a private
diff --git a/prebuilt/SHA256SUMS b/prebuilt/SHA256SUMS
index 494d36a..ba1ca8e 100644
--- a/prebuilt/SHA256SUMS
+++ b/prebuilt/SHA256SUMS
@@ -1,7 +1,7 @@
Built 2026-10-25 22:53 from this tree.
03e794e8e1d389a6abb9bcd2431eaccf9747271ff8c1234922225718c70441e9 prebuilt/mach.development.bcm2837
-3de0d8b2095989a9a8f9f9679b8bec01d80bad38eee535d934d29b7b76fee984 prebuilt/loader.efi
+933ffdc460633b2d64bda82aab0ccdfb96feb6e27e69f9a70f3b805cb0573677 prebuilt/loader.efi
932c856c04e87611b16c872da37c461d572c6258da0202ecd875d91c29886e03 prebuilt/userland/HakiosAudio
45bffe2da6b2484836bd29074b39bd5cc67b4cdaa253c2aa39561ce5188d6ddc prebuilt/userland/child
35f3065e4602965911a20d0666a289cafba16644e611ea870d40bda81ea67546 prebuilt/userland/cpu_test
diff --git a/prebuilt/loader.efi b/prebuilt/loader.efi
index 7fcf2fc..91a47c8 100755
Binary files a/prebuilt/loader.efi and b/prebuilt/loader.efi differ
diff --git a/qemu/run-ios.sh b/qemu/run-ios.sh
index 60d5b87..e826710 100755
--- a/qemu/run-ios.sh
+++ b/qemu/run-ios.sh
@@ -36,6 +36,13 @@
cd "$(dirname "$(readlink -f "$0")")/.." || exit 1
K=xnu-src/xnu-8796.121.2/BUILD/obj/DEVELOPMENT_ARM64_BCM2837/mach.development.bcm2837
[ -f $K ] || { K=prebuilt/mach.development.bcm2837; echo "run-ios.sh: no kernel built here, using $K" >&2; }
+# iOS has to be told which iPhone it runs on, and that comes from the user's own IPSW, into the loader at build time
+# (xnuloader/mkidentity.sh). The loader in prebuilt/ has no Apple data, so with it iOS does not start, and the window stays black.
+if [ ! -f xnuloader/loader.efi ] && [ -z "$QEMU_PREBUILT_LOADER" ]; then
+ echo "run-ios.sh: no xnuloader/loader.efi: iOS needs the loader built with the identity of the iPhone from your own IPSW:"
+ echo " make loader (needs clang and lld; QEMU_PREBUILT_LOADER=1 to run with the one without Apple data anyway)"
+ exit 1
+fi
IMG=${IMG:-userland/system.apfs}
ROOT=${ROOT:-userland/root.apfs}
[ -f "$IMG" ] && [ -f "$ROOT" ] || { echo "run-ios.sh: $IMG or $ROOT is missing (userland/build.sh makes them)"; exit 1; }
diff --git a/tools/doctor.sh b/tools/doctor.sh
index ec566ec..5f1bacd 100755
--- a/tools/doctor.sh
+++ b/tools/doctor.sh
@@ -48,7 +48,7 @@ fi
if have cc || have clang; then ok "C compiler ($(have cc && echo cc || echo clang)): builds unzbm for sysimage/fetch.sh"; else need "no C compiler" "install clang or gcc"; fi
have git && ok "git" || bad "git not found" "install git"
-if have lld-link; then ok "lld-link: the boot loader can be built (xnuloader/build.sh)"; else warn "lld-link not found" "needed only to build the loader (apt: lld; brew: lld); prebuilt/loader.efi works without"; fi
+if have lld-link; then ok "lld-link: the boot loader can be built (xnuloader/build.sh)"; else warn "lld-link not found" "needed to build the boot loader with the iPhone identity from your own IPSW (make loader), which the iOS run needs (apt: lld; brew: lld); the open kernel (make qemu-open) runs with prebuilt/loader.efi, which has no Apple data"; fi
have lz4 && ok "lz4" || warn "lz4 not found" "needed by some image steps (apt: lz4)"
if have flock; then
diff --git a/tools/update-prebuilt.sh b/tools/update-prebuilt.sh
index e3f0f78..ae2dca1 100755
--- a/tools/update-prebuilt.sh
+++ b/tools/update-prebuilt.sh
@@ -9,7 +9,19 @@ K=${KERNEL:-xnu-src/xnu-8796.121.2/BUILD/obj/DEVELOPMENT_ARM64_BCM2837/mach.deve
MU=Mu-Silicium
mkdir -p prebuilt/userland devices/redwood/prebuilt
cp $K prebuilt/mach.development.bcm2837
-[ -f xnuloader/loader.efi ] && cp xnuloader/loader.efi prebuilt/loader.efi || echo "update-prebuilt.sh: no xnuloader/loader.efi here (lld-link); prebuilt/loader.efi kept"
+# The loader in prebuilt/ is built with the PLACEHOLDER identity (xnuloader/mkidentity.sh --placeholder: no Apple data), in a
+# temporary copy so that the real xnuloader/identity.h of this tree, made from your own IPSW, is left alone and never copied
+# here. It boots the open kernel (make qemu-open); to start iOS, build the loader yourself (make loader).
+if command -v lld-link >/dev/null && command -v clang >/dev/null; then
+ T=$(mktemp -d)
+ mkdir "$T/xnuloader"
+ cp xnuloader/loader.c xnuloader/efi.h xnuloader/build.sh xnuloader/mkidentity.sh xnuloader/mkidentity.py xnuloader/im4p.py "$T/xnuloader/"
+ ( cd "$T/xnuloader" && PLACEHOLDER=1 ./mkidentity.sh >/dev/null && ./build.sh >/dev/null ) && cp "$T/xnuloader/loader.efi" prebuilt/loader.efi ||
+ echo "update-prebuilt.sh: the placeholder loader did not build; prebuilt/loader.efi kept"
+ rm -rf "$T"
+else
+ echo "update-prebuilt.sh: no lld-link or clang here; prebuilt/loader.efi kept"
+fi
cp userland/hello prebuilt/userland/
for f in init child stage0 hello_dyn svc_test surf_test rwtouch mg_test cpu_test sound_test libhakios.dylib libhakios.sb.dylib \
libhakios.media.dylib libhakios.app.dylib libhakios.tweaks.dylib HakiosAudio net_test; do
diff --git a/xl b/xl
index e4eb9a8..20e9c6a 100755
--- a/xl
+++ b/xl
@@ -55,7 +55,10 @@ cd "$(dirname "$(readlink -f "$0")")" || exit 1
K=xnu-src/xnu-8796.121.2/BUILD/obj/DEVELOPMENT_ARM64_BCM2837/mach.development.bcm2837
[ -f $K ] || K=prebuilt/mach.development.bcm2837
L=xnuloader/loader.efi
-[ -f $L ] || L=prebuilt/loader.efi
+if [ ! -f $L ]; then
+ L=prebuilt/loader.efi
+ echo "xl: no xnuloader/loader.efi: using prebuilt/loader.efi, which has no iPhone identity in it (iOS will not start; make loader builds one from your own IPSW)" >&2
+fi
mkdir -p logs
# There is one phone, whichever working copy (tools/new-workspace.sh) talks to it: the locks are
# outside all of them.