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

metal-run: an argument in MORE takes a default's place; the markers out of the documents; scripts executable

yehorkaab68c02485020
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e48d8cf..4732713 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -23,7 +23,7 @@ changes to it; the scripts named fetch the release and put the changes on.
- metal: 120 frames a second is not reached: hakios-metal 101 in page swipes, 109 in Settings' scroll, 92 at the home button, 4% of frames over 16.7 ms; after the finger lifts, 185 of a swipe's 205 frames take 8.3 ms, while it drags 75 to 80 a second; `docs/reference/metal-measurements.md`
- springboard: `wallpaper_freeze=1` makes the wallpaper one picture, from the IOSurface on the panel (`kern.hakios.fb_surface`): home button 92 frames a second, against 28 with `wallpaper_cache=1` and 50 without either; the icons blink once, the wallpaper does not change until the next boot, and the lock screen shows the same picture
-- windows: `tools/metal-run.sh` sets `wallpaper_freeze=1` and `metal_defer=1`; `MORE` cannot turn them off
+- windows: `tools/metal-run.sh` sets `wallpaper_freeze=1` and `metal_defer=1`; an argument in `MORE` takes the place of a default of the same name
- metal: 250 touch samples a second instead of 125 change nothing (100 to 102); `touch_poll_us` stays 4000 in `tools/metal-run.sh`
- display: `fb_beam=1`, the default: each thread's rows are written behind the panel's scan line (2433 lines, 8338 us), and to the eye the moving bands are gone; it costs no frames (Settings' scroll 109 against 89, home button 92 against 81, swipes 101 against 99)
- docs: a short README and a front page by what you came to do; `docs/reference/metal.md` and its measurements; every boot-argument of both Metal paths in the catalogue (`tools/boot-args.py` reads `hm_boot_arg_set`)
diff --git a/README.md b/README.md
index c554bec..4511c12 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,7 @@ Android.
**News, 4 November 2026:** on the POCO X5 Pro 5G the window server draws through Metal on the Adreno 642L, two ways. hakios-metal: page
swipes 100 to 104 frames a second, Settings' scroll 109, the home button 92. UniXNU's Metal on Vulkan: swipes 50 to 57, scroll 41. The panel is 120 Hz,
and **120 frames a second has not been reached**. [Metal on the Adreno](docs/reference/metal.md),
-[the measurements](docs/reference/metal-measurements.md). <!-- FINAL-NUMBERS -->
+[the measurements](docs/reference/metal-measurements.md).
Start with [Getting started](docs/getting-started/index.md), [On the phone](docs/getting-started/phone.md) or
[Port a device](docs/porting/index.md). What works, part by part: [the documentation's front page](docs/index.md#what-works).
diff --git a/README.uk.md b/README.uk.md
index 132df64..4013b78 100644
--- a/README.uk.md
+++ b/README.uk.md
@@ -12,7 +12,7 @@
**Новини, 4 листопада 2026:** на POCO X5 Pro 5G віконний сервер малює через Metal на Adreno 642L, двома шляхами. hakios-metal: гортання
сторінок 100–104 кадри на секунду, прокручування в Settings 109, кнопка «додому» 92. Metal поверх Vulkan від UniXNU: гортання 50–57, прокручування 41.
Панель працює на 120 Гц, і **120 кадрів на секунду не досягнуто**. [Metal на Adreno](docs/reference/metal.md),
-[вимірювання](docs/reference/metal-measurements.md). <!-- FINAL-NUMBERS -->
+[вимірювання](docs/reference/metal-measurements.md).
Почніть із [Getting started](docs/getting-started/index.md), [On the phone](docs/getting-started/phone.md) або
[Port a device](docs/porting/index.md). Що працює, по частинах: [головна сторінка документації](docs/index.md#what-works).
diff --git a/README.zh.md b/README.zh.md
index 68db6d5..c5e8fd6 100644
--- a/README.zh.md
+++ b/README.zh.md
@@ -6,7 +6,7 @@
**文档:** [docs/](docs/index.md)(英文),以及网站 [hackios-web.vercel.app](https://hackios-web.vercel.app)。
-**动态,2026 年 11 月 4 日:** 在 POCO X5 Pro 5G 上,窗口服务器通过 Metal 在 Adreno 642L 上绘制,有两条路径。hakios-metal:翻页每秒 100 至 104 帧,Settings 滚动 109 帧,主屏幕按钮 92 帧。UniXNU 的 Metal on Vulkan:翻页 50 至 57 帧,滚动 41 帧。屏幕是 120 Hz,**尚未达到每秒 120 帧**。[Adreno 上的 Metal](docs/reference/metal.md),[测量结果](docs/reference/metal-measurements.md)。<!-- FINAL-NUMBERS -->
+**动态,2026 年 11 月 4 日:** 在 POCO X5 Pro 5G 上,窗口服务器通过 Metal 在 Adreno 642L 上绘制,有两条路径。hakios-metal:翻页每秒 100 至 104 帧,Settings 滚动 109 帧,主屏幕按钮 92 帧。UniXNU 的 Metal on Vulkan:翻页 50 至 57 帧,滚动 41 帧。屏幕是 120 Hz,**尚未达到每秒 120 帧**。[Adreno 上的 Metal](docs/reference/metal.md),[测量结果](docs/reference/metal-measurements.md)。
从 [Getting started](docs/getting-started/index.md)、[On the phone](docs/getting-started/phone.md) 或 [Port a device](docs/porting/index.md) 开始。各部分的工作情况:[文档首页](docs/index.md#what-works)。
diff --git a/docs/comparison.md b/docs/comparison.md
index bead125..15210c8 100644
--- a/docs/comparison.md
+++ b/docs/comparison.md
@@ -12,7 +12,7 @@ documentation, at its commit `c1ecc5b`); they change, so read theirs, and tell u
| Hardware | Redmi Note 10 Pro (SM7150) | Xiaomi Pad 6S Pro (SM8550) as the reference; 234 device entries in its `devices.toml`, many of them other people's ports (how far each goes: its own pages) | Poco F1 (SDM845) | POCO X5 Pro 5G (SM7325), the Infinix Hot 20 (MT6768, [a port of its own](https://github.com/oosexgang/hakios-mt6768)), and a generator for a new device from its own device tree |
| Kernel | Apple's open xnu-8796 | by OS profile: xnu-10063.141.1 for an arm64 profile; an arm64e series for newer ones | xnu-11215 ("Heartwood") | Apple's open xnu-8796.121.2 |
| Boot | `fastboot boot` of a shim; HFS+ root in `userdata` | UEFI | its own bootloader from `boot` | `fastboot boot` (RAM only); U-Boot in `boot_a` beside Android ([installing](dual-boot.md)); or a UEFI loader that reads its payload from the volume it was started from (tested in QEMU; not yet on a phone) |
-| GPU | none: drawn by the CPU, 20 to 30 frames a second by its page | Metal on Vulkan on the Adreno 740: [AdrenoMetal](https://github.com/UniXNU/AdrenoMetal), metal2vulkan, Turnip, its own kernel driver | none yet: drawn by the CPU; the Adreno 630 is in progress | Adreno 642L: OpenGL ES through Mesa by default; Metal for the window server, by a direct path and by a port of UniXNU's ([numbers](reference/metal-measurements.md): 100 to 104 frames a second at best in page swipes, not 120) <!-- FINAL-NUMBERS --> |
+| GPU | none: drawn by the CPU, 20 to 30 frames a second by its page | Metal on Vulkan on the Adreno 740: [AdrenoMetal](https://github.com/UniXNU/AdrenoMetal), metal2vulkan, Turnip, its own kernel driver | none yet: drawn by the CPU; the Adreno 630 is in progress | Adreno 642L: OpenGL ES through Mesa by default; Metal for the window server, by a direct path and by a port of UniXNU's ([numbers](reference/metal-measurements.md): 100 to 104 frames a second at best in page swipes, not 120) |
| Licence of its code | MIT | BSD-2-Clause-Patent | none stated on the page | MIT; kernel changes APSL 2.0 |
| Says it ships Apple binaries | no | not stated | no | no, and CI fails if a binary of a kind that cannot be ours is added |
diff --git a/docs/index.md b/docs/index.md
index bf3cf54..8a6d34d 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -6,7 +6,7 @@ phone's.
**Where it stands.** The POCO X5 Pro 5G runs the Darwin 16.5 user space you lay out yourself, and its window server draws through Metal
on the Adreno 642L, at 100 to 104 frames a second in page swipes on a 120 Hz panel. 120 has not been reached: [the measurements](reference/metal-measurements.md).
-<!-- FINAL-NUMBERS -->
+
## Guide: run it
diff --git a/docs/metal-plan.md b/docs/metal-plan.md
index ecd3136..396eb7c 100644
--- a/docs/metal-plan.md
+++ b/docs/metal-plan.md
@@ -3,7 +3,7 @@
**Where it stands, 4 November 2026.** The window server draws through Metal on the phone, on two paths, and the plan below is done as far
as that: hakios-metal at 100 to 104 frames a second in page swipes (109 in Settings' scroll), UniXNU's Metal on Vulkan at 50 to 57, on a 120 Hz panel. 120 has not
been reached. What to read now: [Metal on the Adreno](reference/metal.md) and [the measurements](reference/metal-measurements.md).
-Everything below the next section is the record of how it went, with the dates, and says what was known then. <!-- FINAL-NUMBERS -->
+Everything below the next section is the record of how it went, with the dates, and says what was known then.
## What became of the plan
diff --git a/docs/reference/metal-measurements.md b/docs/reference/metal-measurements.md
index 2fabd7e..5cf20e2 100644
--- a/docs/reference/metal-measurements.md
+++ b/docs/reference/metal-measurements.md
@@ -19,7 +19,7 @@ been reached**: not on hakios-metal, not on metal2vulkan, and not on OpenGL ES.
Frames a second, 3 and 4 November 2026. hakios-metal as the last run of 4 November had it: `wallpaper_freeze=1 metal_defer=1 fb_beam=1`.
metal2vulkan as measured on 3 November, before those.
-<!-- FINAL-NUMBERS -->
+
| Motion | hakios-metal | metal2vulkan |
|---|---|---|
@@ -98,7 +98,7 @@ the bands in its pictures are 243 rows apart.
It costs no frames. The same run otherwise, 4 November:
-<!-- FINAL-NUMBERS -->
+
| | `fb_beam=1` | `fb_beam=0` |
|---|---|---|
diff --git a/docs/reference/metal.md b/docs/reference/metal.md
index 71d2f2f..12a5cf4 100644
--- a/docs/reference/metal.md
+++ b/docs/reference/metal.md
@@ -7,7 +7,7 @@ measure it, and what is not known. The numbers: [Metal measurements](metal-measu
**Status, POCO X5 Pro 5G, 3 and 4 November 2026.** Both paths draw the system correctly. hakios-metal is the faster: page swipes 100
to 104 frames a second, Settings' scroll 109, the home button 92. metal2vulkan: swipes 50 to 57, scroll 41. **120 frames a second has not been
reached on either.** Neither is on by default: without `metal=1` the window server draws through OpenGL ES, as it always has.
-<!-- FINAL-NUMBERS -->
+
## The two paths
@@ -150,9 +150,7 @@ crash. It sets `gpu=1 metal=1 metal_fps=1 touch_lat=1 touchscreen=1 gpu_recover=
fb_measure=1 fb_threads=6 touch_poll_us=4000 wallpaper_freeze=1 metal_defer=1`, the path of QuartzCore's library, and (unless `PERSIST=0`) `ufs=2 ufs_write=1
var_store=1`, which keeps `/private/var` in your `darwin` partition so that shader stages are compiled once.
-`MORE=` adds arguments at the end. The kernel's are its own to resolve, but the plug-in's and SpringBoard's are found with `strstr`, which
-takes the first of a name: `MORE` cannot turn off the script's `wallpaper_freeze=1` or `metal_defer=1`, and to run without them, change
-`ARGS` in the script.
+`MORE=` adds arguments at the end, and a default of the same name goes: `MORE="wallpaper_freeze=0 metal_defer=0"` runs without those two.
`tools/frames.py RUN.log [MORE.log ...]` on its own reads the `tl:` lines of `touch_lat=1`. For each gesture it gives the frames a
second while frames came, the share of frame steps over 16.7 ms, 33 ms and 8.3 ms, and where a slow frame's time went. A window server
diff --git a/docs/ru/metal.md b/docs/ru/metal.md
index c7b6262..1a073cb 100644
--- a/docs/ru/metal.md
+++ b/docs/ru/metal.md
@@ -8,7 +8,7 @@
> `default.metallib` снята не плагином: `tools/ca-metallib.py` делает эту библиотеку на вашей машине из того, что вы даёте сами. Что
> осталось верным: игры не заявляются (раздел 9.4), драйвер AGX переиспользовать нельзя. Сборка, аргументы
> загрузки, измерения: [Metal on the Adreno](../reference/metal.md), [Metal measurements](../reference/metal-measurements.md). Всё ниже — запись того,
-> что было известно на те даты. <!-- FINAL-NUMBERS -->
+> что было известно на те даты.
Разбор: что в Darwin userland 16.5 просит Metal, где проходит граница, которую пришлось бы реализовать, и
стоит ли её переходить. Всё, что ниже, проверено по извлечённой системе
diff --git a/tools/ca-metallib.py b/tools/ca-metallib.py
old mode 100644
new mode 100755
diff --git a/tools/merge_metallib.py b/tools/merge_metallib.py
old mode 100644
new mode 100755
diff --git a/tools/metal-run.sh b/tools/metal-run.sh
index 3d2f28f..5d6698d 100755
--- a/tools/metal-run.sh
+++ b/tools/metal-run.sh
@@ -4,14 +4,14 @@
#
# tools/metal-run.sh the run (the phone may be in Android, in its bootloader or in the loader)
# SECS=180 tools/metal-run.sh its length in seconds (default 180: the bench's four rounds; see rc.jobs.bench)
-# MORE="metal_gmem=1" tools/... boot-args beside the ones below (a later one of the same name wins)
+# MORE="metal_gmem=1" tools/... boot-args beside the ones below; one of the same name takes a default's place
# PERSIST=0 tools/metal-run.sh without var_store: /private/var starts empty and nothing is written to darwin
# UPLOAD=0 tools/metal-run.sh keep the system image already in the phone's RAM (default: upload this copy's)
# SHOTS=N a screenshot every N seconds during the run into logs/<stamp>-shots/ (default 0)
# VERBOSE=1 tools/metal-run.sh with -v: the kernel's text console drawn over the picture (off by default: the log has it all)
#
# What it needs, built in WSL (docs/windows.md) and copied here: userland/root.apfs and userland/system.apfs from
-# METAL_PLUGIN=ca RC_JOBS=rc.jobs.bench EXTRA_SHARE=<dir of QuartzCore-default.metallib> PREBUILT=1 REST=1 SYSTEM=1 userland/build.sh
+# METAL_PLUGIN=ca RC_JOBS=rc.jobs.bench EXTRA_SHARE=<dir of QuartzCore-default.metallib> REST=1 SYSTEM=1 userland/build.sh
# (tools/ca-metallib.py writes that file; off a Mac with CA_QC_METALLIB=...). The kernel: hakios-kernel, else prebuilt/.
#
# Boot-args, and why each:
@@ -61,6 +61,14 @@ CA_METALLIB=${CA_METALLIB:-/redwood/share/ca-share/QuartzCore-default.metallib}
ARGS="gpu=1 metal=1 metal_fps=1 touch_lat=1 touchscreen=1 ca_metallib=$CA_METALLIB gpu_recover=1 anim_max=1 bootcpu=7 cpus=8 cpufreq=1 fb_hz=120 fb_measure=1 fb_threads=6 touch_poll_us=4000 wallpaper_freeze=1 metal_defer=1"
[ "$PERSIST" = 1 ] && ARGS="$ARGS ufs=2 ufs_write=1 var_store=1"
[ "${VERBOSE:-0}" = 1 ] && ARGS="-v $ARGS"
+# (a default of the same name goes: the kernel takes the last of two, the plug-in and SpringBoard the first)
+for more in ${MORE:-}; do
+ kept=
+ for word in $ARGS; do
+ [ "${word%%=*}" = "${more%%=*}" ] || kept="$kept $word"
+ done
+ ARGS=$kept
+done
ARGS="$ARGS ${MORE:-}"
stamp=$(date +%H%M%S)
mkdir -p logs
diff --git a/userland/mkhighrate.py b/userland/mkhighrate.py
old mode 100644
new mode 100755