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

README: what a QEMU run looks like (black first, then the logo, then the lock screen) and what to check if it stays black

shimoku6e3faca67d25
diff --git a/README.md b/README.md
index 1cb5c1f..6115df3 100644
--- a/README.md
+++ b/README.md
@@ -76,14 +76,28 @@ Linux x86-64, about 12 GB of disk, 7-Zip 23 or newer, `lz4`, `qemu-system-aarch6
```sh
git clone https://github.com/oosexgang/hackios-xnu-kernel.git hakios
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
mkdir -p logs
qemu/run-ios.sh 1200 -display gtk > logs/qemu.log # a 20-minute session
```
-The lock screen appears after two or three minutes. The mouse with the button held is a finger;
-`H` is Home, `L` is the power button, `↑`/`↓` are volume.
+**What you will see.** The CPU is emulated, so it is slow, and the window is **black at first**: that is normal.
+Black for the first minute or two, then the Apple logo, then the lock screen after about 3 to 10 minutes, depending on
+the machine. The mouse with the button held is a finger; `H` is Home, `L` is the power button, `↑`/`↓` are volume.
+
+**If it stays black** (check these in order):
+
+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.
+3. No window or a black one although the log runs: your QEMU may have no GTK window (a headless package, WSL without WSLg).
+ Use `qemu/run-ios.sh 1200 -display vnc=127.0.0.1:0 > logs/qemu.log` and connect a VNC viewer to `127.0.0.1:5900`.
+4. The guest asks QEMU for 7 GB of memory (`QEMU_RAM_GB`; 6 at the very least, the system image sits 3 GB into it and is 2.5 GB). On a machine without that, the host swaps and
+ everything is very slow; close other programs or give the VM or WSL more memory.
+5. `qemu/run-ios.sh` needs the images from the two steps above (`userland/system.apfs` and `userland/root.apfs`): a
+ missing one is reported at once, not as a black window.
## On the phone
diff --git a/README.uk.md b/README.uk.md
index 4456d95..9334c7b 100644
--- a/README.uk.md
+++ b/README.uk.md
@@ -76,13 +76,21 @@ Linux x86-64, близько 12 ГБ на диску, 7-Zip 23 або новіш
```sh
git clone https://github.com/oosexgang/hackios-xnu-kernel.git hakios
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 qemu # сеанс на 20 хвилин
```
-Екран блокування з'являється за дві-три хвилини. Миша з затиснутою кнопкою — палець; `H` —
-«Додому», `L` — кнопка живлення, `↑`/`↓` — гучність.
+**Що ви побачите.** Процесор емульований, тож повільно, а вікно спочатку **чорне**: це нормально. Перша-друга хвилина
+чорного екрана, потім логотип Apple, потім екран блокування приблизно за 3–10 хвилин залежно від комп'ютера. Миша з
+затиснутою кнопкою — палець; `H` — «Додому», `L` — кнопка живлення, `↑`/`↓` — гучність.
+
+**Якщо екран лишається чорним:** (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-клієнт на
+`127.0.0.1:5900`; (4) гість просить у QEMU 7 ГБ пам'яті (мінімум 6): на меншій пам'яті все дуже повільно.
## На телефоні
diff --git a/README.zh.md b/README.zh.md
index 549742c..f196a59 100644
--- a/README.zh.md
+++ b/README.zh.md
@@ -68,12 +68,20 @@ Linux x86-64,约 12 GB 磁盘,7-Zip 23 或更新,`lz4`,`qemu-system-aarc
```sh
git clone https://github.com/oosexgang/hackios-xnu-kernel.git hakios
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 qemu # 20 分钟的会话
```
-两三分钟后出现锁屏。按住鼠标键就是手指;`H` 是主屏键,`L` 是电源键,`↑`/`↓` 是音量。
+**你会看到什么。** CPU 是模拟的,所以很慢,窗口一开始是**黑的**,这是正常的:先黑一两分钟,然后出现 Apple 标志,
+再过大约 3 到 10 分钟(取决于机器)出现锁屏。按住鼠标键就是手指;`H` 是主屏键,`L` 是电源键,`↑`/`↓` 是音量。
+
+**如果一直是黑屏:** (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`。
+(4) 虚拟机向 QEMU 要 7 GB 内存(至少 6 GB),内存不足时会非常慢。
## 在手机上