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

Docs: a short README, a front page by what you came to do, the two Metal paths and what they measured

yehorkaaf7225063964a
diff --git a/CHANGELOG.md b/CHANGELOG.md
index eaddbc4..fc84447 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,12 +13,32 @@ changes to it; the scripts named fetch the release and put the changes on.
- the boot: [U-Boot](https://source.denx.de/u-boot/u-boot) `v2026.07` -- `hakios-uefi/u-boot/apply.sh`, the changes in `hakios-uefi/u-boot/hakios.patch` and `files/`; the device's part in `hakios-sm7325/u-boot/`
- the UEFI (the other way to start): [Project Silicium's Mu-Silicium](https://github.com/Project-Silicium/Mu-Silicium) at `e51cd877e31c` -- `hakios-uefi/apply.sh`
- the GPU's OpenGL ES: [Mesa](https://archive.mesa3d.org/) 25.0.7, the freedreno driver for the Adreno -- `tools/mk-mesa.sh`, the changes in `tools/mesa/`
+- the GPU's Vulkan: the same Mesa's Turnip -- `tools/mk-turnip.sh`, the changes in `tools/mesa/turnip-darwin.patch` and `tools/mesa/hakios-drm/`
+- Metal, the direct path: [hakios-metal](https://github.com/oosexgang/hakios-metal), beside this tree -- `userland/build.sh METAL_PLUGIN=ca`, with `userland/src/HakiosMetalCA.m`
+- Metal, on Vulkan: [UniXNU/AdrenoMetal](https://github.com/UniXNU/AdrenoMetal) at `243d63c` and [steelbrain/metal2vulkan](https://github.com/steelbrain/metal2vulkan) at `624bab3` with AdrenoMetal's 30 patches -- `tools/mk-m2v.sh`, the changes in `tools/m2v/`
- the build tools: Apple's [libdispatch](https://github.com/apple-oss-distributions/libdispatch), [libpthread](https://github.com/apple-oss-distributions/libpthread) and [AvailabilityVersions](https://github.com/apple-oss-distributions/AvailabilityVersions), [bootstrap_cmds](https://github.com/markmentovai/bootstrap_cmds), [unifdef](https://github.com/fanf2/unifdef), the [macOS 13.3 SDK](https://github.com/joseluisq/macosx-sdks) and the [iPhoneOS 16.5 SDK](https://github.com/theos/sdks) -- `xnu-deps/setup.sh`
- not fetched by anything here: the Darwin 16.5 user space, which you lay out from your own IPSW (`sysimage/`), and the phone's own firmware, pulled from its Android (`fw-*`)
+## 2026-11-04
+
+- metal: 120 frames a second is not reached: hakios-metal 100 to 104 in page swipes, about 90 in Settings' scroll and in opening an app, 28 at the home button with `wallpaper_cache=1`; 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`
+- 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: (PENDING, its commit is being tuned) `fb_beam=1`, the default: each thread's rows are written behind the panel's scan line (2433 lines, 8338 us), and the moving bands are gone; `kern.hakios.fb_surface` is the IOSurface on the panel
+- 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`)
+- licenses: Turnip, AdrenoMetal, metal2vulkan and the plug-in's origin in `THIRD_PARTY_LICENSES.md`; a binary built with `M2V=1` has obligations and is **to verify** before any distribution
+
## 2026-11-03
-- metal: luma_boost is left out when QuartzCore's library has its own (an iOS 17 one, off a Mac): it was 83% of the GPU's timed passes; `metal_luma_boost=1` draws it
+- metal: Metal on Vulkan, as UniXNU runs it: `tools/mk-turnip.sh`, `tools/mk-m2v.sh`, `userland/build.sh TURNIP=1 M2V=1`; nothing of it in `prebuilt/`, you fetch and build it
+- metal: `vk_test` passes on the phone (`RC_JOBS=rc.jobs.vktest`): Vulkan 1.3.305, a 4 MB fill checked word by word, a submission and its fence wait 2.0 ms on average
+- metal: `m2v_test` passes on the phone (`RC_JOBS=rc.jobs.m2vtest`): the device in 134 ms, a 1080 x 2400 clear checked pixel by pixel, a full-screen clear committed and waited for in 1.08 ms
+- metal: `metal_m2v=1`: the window server draws through metal2vulkan, correctly since it opens QuartzCore's pipeline library and picks CoreAnimation's shader variants by label: swipes 50 to 57, scroll 41, the GPU 14 to 21 ms a frame; `tu_debug=` and `m2v_utrace=1` say why
+- gpu: HakiosGPU's request `0x7d`: the client's own pages as a buffer; Turnip takes any page-aligned pointer through `VK_EXT_external_memory_host` (grey icons and text before)
+- gpu: Turnip has `VK_NV_linear_color_attachment` on Darwin, unused so far: the window server's pass has a second attachment that is not linear
+- springboard: `wallpaper_cache=1` rasterizes the wallpaper's window: page swipes 85-91 to 97-103, an app's close slower (22-30 against 40); `wallpaper_freeze=2` hides the wallpaper: home button 78 frames a second against 28, swipes unchanged; `wallpaper_freeze=1`'s picture comes out one colour here, and is not used
+- metal: `metal_fps=mainpass` prints the draws of a heavy pass, `metal_fps=passes` each pass's attachments
+- display: surfaces let go of when their pixels are on the panel, not when the next frame comes: no change in frame rate
+- metal: luma_boost is left out when QuartzCore's library has its own (a later system's, off a Mac): it was 83% of the GPU's timed passes; `metal_luma_boost=1` draws it
- metal: `metal_defer=1` records the window server's command buffers on a thread of hakios-metal's own -- a draw costs its render thread ~5 us instead of ~40
- metal: `metal_fps=passes` prints every pass of a slow frame; the full-screen pass of the home screen is 6 to 13 ms of the GPU's ~10 a frame
- display: `fbsubtype=N` with `fbwidth`, `fbheight` and `fbscale` reports another iPhone's screen class (the XR's 828 x 1792 at 2: no red rdar status bar)
diff --git a/README.md b/README.md
index 782f727..32da096 100644
--- a/README.md
+++ b/README.md
@@ -2,130 +2,61 @@
English · [中文](README.zh.md) · [Українська](README.uk.md)
-**Apple's open-source Darwin kernel (XNU, xnu-8796.121.2) on Android phones with a Qualcomm SoC**, the way Android is Linux on
-phones: a boot loader of its own, drivers of its own, a configuration system and a version of its own. The same kernel runs in
-QEMU with nothing of Apple's and nothing of any phone's (`make qemu-open`).
-
-**Documentation: [docs/](docs/index.md)**, also on the project's website (`hakios-web`). Start with [Getting started](docs/getting-started/index.md), [Port a device](docs/porting/index.md) or the
-[Architecture](docs/concepts/architecture.md).
-
-## What works
-
-| | POCO X5 Pro 5G (`redwood`) | QEMU `virt` |
-|---|---|---|
-| Lock screen, home screen, Control Center, the stock apps | yes | yes (slow: the CPU is emulated) |
-| Touch, multitouch, buttons | yes | yes |
-| All 8 CPU cores, the big one at 2.4 GHz | yes | no |
-| GPU rendering on Adreno (OpenGL ES through Mesa) | yes | no |
-| Speakers, microphone, the battery's level | yes | sound only |
-| Wi-Fi, cameras, vibration | yes | network only |
-| `/private/var` kept across reboots, Sileo, SSH | yes | no |
-| Metal | partly: a device Metal loads; buffers and libraries; nothing drawn yet | partly |
-| Cellular | partly: the modem is up, the SIM bound, the network seen; no registration yet | no |
-| Bluetooth, charging under this kernel, Apple's services | no | no |
-
-Every part, as each device's own `device.conf` records it: [Devices](docs/devices/index.md). The rows about the lock screen and the
-apps describe what happens when you add layer 2 below yourself.
-
-## The three layers
-
-1. **The open core**: the kernel port, the loader, the drivers, the tools. All source, in these repositories.
-2. **What you put on top**: the kernel can start a user space that you supply. It was built so that it can start the Darwin userland 16.5
- user space, which you lay out yourself from files you download from Apple; nothing of it is shipped, and nothing is
- circumvented to get it. Whether you may do that, and whether you want to, is your decision.
-3. **Apple's services** (activation, Apple ID, iCloud, the App Store): not supported and not a goal.
-
-By default the loader goes into RAM through `fastboot boot`, the system lives in RAM for a session, and a reboot brings the phone
-back to its own Android. The one thing written by default is the loader's own log (a few KB) to the `logdump` partition; with
-`ufs_write=1` the kernel writes only to a partition `darwin` that you create yourself. This is a research bench, not a ROM.
-
-## Quick start
-
-```sh
-git clone https://github.com/oosexgang/hakios-xnu-kernel.git hakios
-cd hakios
-make doctor # what this machine lacks, and what to do
-make qemu-open # the open kernel in QEMU: nothing of Apple's, nothing of a phone's
-```
-
-Darwin in QEMU (Linux, 12 GB of disk, Apple's IPSW downloaded for you), and a session on the phone:
-[QEMU](docs/getting-started/qemu.md), [On the phone](docs/getting-started/phone.md).
-
-```sh
-make redwood_defconfig # the phone's configuration: the common kernel + the SC7280's + the phone's own
-make kernel # the kernel with the drivers that configuration builds
-make phone SECS=600 # a 10-minute session on the phone, in RAM
-```
-
-## Repositories: common, SoC, device, UEFI
-
-| Repository | What |
-|---|---|
-| [hakios-xnu-kernel](https://github.com/oosexgang/hakios-xnu-kernel/tree/main) | **common**: the kernel port, every common driver, the loader, user space, the tools, this documentation, and `devices/qemu` |
-| [hakios-sm7325](https://github.com/oosexgang/hakios-sm7325) | POCO X5 Pro 5G: its defconfig, status, UEFI platform, firmware script, and its SoC's layer (`soc/`: the Qualcomm SC7280 family) |
-| [hakios-uefi](https://github.com/oosexgang/hakios-uefi) | the firmware that starts the loader: Mu-Silicium with HakiOS's boot path, banner and name, and HakiOS's U-Boot (`u-boot/`) |
-| [hakios-metal](https://github.com/oosexgang/hakios-metal) | Metal's command model on the Adreno, through the kernel's GPU driver |
+**Apple's open-source Darwin kernel (XNU, xnu-8796.121.2) on Android phones**, the way Android is Linux on phones: a boot loader of its
+own, drivers of its own, a configuration system and a version of its own. The same kernel runs in QEMU with nothing of Apple's and
+nothing of any phone's (`make qemu-open`). A research bench, not a ROM: by default it runs from RAM, and a reboot gives the phone back to
+Android.
+
+**Documentation:** [docs/](docs/index.md), and the site, [hackios-web.vercel.app](https://hackios-web.vercel.app).
-`devices/manifest.conf` in the common repository names each one and the revision it is at; `tools/hakios-device.py sync` clones them
-into `devices/` and `uefi/`. One repository per device: it carries its SoC's layer, and `tools/hakios-device.py new` makes one. [How the repositories fit](docs/porting/repositories.md).
+**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 about 90. 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 -->
-```sh
-git clone https://github.com/oosexgang/hakios-xnu-kernel.git hakios && cd hakios
-tools/hakios-device.py sync # the SoC, device and UEFI repositories, at the revisions the manifest names
-```
+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).
-A device of your own is a repository over the common one: `tools/hakios-device.py new` makes it from the phone's own device tree,
-with every phone driver left out until it is ported. Each driver is an option of the kernel's own configuration (`CONFIG_HAKIOS_*`,
-XNU's `options` and `conf/files`), so a device's defconfig builds exactly the drivers it has.
-[Port a device](docs/porting/index.md), [Drivers in the configuration](docs/drivers-config.md).
+## Repositories
-## What is in the repository, and what never is
+| Repository | Contents |
+|---|---|
+| [hakios-xnu-kernel](https://github.com/oosexgang/hakios-xnu-kernel) | **common**: the kernel port, every common driver, the loader, user space, the tools, this documentation, and `devices/qemu` |
+| [hakios-metal](https://github.com/oosexgang/hakios-metal) | Metal's command model on the Adreno, through the kernel's GPU driver |
+| [hakios-sm7325](https://github.com/oosexgang/hakios-sm7325) | POCO X5 Pro 5G: its defconfig, status, UEFI platform, firmware script, and its SoC's layer (Qualcomm SC7280 family) |
+| [hakios-mt6768](https://github.com/oosexgang/hakios-mt6768) | Infinix Hot 20 (MediaTek Helio G85): an experimental port with its own loader. Not in this repository's manifest |
+| [hakios-uefi](https://github.com/oosexgang/hakios-uefi) | the firmware that starts the loader: Mu-Silicium with HakiOS's boot path, banner and name, and HakiOS's U-Boot |
+| [hackios-web](https://github.com/oosexgang/hackios-web) | the website |
+| [hackios-xnu-userland](https://github.com/oosexgang/hackios-xnu-userland) | old: a pointer kept for its links. User space is `userland/` here |
-In it: only our own code and data: the patch to Apple's open-source XNU (`xnu/hakios.patch`, APSL 2.0) and our files, the boot
-loader, our programs and libraries, the tools, `prebuilt/` (built from this source; the loader **without** any Apple data:
-`make loader` makes the one that starts Darwin, on your machine, from your own IPSW), and the device and SoC directories.
+How they fit: [the repositories](docs/porting/repositories.md).
-Never in it: any file of Darwin (you build the system image on your machine from an IPSW you get yourself and hand to
-`sysimage/unpack.sh`; nothing is downloaded for you, decrypted or circumvented); the phone's firmware (pulled from your own phone into
-`fw-*/`, which git ignores); keys, certificates, activation, or anything that would make the phone pass as an iPhone to Apple.
+## What you bring, and what is never here
-## Independent, and Apple-free at the core
+Nothing of Apple's and no vendor's firmware is in these repositories. The Darwin user space, if you want it, you lay out yourself from an
+IPSW you get yourself, and the firmware comes off your own phone; nothing is downloaded for you, decrypted or circumvented. Apple's
+services (activation, Apple ID, iCloud, the App Store) are not supported and not a goal.
+[What is in the repository, and what never is](docs/index.md#what-is-in-the-repository-and-what-never-is).
-HakiOS is an independent research project. It is **not affiliated with or endorsed by Apple**;
-"Darwin", "iPhone", "XNU" and "Apple" are named only to describe what the code works with. The core
-kernel, the boot loader and the open tools build and run with nothing of Apple's:
+## Contributing
-```sh
-make qemu-open # the open kernel + a placeholder loader + a tiny raw-syscall user space, in QEMU
-```
+See [CONTRIBUTING.md](CONTRIBUTING.md) and [COMMUNITY.md](COMMUNITY.md).
-No IPSW, no Darwin user space, no firmware. Booting the stock Darwin user space (`make qemu`,
-`make phone`) is an optional path that needs the IPSW and the phone's firmware, which you supply
-from your own device.
+## License and legal
-## Licenses and the legal side
+The XNU patch and the files derived from it are under the Apple Public Source License 2.0 ([LICENSE.APSL](LICENSE.APSL)), the rest under
+MIT ([LICENSE](LICENSE)), as the file headers say. Third parties: [NOTICE](NOTICE),
+[THIRD_PARTY_LICENSES.md](THIRD_PARTY_LICENSES.md), [COMPLIANCE.md](COMPLIANCE.md). What is and is not distributed: [LEGAL.md](LEGAL.md).
+None of this is legal advice.
-My code is under the license of the files it changes: the XNU patch under the Apple Public Source
-License 2.0 (Apple publishes XNU under it; the terms are met: changes are published as source,
-notices are kept), the rest as the file headers say. Darwin, its images, Apple's trademarks and the
-phone's firmware belong to their owners, are not in this repository and are not distributed by me;
-everyone takes them from their own phone and their own IPSW. "Darwin", "iPhone" and "Apple" are
-named only to describe what the code works with. If you believe a file here infringes anyone's
-rights, open an issue and I will remove it.
+HakiOS is an independent research project. It is **not affiliated with or endorsed by Apple**; "Darwin", "iPhone", "XNU" and "Apple" are
+named only to describe what the code works with. If you believe a file here infringes anyone's rights, open an issue and it will be
+removed.
-The detail is in separate files: `LEGAL.md` (what is and is not distributed, and the limits of
-these statements), `COMPLIANCE.md` (how the APSL 2.0 and other terms are met, and the items still
-to verify), `THIRD_PARTY_LICENSES.md` (every third-party component with origin and license), and
-`NOTICE` (the short canonical list). None of this is legal advice.
+## Team
hakios is an experimental project focused on bringing darwin to android hardware. our goal is to make hakios free and accessible to everyone.
-owners:
-@oodze - founder
-@netusd - adversting / ceo-dev
-@wannqn - dev
-@hxfuxyyXD - dev
-Rhaenja Hun(杭润嘉) — Developer / Sponsor
+@oodze - founder, @netusd - advertising / ceo-dev, @wannqn - dev, @hxfuxyyXD - dev, Rhaenja Hun(杭润嘉) - developer / sponsor
tym sicilium for the sources!
-
diff --git a/README.uk.md b/README.uk.md
index 98dae45..59c4cdd 100644
--- a/README.uk.md
+++ b/README.uk.md
@@ -2,154 +2,60 @@
[English](README.md) · [中文](README.zh.md) · Українська
-> **Зверніть увагу:** цей переклад відповідає попередній версії англійського README. Актуальні: [README.md](README.md) і документація в [docs/](docs/index.md): репозиторії пристроїв (`devices/<name>`, `socs/<soc>`), драйвери в конфігурації (`CONFIG_HAKIOS_*`), Metal.
+**Відкрите ядро Darwin від Apple (XNU, xnu-8796.121.2) на Android-телефонах**, так само як Android — це Linux на телефонах: власний
+завантажувач, власні драйвери, власна система конфігурацій і власна версія. Те саме ядро працює в QEMU без нічого від Apple і без нічого
+з будь-якого телефона (`make qemu-open`). Це дослідницький стенд, а не прошивка: за замовчуванням усе працює з ОЗП, а перезавантаження
+повертає телефон в Android.
-HakiOS — це адаптація ядра Darwin (відкритий XNU від Apple, xnu-8796.121.2) до Android-телефонів із Qualcomm, так
-само як Android — адаптація Linux до телефонів: власний завантажувач, власні драйвери, система конфігурацій
-(`configs/`) і власна версія ядра (`VERSION`). Те саме працює в QEMU (`virt`, aarch64) на комп'ютері з Linux, без
-нічого від Apple і без нічого з будь-якого телефона (`make qemu-open`).
+**Документація:** [docs/](docs/index.md) (англійською) і сайт [hackios-web.vercel.app](https://hackios-web.vercel.app).
-Тут три шари, і проєкт каже, за який із них він відповідає (`LEGAL.md`):
+**Новини, 4 листопада 2026:** на POCO X5 Pro 5G віконний сервер малює через Metal на Adreno 642L, двома шляхами. hakios-metal: гортання
+сторінок 100–104 кадри на секунду, прокручування в Settings близько 90. Metal поверх Vulkan від UniXNU: гортання 50–57, прокручування 41.
+Панель працює на 120 Гц, і **120 кадрів на секунду не досягнуто**. [Metal на Adreno](docs/reference/metal.md),
+[вимірювання](docs/reference/metal-measurements.md). <!-- FINAL-NUMBERS -->
-1. **Відкрите ядро**: порт ядра, завантажувач, драйвери, інструменти. Увесь код у цьому репозиторії.
-2. **Те, що ви кладете зверху**: ядро може запустити користувацький простір, який ви надаєте самі. Проєкт збудовано
- так, що воно вміє запускати користувацький простір Darwin userland 16.5, який ви самі збираєте з файлів, завантажених у
- Apple; проєкт нічого з цього не поширює і нічого не обходить, щоб це отримати. Чи можна вам це робити і чи
- хочете ви — ваше рішення.
-3. **Сервіси Apple** (активація, Apple ID, iCloud, App Store): не підтримуються і не є метою.
+Почніть із [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).
-За замовчуванням завантажувач іде в ОЗП через `fastboot boot`, система живе в ОЗП до кінця сеансу, а
-перезавантаження повертає телефон у його власний Android. Єдине, що він пише за замовчуванням, — власний журнал
-(кілька КБ) у розділ `logdump` телефона; з `ufs_write=1` ядро пише лише в розділ `darwin`, який ви створюєте самі.
-Це дослідницький стенд, а не прошивка.
+## Репозиторії
-Докладніше: [`COMMUNITY.md`](COMMUNITY.md), [`docs/configs.md`](docs/configs.md), [`docs/versioning.md`](docs/versioning.md),
-[`docs/boot-args.md`](docs/boot-args.md), [`docs/uefi-boot.md`](docs/uefi-boot.md), [`docs/install.md`](docs/install.md),
-[`docs/comparison.md`](docs/comparison.md), [`drivers/README.md`](drivers/README.md).
-
-Перший телефон — **POCO X5 Pro 5G** (`redwood`, Snapdragon 778G). Ядро нічого не знає про нього
-наперед: кожна адреса, переривання, лінія живлення і прошивка беруться з дерева пристроїв самого
-телефона та його Android, тож порт на інший телефон Qualcomm — це новий каталог у `devices/`, а
-не переписування.
-
-## Що є в репозиторії
+| Репозиторій | Вміст |
+|---|---|
+| [hakios-xnu-kernel](https://github.com/oosexgang/hakios-xnu-kernel) | **спільний**: порт ядра, усі спільні драйвери, завантажувач, користувацький простір, інструменти, ця документація і `devices/qemu` |
+| [hakios-metal](https://github.com/oosexgang/hakios-metal) | модель команд Metal на Adreno через драйвер GPU ядра |
+| [hakios-sm7325](https://github.com/oosexgang/hakios-sm7325) | POCO X5 Pro 5G: defconfig, стан, платформа UEFI, скрипт прошивок і шар його SoC (сімейство Qualcomm SC7280) |
+| [hakios-mt6768](https://github.com/oosexgang/hakios-mt6768) | Infinix Hot 20 (MediaTek Helio G85): експериментальний порт із власним завантажувачем. Його немає в маніфесті цього репозиторію |
+| [hakios-uefi](https://github.com/oosexgang/hakios-uefi) | прошивка, що запускає завантажувач: Mu-Silicium зі шляхом завантаження, банером і назвою HakiOS, а також U-Boot від HakiOS |
+| [hackios-web](https://github.com/oosexgang/hackios-web) | вебсайт |
+| [hackios-xnu-userland](https://github.com/oosexgang/hackios-xnu-userland) | старий: вказівник, збережений заради посилань. Користувацький простір тепер у `userland/` тут |
-Лише мій код і мої дані:
+Як вони пов'язані: [репозиторії](docs/porting/repositories.md).
-- ядро: патч до відкритого XNU від Apple (`xnu/hakios.patch`, APSL 2.0) і мої файли драйверів
- (`xnu/files/`, `drivers/`), які `xnu/apply.sh` накладає на свіжий клон;
-- завантажувач (`xnuloader/`), мої програми й бібліотеки (`userland/src/`), інструменти
- (`tools/`), скрипти збірки та запуску;
-- `prebuilt/`: ядро, завантажувач і бібліотеки, зібрані з цього репозиторію;
-- `devices/redwood/`: те, що потрібно одному телефону (порт UEFI, дерево пристроїв, скрипт прошивок).
+## Що приносите ви, і чого тут ніколи немає
-Чого немає і не буде:
+У цих репозиторіях немає нічого від Apple і жодних прошивок вендора. Користувацький простір Darwin, якщо він вам потрібен, ви збираєте самі
+з IPSW, який берете самі, а прошивки знімаються з вашого власного телефона; за вас нічого не завантажується, не розшифровується й не
+обходиться. Сервіси Apple (активація, Apple ID, iCloud, App Store) не підтримуються і не є метою.
+[Що є в репозиторії, а чого ніколи немає](docs/index.md#what-is-in-the-repository-and-what-never-is).
-- жодного файлу Darwin: ні бінарників, ні образів, ні кешів, ні шрифтів, ні картинок, ні знімків
- екрана. Образ системи ви збираєте на своїй машині з IPSW Darwin userland 16.5, який ви берете самі й
- передаєте `sysimage/unpack.sh`; за вас нічого не завантажується, не розшифровується й не обходиться;
-- прошивок телефона (GPU, Wi-Fi, аудіо-DSP, модем, вібро, камери): вони вендорські і знімаються
- з вашого власного телефона в `fw-*/`, які git ігнорує;
-- ключів, сертифікатів, активації чи будь-чого, що видавало б телефон за iPhone перед службами
- Apple. Вхід в обліковий запис Apple тут неможливий і не є метою.
+## Внесок
-## Стан
+Див. [CONTRIBUTING.md](CONTRIBUTING.md) і [COMMUNITY.md](COMMUNITY.md).
-Рядки про екран блокування, застосунки тощо описують те, що відбувається, коли ви самі додаєте шар 2.
+## Ліцензія та юридична сторона
-| Працює | Ще ні |
-|---|---|
-| Екран блокування, домашній екран, Пункт керування, жести, стандартні застосунки | Стільниковий зв'язок: модем стартує, бачить мережу, SIM прив'язана; реєстрація та палички в статус-барі — у роботі (`docs/cellular.md`) |
-| Сенсорний екран, мультитач, кнопки живлення та гучності | Bluetooth |
-| Усі 8 ядер процесора, велике ядро на 2,4 ГГц | Заряджання під цим ядром |
-| Графіка на Adreno (`gpu=1`, OpenGL ES через Mesa) | Metal (є компілятор шейдерів, самого Metal немає) |
-| Динаміки й мікрофон (`adsp=1 sound=4 mic=4`) | Обліковий запис Apple: немає Secure Enclave |
-| Рівень батареї в інтерфейсі (через аудіо-DSP, `adsp=1`) | |
-| Вібрація (`haptic=5`) | |
-| Wi-Fi: радіо, драйвер, підключення до мережі (`wifi=1`) | |
-| Камери в Camera.app (`cam=5`) | |
-| `/private/var` зберігається між перезавантаженнями (`var_store=1 ufs_write=1`) | |
-| Sileo, пакети Procursus, SSH на телефон | |
-
-## Швидкий старт у QEMU
-
-Linux x86-64, близько 12 ГБ на диску, 7-Zip 23 або новіший, `lz4`, `qemu-system-aarch64`, `edk2-aarch64`.
-
-```sh
-git clone https://github.com/oosexgang/hakios-xnu-kernel.git hakios
-cd hakios
-make doctor # чого бракує цьому комп'ютеру (дисплей QEMU, UEFI, пам'ять) і що робити
-make unpack IPSW=~/ваш.ipsw # ваш власний IPSW Darwin userland 16.5, потрібне розпаковується (7,4 ГБ)
-make images # образи APFS: userland/root.apfs і userland/system.apfs
-make loader # завантажувач з ідентичністю iPhone з ВАШОЇ копії IPSW (потрібні clang і lld)
-make qemu # сеанс на 20 хвилин
-```
-
-**Що ви побачите.** Процесор емульований, тож повільно, а вікно спочатку **чорне**: це нормально. Перша хвилина
-чорного екрана, потім логотип Apple, потім домашній екран приблизно за 5 хвилин на швидкому ПК (виміряно: логотип на 1-й хвилині, домашній екран на 5-й), на повільнішому довше. Миша з
-затиснутою кнопкою — палець; `H` — «Додому», `L` — кнопка живлення, `↑`/`↓` — гучність.
-
-**Якщо екран лишається чорним:** (0) чи ви виконали `make loader`? У `prebuilt/loader.efi` навмисно немає даних Apple (він запускає лише відкрите ядро), з ним Darwin не стартує; `qemu/run-darwin.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-darwin.sh 1200 -display vnc=127.0.0.1:0` і VNC-клієнт на
-`127.0.0.1:5900`; (4) гість просить у QEMU 7 ГБ пам'яті (мінімум 6): на меншій пам'яті все дуже повільно.
-
-## На телефоні
-
-Телефон, для якого є порт (`devices/redwood/`, POCO X5 Pro 5G), з розблокованим завантажувачем,
-`adb` і `fastboot` на комп'ютері, образи з попереднього розділу і прошивки самого телефона:
-
-```sh
-make firmware # GPU, Wi-Fi, звук/батарея, вібро, модем, камери -> fw-*/
-make phone # 10-хвилинний сеанс з усім залізом, потім назад в Android
-make phone ARGS="modem=1" SECS=300 # або свій набір параметрів ядра
-```
-
-Головні параметри ядра (повний список — у `docs/ru/notes.md`):
-
-| Параметр | Що дає |
-|---|---|
-| `cpus=8 bootcpu=7 cpufreq=1` | усі ядра процесора та їхні частоти |
-| `touchscreen=1` | сенсорний екран |
-| `gpu=1` | малювання на Adreno (образ, зібраний з `GL=1`, прошивки у `fw-gpu/`) |
-| `adsp=1 sound=4 mic=4` | аудіо-DSP: динаміки, мікрофон; з ним же батарея та заряджання |
-| `haptic=5` | вібромотор |
-| `wifi=1` | Wi-Fi (мережа з `fw-wifi/network`) |
-| `cam=5` | камери |
-| `modem=1` | модем поруч із системою: його прошивка, файлові системи, IPA, SIM, NAS |
-| `var_store=1 ufs_write=1` | зберігати `/private/var` між перезавантаженнями |
+Патч до XNU і похідні від нього файли — під Apple Public Source License 2.0 ([LICENSE.APSL](LICENSE.APSL)), решта — під MIT
+([LICENSE](LICENSE)), як зазначено в заголовках файлів. Сторонні компоненти: [NOTICE](NOTICE),
+[THIRD_PARTY_LICENSES.md](THIRD_PARTY_LICENSES.md), [COMPLIANCE.md](COMPLIANCE.md). Що поширюється, а що ні: [LEGAL.md](LEGAL.md). Усе це не
+є юридичною порадою.
-## Збірка з вихідників
+HakiOS — незалежний дослідницький проєкт. Він **не пов'язаний з Apple і не схвалений нею**; «Darwin», «iPhone», «XNU» та «Apple» названо лише
+для опису того, з чим працює код. Якщо ви вважаєте, що файл тут порушує чиїсь права, відкрийте issue, і його буде видалено.
-```sh
-make kernel # XNU з GitHub Apple + мої зміни -> xnu-src/, залежності, збірка
-make loader # завантажувач; identity.h робиться при збірці з вашого IPSW
-make images # користувацький простір і образи
-```
+## Команда
-Подробиці: `xnu/README.md`, `docs/ru/notes.md`.
+hakios — експериментальний проєкт, мета якого — перенести darwin на android-залізо. Наша мета — зробити hakios вільним і доступним для всіх.
-## Структура
+@oodze — засновник, @netusd — реклама / ceo-dev, @wannqn — розробник, @hxfuxyyXD — розробник, Rhaenja Hun(杭润嘉) — розробник / спонсор
-| Каталог | Вміст |
-|---|---|
-| `xnu/` | патч і файли ядра; `apply.sh`, `export.sh`; README про ядро |
-| `drivers/*/hakios.*` | мої драйвери: екран, тач, UFS, GPU, Wi-Fi, звук, модем, SIM/NAS, вібро, камери |
-| `xnuloader/` | завантажувач (застосунок UEFI) |
-| `userland/` | мої програми й бібліотеки (`src/`), збірка образів, завдання launchd |
-| `sysimage/` | скрипти, що беруть і розпаковують файли ОС з IPSW (самих файлів немає) |
-| `devices/redwood/` | один телефон: його порт UEFI, дерево пристроїв, готові образи UEFI, скрипт прошивок |
-| `tools/` | APFS, прошивки, тести QMI, скрипти прогонів |
-| `qemu/` | запуск у QEMU |
-| `docs/` | `cellular.md` — зв'язок (англійською); `ru/` — докладний щоденник розробки російською |
-| `prebuilt/` | зібрані ядро, завантажувач, бібліотеки |
-
-## Ліцензії та юридична сторона
-
-Мій код — під ліцензією тих файлів, які він змінює: патч XNU — Apple Public Source License 2.0
-(повний текст у `LICENSE.APSL`; умови дотримано: зміни опубліковано у вихідниках, повідомлення
-збережено), решта — MIT (`LICENSE`). Darwin, її образи, торгові марки Apple і прошивки телефона
-належать їхнім власникам, у репозиторій не входять і мною не поширюються; кожен бере їх зі свого
-телефона та свого IPSW. Сторонні компоненти перелічено в `NOTICE`. Якщо, на вашу думку, якийсь
-файл тут порушує чиїсь права — відкрийте issue, і я його приберу.
+Дякуємо команді silicium за вихідний код!
diff --git a/README.zh.md b/README.zh.md
index 25bf3e8..835477e 100644
--- a/README.zh.md
+++ b/README.zh.md
@@ -2,144 +2,46 @@
[English](README.md) · 中文 · [Українська](README.uk.md)
-> **注意:** 本译文对应英文 README 的旧版本。最新内容见 [README.md](README.md) 和 [docs/](docs/index.md) 中的文档:设备仓库(`devices/<name>`、`socs/<soc>`)、配置中的驱动(`CONFIG_HAKIOS_*`)以及 Metal。
+**运行在 Android 手机上的 Apple 开源 Darwin 内核(XNU,xnu-8796.121.2)**,就像 Android 是手机上的 Linux 一样:有自己的引导加载器、自己的驱动、自己的配置系统和自己的版本。同一个内核可以在 QEMU 中运行,不需要任何 Apple 的东西,也不需要任何手机的东西(`make qemu-open`)。这是一个研究平台,不是 ROM:默认从内存运行,重启后手机回到 Android。
-HakiOS 是把 Darwin 内核(Apple 开源的 XNU,xnu-8796.121.2)适配到搭载高通 SoC 的 Android 手机上,就像 Android 是
-Linux 在手机上的适配:我自己的引导程序、驱动、配置系统(`configs/`)和独立的内核版本号(`VERSION`)。同样的东西也能在
-Linux 电脑上的 QEMU(`virt`,aarch64)里运行,不需要任何 Apple 的东西,也不需要任何手机的东西(`make qemu-open`)。
+**文档:** [docs/](docs/index.md)(英文),以及网站 [hackios-web.vercel.app](https://hackios-web.vercel.app)。
-它分三层,项目说明自己对哪一层负责(`LEGAL.md`):
+**动态,2026 年 11 月 4 日:** 在 POCO X5 Pro 5G 上,窗口服务器通过 Metal 在 Adreno 642L 上绘制,有两条路径。hakios-metal:翻页每秒 100 至 104 帧,Settings 滚动约 90 帧。UniXNU 的 Metal on Vulkan:翻页 50 至 57 帧,滚动 41 帧。屏幕是 120 Hz,**尚未达到每秒 120 帧**。[Adreno 上的 Metal](docs/reference/metal.md),[测量结果](docs/reference/metal-measurements.md)。<!-- FINAL-NUMBERS -->
-1. **开放核心**:内核移植、引导程序、驱动、工具。全部是本仓库里的源码。
-2. **你自己放在上面的东西**:内核可以启动你自己提供的用户空间。项目的构建方式使它能够启动 Darwin userland 16.5 用户空间,但那是你自己用
- 从 Apple 下载的文件在本机整理出来的;项目不提供其中任何内容,也不绕过任何限制去获取它。你是否可以这样做、是否愿意这样做,由你自己决定。
-3. **Apple 的服务**(激活、Apple ID、iCloud、App Store):不支持,也不是目标。
+从 [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)。
-默认情况下,引导程序通过 `fastboot boot` 进入内存,系统在内存里运行一个会话,重启后手机回到它自己的 Android。它默认只写一样东西:
-自己的日志(几 KB),写入手机的 `logdump` 分区;开启 `ufs_write=1` 时,内核只会写入你自己创建的 `darwin` 分区。这是一个研究用的试验台,不是 ROM。
+## 仓库
-更多:[`COMMUNITY.md`](COMMUNITY.md)、[`docs/configs.md`](docs/configs.md)、[`docs/versioning.md`](docs/versioning.md)、
-[`docs/boot-args.md`](docs/boot-args.md)、[`docs/uefi-boot.md`](docs/uefi-boot.md)、[`docs/install.md`](docs/install.md)、
-[`docs/comparison.md`](docs/comparison.md)、[`drivers/README.md`](drivers/README.md)。
-
-第一台手机是 **POCO X5 Pro 5G**(`redwood`,骁龙 778G)。内核事先对它一无所知:每个地址、中断、
-电源轨和固件都来自手机自己的设备树和它的 Android,所以移植到另一台高通手机意味着在 `devices/`
-下新建一个目录,而不是重写。
-
-## 仓库里有什么
-
-只有我的代码和我的数据:
-
-- 内核:对 Apple 开源 XNU 的补丁(`xnu/hakios.patch`,APSL 2.0)和我的驱动文件(`xnu/files/`、`drivers/`),
- 由 `xnu/apply.sh` 叠加到一份新克隆上;
-- 引导程序(`xnuloader/`)、我的程序和库(`userland/src/`)、工具(`tools/`)、构建和运行脚本;
-- `prebuilt/`:用本仓库构建出的内核、引导程序和库;
-- `devices/redwood/`:一台手机所需的东西(UEFI 移植、设备树、固件脚本)。
+| 仓库 | 内容 |
+|---|---|
+| [hakios-xnu-kernel](https://github.com/oosexgang/hakios-xnu-kernel) | **公共部分**:内核移植、所有公共驱动、引导加载器、用户空间、工具、本文档以及 `devices/qemu` |
+| [hakios-metal](https://github.com/oosexgang/hakios-metal) | 通过内核的 GPU 驱动,在 Adreno 上实现 Metal 的命令模型 |
+| [hakios-sm7325](https://github.com/oosexgang/hakios-sm7325) | POCO X5 Pro 5G:defconfig、状态、UEFI 平台、固件脚本及其 SoC 层(Qualcomm SC7280 系列) |
+| [hakios-mt6768](https://github.com/oosexgang/hakios-mt6768) | Infinix Hot 20(MediaTek Helio G85):实验性移植,有自己的引导加载器。不在本仓库的清单中 |
+| [hakios-uefi](https://github.com/oosexgang/hakios-uefi) | 启动引导加载器的固件:带有 HakiOS 启动路径、横幅和名称的 Mu-Silicium,以及 HakiOS 的 U-Boot |
+| [hackios-web](https://github.com/oosexgang/hackios-web) | 网站 |
+| [hackios-xnu-userland](https://github.com/oosexgang/hackios-xnu-userland) | 旧仓库:只为保留链接而存在的指向。用户空间现在在这里的 `userland/` |
-永远不会有的东西:
+它们如何组合:[仓库说明](docs/porting/repositories.md)。
-- 任何 Darwin 文件:没有二进制、镜像、缓存、字体、图片或截图。系统镜像由你在自己机器上用 Darwin userland 16.5
- 的 IPSW 构建,IPSW 由你自己获取并交给 `sysimage/unpack.sh`;项目不替你下载、不解密、不绕过任何东西;
-- 手机的固件(GPU、Wi-Fi、音频 DSP、调制解调器、振动、摄像头):属于厂商,从你自己的手机取到
- `fw-*/`,git 忽略这些目录;
-- 密钥、证书、激活,或任何让手机在 Apple 服务面前冒充 iPhone 的东西。这里无法登录 Apple 账户,
- 这也不是目标。
+## 你需要自带什么,以及这里永远没有什么
-## 现状
+这些仓库中没有任何 Apple 的东西,也没有厂商固件。如果需要 Darwin 用户空间,你要用自己获取的 IPSW 自行布置;固件取自你自己的手机;没有任何东西会替你下载、解密或绕过。Apple 的服务(激活、Apple ID、iCloud、App Store)不受支持,也不是目标。[仓库里有什么,永远没有什么](docs/index.md#what-is-in-the-repository-and-what-never-is)。
-关于锁屏、应用等的各行,描述的是你自己加上第 2 层之后的情况。
+## 参与贡献
-| 可用 | 尚未 |
-|---|---|
-| 锁屏、主屏、控制中心、手势、系统自带应用 | 蜂窝网络:调制解调器已启动、能看到网络、SIM 已绑定;注册和状态栏信号格正在进行(`docs/cellular.md`) |
-| 触摸屏、多点触控、电源和音量键 | 蓝牙 |
-| 全部 8 个 CPU 核心,大核 2.4 GHz | 本内核下的充电 |
-| Adreno GPU 渲染(`gpu=1`,经 Mesa 的 OpenGL ES) | Metal(有着色器编译器,没有 Metal) |
-| 扬声器和麦克风(`adsp=1 sound=4 mic=4`) | Apple 账户:没有 Secure Enclave |
-| 界面里的电池电量(经音频 DSP,`adsp=1`) | |
-| 振动(`haptic=5`) | |
-| Wi-Fi:射频、驱动、联网(`wifi=1`) | |
-| 相机应用里的摄像头(`cam=5`) | |
-| `/private/var` 跨重启保留(`var_store=1 ufs_write=1`) | |
-| Sileo、Procursus 软件包、SSH 登录手机 | |
-
-## QEMU 快速开始
-
-Linux x86-64,约 12 GB 磁盘,7-Zip 23 或更新,`lz4`,`qemu-system-aarch64`,`edk2-aarch64`。
-
-```sh
-git clone https://github.com/oosexgang/hakios-xnu-kernel.git hakios
-cd hakios
-make doctor # 检查本机缺什么(QEMU 显示设备、UEFI 固件、内存)以及怎么办
-make unpack IPSW=~/your.ipsw # 你自己获取的 Darwin userland 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 标志,
-在较快的台式机上约 5 分钟后出现主屏幕(实测:1 分钟出现标志,5 分钟出现主屏幕),较慢的机器更久。按住鼠标键就是手指;`H` 是主屏键,`L` 是电源键,`↑`/`↓` 是音量。
-
-**如果一直是黑屏:** (0) 你运行过 `make loader` 吗?`prebuilt/loader.efi` 里特意不含 Apple 的数据(它只能启动开放内核),用它 Darwin 不会启动;没有你自己的 `xnuloader/loader.efi` 时 `qemu/run-darwin.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-darwin.sh 1200 -display vnc=127.0.0.1:0`,再用 VNC 客户端连接 `127.0.0.1:5900`。
-(4) 虚拟机向 QEMU 要 7 GB 内存(至少 6 GB),内存不足时会非常慢。
-
-## 在手机上
-
-一台有移植的手机(`devices/redwood/`,POCO X5 Pro 5G),已解锁引导程序,电脑上有 `adb` 和
-`fastboot`,上一节的镜像,以及手机自己的固件:
-
-```sh
-make firmware # GPU、Wi-Fi、音频/电池、振动、调制解调器、摄像头 -> fw-*/
-make phone # 10 分钟会话,全部硬件开启,然后回到 Android
-make phone ARGS="modem=1" SECS=300 # 或自定义内核参数
-```
-
-主要内核参数(完整列表见 `docs/ru/notes.md`):
-
-| 参数 | 作用 |
-|---|---|
-| `cpus=8 bootcpu=7 cpufreq=1` | 全部 CPU 核心及其频率 |
-| `touchscreen=1` | 触摸屏 |
-| `gpu=1` | Adreno 渲染(镜像需以 `GL=1` 构建,固件在 `fw-gpu/`) |
-| `adsp=1 sound=4 mic=4` | 音频 DSP:扬声器、麦克风;电池与充电也经由它 |
-| `haptic=5` | 振动马达 |
-| `wifi=1` | Wi-Fi(网络来自 `fw-wifi/network`) |
-| `cam=5` | 摄像头 |
-| `modem=1` | 与系统并行启动调制解调器:固件、文件系统、IPA、SIM、NAS |
-| `var_store=1 ufs_write=1` | 跨重启保留 `/private/var` |
+见 [CONTRIBUTING.md](CONTRIBUTING.md) 和 [COMMUNITY.md](COMMUNITY.md)。
-## 从源码构建
+## 许可与法律
-```sh
-make kernel # 从 Apple 的 GitHub 取 XNU 源码 + 我的修改 -> xnu-src/,依赖,构建
-make loader # 引导程序;identity.h 在构建时由你的 IPSW 生成
-make images # 用户空间和镜像
-```
+XNU 补丁及其派生文件采用 Apple Public Source License 2.0([LICENSE.APSL](LICENSE.APSL)),其余采用 MIT([LICENSE](LICENSE)),以文件头为准。第三方组件:[NOTICE](NOTICE)、[THIRD_PARTY_LICENSES.md](THIRD_PARTY_LICENSES.md)、[COMPLIANCE.md](COMPLIANCE.md)。分发什么、不分发什么:[LEGAL.md](LEGAL.md)。以上都不构成法律意见。
-详情见 `xnu/README.md` 和 `docs/ru/notes.md`。
+HakiOS 是一个独立的研究项目,**与 Apple 没有关联,也未获其认可**;提及 “Darwin”、“iPhone”、“XNU” 和 “Apple” 只是为了说明代码面向什么。如果你认为这里的某个文件侵犯了任何人的权利,请提交 issue,它会被移除。
-## 目录结构
+## 团队
-| 目录 | 内容 |
-|---|---|
-| `xnu/` | 内核补丁和文件;`apply.sh`、`export.sh`;内核 README |
-| `drivers/*/hakios.*` | 我的驱动:显示、触摸、UFS、GPU、Wi-Fi、音频、调制解调器、SIM/NAS、振动、摄像头 |
-| `xnuloader/` | 引导程序(UEFI 应用) |
-| `userland/` | 我的程序和库(`src/`)、镜像构建、launchd 任务 |
-| `sysimage/` | 从 IPSW 取得并解包系统文件的脚本(不含文件本身) |
-| `devices/redwood/` | 一台手机:UEFI 移植、设备树、预构建 UEFI 镜像、固件脚本 |
-| `tools/` | APFS、固件、QMI 测试、运行脚本 |
-| `qemu/` | 在 QEMU 中运行 |
-| `docs/` | `cellular.md`:蜂窝网络(英文);`ru/`:详细的俄文开发日志 |
-| `prebuilt/` | 构建好的内核、引导程序、库 |
+hakios 是一个实验性项目,致力于把 darwin 带到 android 硬件上。我们的目标是让 hakios 免费并人人可用。
-## 许可与法律
+@oodze — 创始人,@netusd — 推广 / ceo-dev,@wannqn — 开发,@hxfuxyyXD — 开发,Rhaenja Hun(杭润嘉)— 开发 / 赞助
-我的代码遵循它所修改文件的许可:XNU 补丁为 Apple Public Source License 2.0(全文在
-`LICENSE.APSL`;条款已满足:修改以源码形式发布,保留了声明),其余为 MIT(`LICENSE`)。Darwin、
-其镜像、Apple 商标和手机固件属于各自的所有者,不在本仓库中,也不由我分发;每个人从自己的手机和
-自己的 IPSW 取得它们。第三方组件列于 `NOTICE`。若你认为这里的某个文件侵犯了任何人的权利,请开一
-个 issue,我会删除它。
+感谢 silicium 团队提供的源代码!
diff --git a/docs/comparison.md b/docs/comparison.md
index 0589949..bead125 100644
--- a/docs/comparison.md
+++ b/docs/comparison.md
@@ -1,17 +1,18 @@
# HakiOS next to the other XNU-on-a-phone projects
There are other projects that put Apple's open-source XNU on hardware that is not Apple's. This page says, as plainly
-as it can, where this one is different. It is written from their public README pages as read on 2026-10-27; they
-change, so read theirs, and tell us if a line here is out of date or wrong
+as it can, where this one is different. It is written from their public pages as read on 2026-11-04 (for UniXNU also its
+documentation, at its commit `c1ecc5b`); they change, so read theirs, and tell us if a line here is out of date or wrong
(an issue is enough). Where the table says something about **our** runtime state, it is what
-this repository's README claims; the things this repository has *tested* are marked.
+[the documentation's front page](index.md#what-works) claims; the things this repository has *tested* are marked.
| | [ios-sweet](https://github.com/dipa-studio/ios-sweet) | [UniXNU](https://github.com/UniXNU/UniXNU) | [Bergamota](https://github.com/ry-diffusion/bergamota) | HakiOS |
|---|---|---|---|---|
-| What it is | one phone, bring-up of Darwin userland 16 | a general UEFI environment for Darwin/macOS on ARM64, in the manner of OpenCore | one phone, bring-up of Darwin userland 18 (a fork of ios-sweet) | a Darwin kernel port with its own loader and driver set, and a Linux-style configuration system |
-| Hardware | Redmi Note 10 Pro (SM7150) | Xiaomi Pad 6S Pro (SM8550), shared SoC code | Poco F1 (SDM845) | POCO X5 Pro 5G (SM7325), and a generator for a new device from its own device tree |
-| Kernel | Apple's open xnu-8796 | not stated on its page | 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), or a UEFI loader that reads its payload from the volume it was started from (tested in QEMU; not yet on a phone) |
+| What it is | one phone, bring-up of Darwin userland 16 | a general UEFI environment for Darwin/macOS on ARM64, in the manner of OpenCore: shared build tools, OS profiles, a component catalog, SoC and device repositories | one phone, bring-up of Darwin userland 18 (a fork of ios-sweet) | a Darwin kernel port with its own loader and driver set, and a Linux-style configuration system |
+| 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 --> |
| 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 |
@@ -33,7 +34,7 @@ These are things that exist in this repository and that a reader can check:
a kind the project promises never to carry, and a writer to the phone's flash that is not declared. The answer to
"what exactly does this write to my phone?" is a file you can read ([legal-review.md](legal-review.md),
[LEGAL.md](../LEGAL.md)).
-- **Its own loader, its own drivers**: GPU (Mesa over a Darwin driver), Wi-Fi, audio, haptics, cameras, touch, storage,
+- **Its own loader, its own drivers**: GPU (Mesa and Metal over a Darwin driver), Wi-Fi, audio, haptics, cameras, touch, storage,
modem bring-up. [driver-review/](driver-review/README.md) says what each is, and what has and has not been verified.
## What the others have that this one does not
@@ -41,7 +42,13 @@ These are things that exist in this repository and that a reader can check:
- ios-sweet and Bergamota are small enough to read in an afternoon, and Bergamota targets a newer Darwin (18) with its
own tool for the arm64e/pointer-authentication gap. HakiOS targets the Darwin userland 16.5 generation, whose userland the
open xnu-8796 matches.
-- UniXNU is aiming at a shared UEFI layer that many devices use; HakiOS's loader is one device family's, so far.
+- UniXNU is a shared UEFI layer that many devices use, with a catalog of components and a page per driver. HakiOS's loader is one
+ device family's, so far.
+- UniXNU had Metal on Vulkan first, and it is theirs: HakiOS's second Metal path is AdrenoMetal's frontend and metal2vulkan, built by
+ `tools/mk-m2v.sh` with patches for an older system. Their kernel driver for the Adreno 740 does ring scheduling and preemption by its
+ documentation, which HakiOS's does not. Their Adreno 740 is another GPU and their system a newer one, so our numbers say nothing
+ about how theirs runs.
+- UniXNU has OS profiles for several systems, arm64e among them. HakiOS targets the Darwin 16.5 generation alone.
- Bergamota ships a macOS control app. HakiOS has `xl` and `make`, which are command lines.
## What nobody here can do
@@ -52,5 +59,5 @@ Run an Apple account, activation, iMessage or the other Apple services: no proje
## What "different" does not mean
It does not mean better on a given day. The things in the first section are about how the project is built and checked,
-not about how many apps open. If you want to see which of these the phone has actually passed, read the status table in
-the README and `docs/port-pkg110.md`, and run it yourself.
+not about how many apps open. If you want to see which of these the phone has actually passed, read
+[the status table](index.md#what-works) and `docs/port-pkg110.md`, and run it yourself.
diff --git a/docs/driver-review/gpu-display.md b/docs/driver-review/gpu-display.md
index 1238807..b763650 100644
--- a/docs/driver-review/gpu-display.md
+++ b/docs/driver-review/gpu-display.md
@@ -2,6 +2,8 @@
## Scope and method
+(This review came before HakiosGPU's request `0x7d`, the client's own pages as a buffer, added 3 November: [Metal on the Adreno](../reference/metal.md#hakiosgpu-driversgpuhakiosgpucpp). That request has not been reviewed, and it adds to G6's wired memory without a cap of its own.)
+
Read-only review of the user-reachable surface of the GPU and display code. Nothing was built or run; the XNU source tree itself is not in this repository (only `xnu/files` overlays), so XNU API behaviour is not verified here.
| File | Lines |
diff --git a/docs/getting-started/index.md b/docs/getting-started/index.md
index f7404ab..2e4ef96 100644
--- a/docs/getting-started/index.md
+++ b/docs/getting-started/index.md
@@ -6,12 +6,35 @@ should see, and what to check when you do not see it.
| | What you get | What you need | Time |
|---|---|---|---|
| [**The open kernel in QEMU**](qemu.md#the-open-kernel) | the kernel, the loader and a tiny user space, booting | a Linux or macOS machine, QEMU | minutes |
-| [**Darwin in QEMU**](qemu.md#darwin-in-qemu) | the lock screen and the home screen in a window | Linux, 12 GB of disk, Apple's IPSW (downloaded for you) | an hour, mostly downloads |
+| [**Darwin in QEMU**](qemu.md#darwin-in-qemu) | the lock screen and the home screen in a window | Linux, 12 GB of disk, your own IPSW (nothing downloads it) | an hour, mostly downloads |
| [**On the phone**](phone.md) | the system on a POCO X5 Pro 5G, in RAM | the phone, its boot loader unlocked, `adb` and `fastboot` | an hour the first time |
Building from source is optional for all three: `prebuilt/` has a kernel, a loader and libraries made from these repositories.
[Building from source](building.md) when you change something.
+## Quick start
+
+```sh
+git clone https://github.com/oosexgang/hakios-xnu-kernel.git hakios
+cd hakios
+make doctor # what this machine lacks, and what to do
+make qemu-open # the open kernel in QEMU: nothing of Apple's, nothing of a phone's
+```
+
+A session on the phone, once [On the phone](phone.md) has been followed:
+
+```sh
+make redwood_defconfig # the phone's configuration: the common kernel + the SC7280's + the phone's own
+make kernel # the kernel with the drivers that configuration builds
+make phone SECS=600 # a 10-minute session on the phone, in RAM
+```
+
+The SoC, device and UEFI repositories, at the revisions `devices/manifest.conf` names:
+
+```sh
+tools/hakios-device.py sync
+```
+
## Your machine
| Host | What works | Notes |
diff --git a/docs/index.md b/docs/index.md
index 85dd847..bf3cf54 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -1,55 +1,142 @@
# HakiOS
-**Apple's open-source Darwin kernel (XNU) on Android phones with a Qualcomm SoC**, the way Android is Linux on phones: a boot
-loader of its own, drivers of its own, a configuration system and a version of its own. The same kernel runs in QEMU with nothing
-of Apple's and nothing of any phone's.
+**Apple's open-source Darwin kernel (XNU) on Android phones**, the way Android is Linux on phones: a boot loader of its own, drivers of
+its own, a configuration system and a version of its own. The same kernel runs in QEMU with nothing of Apple's and nothing of any
+phone's.
-Where to start:
+**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 -->
-- [Getting started](getting-started/index.md): the open kernel in QEMU in a few commands, or the Darwin 16.5 user space you lay
- out yourself.
-- [On the phone](getting-started/phone.md): the POCO X5 Pro 5G, in RAM with `fastboot boot`, back to Android with a reboot.
-- [Port a device](porting/index.md): a device is a repository of its own over the common one: a defconfig, a status file, its
- drivers.
-- [Installing beside Android](dual-boot.md): HakiOS as a second system on the POCO X5 Pro, a menu at every start, your data kept.
-- [U-Boot](u-boot.md): the loader started by U-Boot instead of Silicium's UEFI, from RAM, with nothing of the vendor's.
-- [Reference](reference/drivers.md): every driver, configuration symbol and boot argument, made from the source.
+## Guide: run it
+
+| Page | What |
+|---|---|
+| [Getting started](getting-started/index.md) | three ways in, and what your machine needs |
+| [QEMU](getting-started/qemu.md) | the open kernel in a few commands, or the Darwin user space you lay out yourself |
+| [On the phone](getting-started/phone.md) | the POCO X5 Pro 5G, in RAM with `fastboot boot`, back to Android with a reboot |
+| [Windows](windows.md) | the same from a Windows PC: what runs in WSL 2, what in Git Bash; a measured Metal run |
+| [Installing beside Android](dual-boot.md) | HakiOS as a second system, a menu at every start, your data kept ([in Russian](ru/dual-boot.md)) |
+| [Building from source](getting-started/building.md) | when you change something |
+
+## Porting: bring a device
+
+| Page | What |
+|---|---|
+| [Port a device](porting/index.md) | a device is a repository of its own over the common one: a defconfig, a status file, its drivers |
+| [How the repositories fit](porting/repositories.md) | common, SoC, device, UEFI, and the manifest that names them |
+| [Writing a driver](porting/drivers.md) | a driver as an option of the kernel's own configuration |
+| [Drivers in the configuration](drivers-config.md) | `CONFIG_HAKIOS_*`, and how a choice reaches XNU |
+| [Bring-up on a PKG110](port-pkg110.md) | a phone that reports another brand: what was checked on it, and how |
+
+## Drivers and GPU: what each does, and how far
+
+| Page | What |
+|---|---|
+| [Metal on the Adreno](reference/metal.md) | the two Metal paths compared: interfaces, build, boot arguments, how to measure, known gaps |
+| [Metal measurements](reference/metal-measurements.md) | what the phone did, in numbers, and what did not help |
+| [Metal plan](metal-plan.md) | how it got here, step by step |
+| [The shader compiler](air.md), [its report](air-report.md) | Apple's shader bitcode into the Adreno's code |
+| [Metal, why and where the wall is](ru/metal.md) | the first analysis, in Russian |
+| [Development notes](ru/notes.md) | the old README, whole: the history of the work, in Russian |
+| [Devices](devices/index.md) | how far each part works, device by device: [redwood](devices/redwood.md), [QEMU](devices/qemu.md) |
+| [Cellular](cellular.md) | the modem's bring-up ([in Russian](ru/cellular.md)) |
+| [Driver reviews](driver-review/README.md) | each driver read for what it does and what was and was not verified |
+| [Network review](net-review.md) | the network stack, read the same way |
+
+## Concepts: how it fits together
+
+| Page | What |
+|---|---|
+| [Architecture](concepts/architecture.md) | the three programs between a phone's firmware and a user space; what is written to the phone |
+| [Configuration](configs.md) | defconfigs and fragments, like Linux's |
+| [Versioning](versioning.md) | a version string that says what it is built from |
+| [UEFI boot](uefi-boot.md), [U-Boot](u-boot.md) | the two firmwares that can start the loader |
+| [Installing: the design](install.md), [safely](install-safe.md) | what installing means here, and what it must never do |
+
+## Reference: look something up
+
+| Page | What |
+|---|---|
+| [Drivers](reference/drivers.md) | every driver, made from the source |
+| [Boot arguments](boot-args.md) | every argument any part of the system reads, made from the source |
+| [Commands](reference/tools.md) | `make` targets and the scripts below them |
+
+## The project
+
+| Page | What |
+|---|---|
+| [Changelog](../CHANGELOG.md) | what changed, newest first |
+| [Comparison](comparison.md) | HakiOS next to the other XNU-on-a-phone projects |
+| [Legal review](legal-review.md), [LEGAL](../LEGAL.md), [compliance](../COMPLIANCE.md), [third parties](../THIRD_PARTY_LICENSES.md) | what is and is not distributed, and what is still to verify |
+| [Contributing](../CONTRIBUTING.md), [community](../COMMUNITY.md) | how to take part |
+| [The site](site/README.md) | the installer's guide as one web page |
## What works
-The table is made from the devices' own `device.conf`: [all devices](devices/index.md).
+As each device's own `device.conf` records it: [all devices](devices/index.md). Where the Metal row is ahead of a device's file, the
+measurements are the source. The rows about the lock screen and the apps describe what happens when you add layer 2 below yourself.
| | POCO X5 Pro 5G (`redwood`) | QEMU `virt` |
|---|---|---|
-| Lock screen, home screen, the stock apps | yes | yes (slow: the CPU is emulated) |
-| Touch, buttons | yes | yes (the mouse and the keyboard) |
+| Lock screen, home screen, Control Center, the stock apps | yes | yes (slow: the CPU is emulated) |
+| Touch, multitouch, buttons | yes | yes (the mouse and the keyboard) |
+| All 8 CPU cores, the big one at 2.4 GHz | yes | no |
| GPU (OpenGL ES through Mesa) | yes | no |
-| Metal | partly: a device that Metal loads (seen in QEMU); buffers and libraries written, checked on a Mac only; nothing drawn ([plan](metal-plan.md)) | partly, the same |
+| Metal | partly: the window server draws through it, on two paths ([Metal](reference/metal.md)), off by default; swipes 100 to 104 frames a second, not 120; other programs not shown | partly: a device Metal loads; no GPU, nothing drawn |
| Wi-Fi | yes | yes (virtio-net) |
| Sound, microphone | yes | sound only (virtio) |
+| The battery's level | yes | no |
| Cameras, vibration | yes | no |
+| `/private/var` kept across reboots, Sileo, SSH | yes | no |
| Flashlight, temperature guard | partly: written, some of it seen ([redwood](devices/redwood.md)) | no |
-| Cellular | partly: the modem is up and sees the network; no registration yet ([cellular](cellular.md)) | no |
-| Bluetooth | no | no |
+| Cellular | partly: the modem is up, the SIM bound, the network seen; no registration yet ([cellular](cellular.md)) | no |
+| Bluetooth, charging under this kernel, Apple's services | no | no |
## The three layers
1. **The open core**: the kernel port, the loader, the drivers, the tools. All source, in these repositories.
-2. **What you put on top**: the kernel can start a user space you supply; it was built so that it can start Darwin 16.5's, which you
- lay out yourself from Apple's own download. None of it is in the repositories.
+2. **What you put on top**: the kernel can start a user space that you supply. It was built so that it can start the Darwin 16.5 user
+ space, which you lay out yourself from files you download from Apple; nothing of it is shipped, and nothing is circumvented to get
+ it. Whether you may do that, and whether you want to, is your decision.
3. **Apple's services** (activation, Apple ID, iCloud, the App Store): not supported and not a goal.
-By default nothing is installed: the loader goes into RAM, the system lives in RAM for a session, a reboot gives the phone back to
-Android. What is and is not written to a phone: [Architecture](concepts/architecture.md#what-is-written-to-the-phone).
+By default the loader goes into RAM through `fastboot boot`, the system lives in RAM for a session, and a reboot brings the phone back to
+its own Android. The one thing written by default is the loader's own log (a few KB) to the `logdump` partition; with `ufs_write=1` the
+kernel writes only to a partition `darwin` that you create yourself. What is and is not written to a phone:
+[Architecture](concepts/architecture.md#what-is-written-to-the-phone).
+
+## What is in the repository, and what never is
+
+In it: only our own code and data: the patch to Apple's open-source XNU (`xnu/hakios.patch`, APSL 2.0) and our files, the boot loader, our
+programs and libraries, the tools, `prebuilt/` (built from this source; the loader **without** any Apple data: `make loader` makes the one
+that starts Darwin, on your machine, from your own IPSW), and the device and SoC directories. Third parties' files and patches to their
+code are listed with their licenses in [THIRD_PARTY_LICENSES.md](../THIRD_PARTY_LICENSES.md).
+
+Never in it: any file of Darwin (you build the system image on your machine from an IPSW you get yourself and hand to `sysimage/unpack.sh`;
+nothing is downloaded for you, decrypted or circumvented); the phone's firmware (pulled from your own phone into `fw-*/`, which git
+ignores); keys, certificates, activation, or anything that would make the phone pass as an iPhone to Apple.
+
+The core kernel, the boot loader and the open tools build and run with nothing of Apple's: `make qemu-open` is the open kernel, a
+placeholder loader and a tiny raw-syscall user space, in QEMU, with no IPSW, no Darwin user space and no firmware. Booting the stock
+Darwin user space (`make qemu`, `make phone`) is an optional path that needs the IPSW and the phone's firmware, which you supply from your
+own device. Licenses: the XNU patch under the Apple Public Source License 2.0, the terms met as [COMPLIANCE.md](../COMPLIANCE.md) says;
+the rest as the file headers say. None of this is legal advice.
## The repositories
| Repository | What |
|---|---|
| [hakios-xnu-kernel](https://github.com/oosexgang/hakios-xnu-kernel/tree/main) | **common**: the kernel port, every common driver, the loader, user space, the tools, this documentation, and `devices/qemu` |
+| [hakios-metal](https://github.com/oosexgang/hakios-metal) | Metal's command model on the Adreno, through the kernel's GPU driver |
| [hakios-sm7325](https://github.com/oosexgang/hakios-sm7325) | POCO X5 Pro 5G: its defconfig, status, UEFI platform, firmware script, and its SoC's layer (`soc/`: the Qualcomm SC7280 family) |
+| [hakios-mt6768](https://github.com/oosexgang/hakios-mt6768) | Infinix Hot 20 (MediaTek Helio G85): an experimental port with its own loader; not in `devices/manifest.conf` |
| [hakios-uefi](https://github.com/oosexgang/hakios-uefi) | the firmware that starts the loader: Mu-Silicium with HakiOS's boot path, banner and name, and HakiOS's U-Boot (`u-boot/`) |
-| [hakios-metal](https://github.com/oosexgang/hakios-metal) | Metal's command model on the Adreno, through the kernel's GPU driver |
+| [hackios-web](https://github.com/oosexgang/hackios-web) | the website, which carries a copy of these pages |
+| [hackios-xnu-userland](https://github.com/oosexgang/hackios-xnu-userland) | old: a pointer. User space is `userland/` in the common repository |
-`devices/manifest.conf` in the common repository names each one and the revision it is at; `tools/hakios-device.py sync` clones them
-into `devices/` and `uefi/`. One repository per device: it carries its SoC's layer, and `tools/hakios-device.py new` makes one. [How the repositories fit](porting/repositories.md).
+`devices/manifest.conf` in the common repository names the device and UEFI repositories and the revision each is at;
+`tools/hakios-device.py sync` clones them into `devices/` and `uefi/`. One repository per device: it carries its SoC's layer, and
+`tools/hakios-device.py new` makes one from the phone's own device tree, with every phone driver left out until it is ported. Each driver is
+an option of the kernel's own configuration (`CONFIG_HAKIOS_*`, XNU's `options` and `conf/files`), so a device's defconfig builds exactly the
+drivers it has. [How the repositories fit](porting/repositories.md).
diff --git a/docs/metal-plan.md b/docs/metal-plan.md
index c25e99d..46b7aec 100644
--- a/docs/metal-plan.md
+++ b/docs/metal-plan.md
@@ -1,15 +1,30 @@
# Metal on the Adreno: the plan, and where it stands
+**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, 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 -->
+
+## What became of the plan
+
+| Question the plan left open | The answer |
+|---|---|
+| Steps 3 to 7 (buffers, library, queue, render, present) | done on the phone, in [hakios-metal](https://github.com/oosexgang/hakios-metal) and `userland/src/HakiosMetalCA.m` (`METAL_PLUGIN=ca`) |
+| Compiler or Metal on Vulkan, "which is less work from here"? | both were done; on this GPU the direct compiler is about twice as fast today |
+| QuartzCore's `default.metallib`, which this system has not got | `tools/ca-metallib.py` makes it on your machine, from QuartzCore's own variants and a later CoreAnimation's library you supply |
+| `metal=1` kills the window server | no longer: `tools/metal-run.sh` runs with it on, and it is still off by default |
+| Whether the framebuffer counts frames | it does, every 5 s (`tools/metal-run.sh`'s summary); `tools/frames.py` counts them per gesture from the `tl:` lines |
+
Read `docs/ru/metal.md` (why Metal is not simply missing, and what is on each side of the wall) and `docs/air.md` (the
-shader compiler) first. This file is the order of work, with how each step is checked and where.
+shader compiler) first. The rest of this file is the order of work, with how each step is checked and where.
## The three parts
| Part | What it is | State |
|---|---|---|
| **A. The shader compiler** | Apple's shader bitcode (AIR, in a `.metallib`) into Mesa's NIR, so that ir3 (the compiler behind the OpenGL ES that already runs) makes Adreno code | largely done: 321 of the system's 456 shader modules reach ir3, 54 have run on the phone's GPU (`docs/air.md`, `docs/air-report.md`) |
-| **B. The device** | what Metal loads: a bundle with a subclass of Metal's private `_MTLDevice`, and the objects it hands out (buffers, libraries, pipeline states, queues, command buffers, encoders: 53 classes and about 1200 methods in Apple's own) | step 1 ran in QEMU; buffers and libraries (step two, below) are written and checked on a Mac |
-| **C. The kernel side** | submitting work to the GPU for a Metal client, with memory and fences | the GPU already has a user client for Mesa (`drivers/gpu/hakios.gpu.cpp`, `HakiosGPUUserClient`); it is not connected to B |
+| **B. The device** | what Metal loads: a bundle with a subclass of Metal's private `_MTLDevice`, and the objects it hands out (buffers, libraries, pipeline states, queues, command buffers, encoders: 53 classes and about 1200 methods in Apple's own) | done for the window server: `userland/src/HakiosMetalCA.m` over hakios-metal; or UniXNU's frontend with `metal_m2v=1` |
+| **C. The kernel side** | submitting work to the GPU for a Metal client, with memory and fences | done: `HakiosGPUUserClient` (`drivers/gpu/hakios.gpu.cpp`) serves both paths; request `0x7d` takes a client's own pages as a buffer |
What "real Metal" would be, and why games are out of reach, is argued in `docs/ru/metal.md` section 9.4: that has not
changed. What this plan aims at is the part that is within reach: **Metal clients of the system itself** (the window
@@ -119,14 +134,16 @@ command buffer and compute encoder on the GPU's buffers (part C), which need the
## What UniXNU's AdrenoMetal showed, and what was taken
[UniXNU](https://github.com/UniXNU) runs iPadOS 17 on a Xiaomi Pad 6S Pro (SM8550, Adreno 740), and its
-[AdrenoMetal](https://github.com/UniXNU/AdrenoMetal) (MIT) composes the system UI on the GPU. Read on 27 October 2026; no code of
-it is in this repository, the facts below are written here in our own words and code, with the source named where it is used.
+[AdrenoMetal](https://github.com/UniXNU/AdrenoMetal) (MIT) composes the system UI on the GPU. Read on 27 October 2026; the facts below
+are written here in our own words and code, with the source named where it is used. Since 3 November `tools/mk-m2v.sh` also fetches and
+builds it on your machine, and only our patches to it are in this repository (`tools/m2v/`): [Metal on the Adreno](reference/metal.md),
+[third-party licenses](../THIRD_PARTY_LICENSES.md).
- **Their route is Metal on Vulkan**: the plug-in's device is a subclass of `_MTLDevice` (as ours), and every Metal object is
translated by a runtime of theirs ("metal2vulkan", `bridge/NativeMetalObjects.rs`) onto Turnip, Mesa's Vulkan driver for Adreno,
over the kernel's GPU interface. Ours is AIR through NIR to ir3 directly (part A), on the same Mesa. Turnip supports the A6xx
- generation our Adreno 642L belongs to, so their route is open to this port as well; which of the two is less work from here is
- the question of the next step, and it is not decided here.
+ generation our Adreno 642L belongs to, so their route was open to this port as well. On 3 November it was taken too, and the two
+ now run side by side, chosen at boot.
- **Universal metallibs.** Newer systems ship framework libraries as a fat container (0xCAFEBABE) of an AIR64 slice and a binary
for Apple's GPUs (QuartzCore's `default.metallib` on iPadOS 17). `hakios_metallib_thin()` takes the AIR64 slice, as Metal does;
`tools/metallib-test.sh` and `tools/metal-plugin-test.sh` check it. Darwin 16.5's libraries are all thin.
@@ -136,11 +153,14 @@ it is in this repository, the facts below are written here in our own words and
- **Clients by a file.** A file beside the bundle names the processes shown the device. `HakiosMetal.clients` does the same here,
on top of `metal=N`.
- **The window server needs QuartzCore's own `default.metallib`.** Their system image has it; Darwin 16.5's (this port's) does not,
- which is the wall of step 7 above. It is not something the plug-in can supply: the library is Apple's.
+ which is the wall of step 7 above. It is not something the plug-in or this repository can supply, the library being Apple's:
+ `tools/ca-metallib.py` makes one on your machine from what you supply.
## Frame skips
-A dropped frame is not a Metal problem, and Metal would not cure it: the screen of this port is drawn today by
+(Written before Metal drew anything. Frames are counted now: [how to measure](reference/metal.md#measure).)
+
+A dropped frame is not a Metal problem, and Metal would not cure it: the screen of this port was then drawn by
CoreAnimation's OpenGL ES renderer through Mesa (`gpu=1`), and its pace depends on the submit path, the fences and the
present. What to measure first, on the phone, is already counted: `gGPUStat` in `drivers/gpu/hakios.gpu.cpp` (submissions,
waits, what each cost, every five seconds). Whether the framebuffer stand-in (`MiniIOMobileFramebuffer.cpp`) counts
@@ -151,5 +171,6 @@ in those numbers is in the compositor, not the driver. This needs a stable GPU r
## What is not claimed
-Nothing here draws. No Metal client has used this device for anything: the first one that tried (the window server) asked
-for a command queue and stopped. Everything above was seen in QEMU; none of it was run on the phone.
+That 120 frames a second has been reached: it has not. That a Metal program in general runs: only the window server's use of Metal is
+shown, and the checks of `metal_test`, `vk_test` and `m2v_test`. That games run: section 9.4 of `docs/ru/metal.md` still stands. The
+sections above dated 27 October say what was seen in QEMU then; the phone came after them.
diff --git a/docs/reference/drivers.md b/docs/reference/drivers.md
index 6241a20..3af1d8d 100644
--- a/docs/reference/drivers.md
+++ b/docs/reference/drivers.md
@@ -53,7 +53,7 @@ Every driver the kernel can be built with. `CONFIG_HAKIOS_<NAME>=y` in a defconf
| Driver | Files | Requires | Boot arguments | qemu | redwood | |
|---|---|---|---|---|---|
-| **`HAKIOS_ADRENO`**<br>the Adreno 642L of the SC7280 woken step by step (adreno=N), and HakiosGPU, the IOKit service Mesa and the window server draw through (gpu=1, adreno_keep=1). Needs the GPU's firmware from the phone (fw-gpu/) | `hakios.adreno.c`<br>`hakios.gpu.cpp` | | `adreno=`, `adreno_blind=`, `adreno_dirty=`, `adreno_fine=`, `adreno_keep=`, `adreno_only=`, `adreno_pause=`, `adreno_return=` and 10 more | | built | |
+| **`HAKIOS_ADRENO`**<br>the Adreno 642L of the SC7280 woken step by step (adreno=N), and HakiosGPU, the IOKit service Mesa, Metal and the window server draw through (gpu=1, adreno_keep=1; docs/reference/metal.md). Needs the GPU's firmware from the phone (fw-gpu/) | `hakios.adreno.c`<br>`hakios.gpu.cpp` | | `adreno=`, `adreno_blind=`, `adreno_dirty=`, `adreno_fine=`, `adreno_keep=`, `adreno_only=`, `adreno_pause=`, `adreno_return=` and 10 more | | built | |
## haptic
diff --git a/docs/reference/metal-measurements.md b/docs/reference/metal-measurements.md
new file mode 100644
index 0000000..bef1e8f
--- /dev/null
+++ b/docs/reference/metal-measurements.md
@@ -0,0 +1,100 @@
+# Metal measurements
+
+What the phone did, in numbers. How to get the same numbers: [Metal on the Adreno](metal.md#measure). **120 frames a second has not
+been reached**: not on hakios-metal, not on metal2vulkan, and not on OpenGL ES.
+
+## The setup
+
+| | |
+|---|---|
+| Phone | POCO X5 Pro 5G (`redwood`), SM7325 |
+| GPU | Adreno 642L at 550 MHz, the most this phone's GPU is rated for (`adreno_speed=3`, the default) |
+| User space | the Darwin 16.5 user space, laid out from your own IPSW |
+| Panel | 1080 x 2400 at 120 Hz |
+| Rendered | 1125 x 2436, scaled onto the panel by the driver |
+| The run | `tools/metal-run.sh`: eight cores, `fb_hz=120 fb_threads=6 touch_poll_us=4000`, the round of `rc.jobs.bench` four times |
+
+## The results
+
+Frames a second, 3 and 4 November 2026.
+
+<!-- FINAL-NUMBERS -->
+
+| Motion | hakios-metal | metal2vulkan |
+|---|---|---|
+| Page swipe | 100 to 104 | 50 to 57 |
+| Settings' scroll | about 90 | 41 |
+| Opening an app | about 90 | not recorded |
+| Home button | 28 with `wallpaper_cache=1`; 78 with the wallpaper hidden | 41 to 57 |
+| GPU time a frame | about 10 ms at the home screen | 14 to 21 ms |
+
+Both draw the system correctly.
+
+**hakios-metal, inside a swipe.** Once the finger has lifted, 185 of the animation's 205 frames take 8.3 ms, one refresh of the panel.
+While the finger drags, frames come at 75 to 80 a second, and the window server waits 8 to 14 ms on GPU fences. The 100 to 104 in the
+table covers both: `tools/frames.py` counts a gesture from the touch going down.
+
+**metal2vulkan.** `tu_debug=gmem` and `tu_debug=sysmem` gave the same rates. Each frame renders to a tiled image and merges back into
+the IOSurface with a compute pass. The linear attachment path (`VK_NV_linear_color_attachment`) stays unused: the pass has a second
+attachment that is not linear, and the extension wants every colour attachment linear. With `tu_debug=perf`, no barrier turned GMEM
+off and no texture was shadowed.
+
+## Tried, and it did not help
+
+| What | Arguments | Result |
+|---|---|---|
+| Touch samples at 250 a second, not 125 | `touch_poll_us=4000`, `rwtouch` every 4 ms | swipes 100 to 102: unchanged |
+| Surfaces let go of as soon as their pixels are on the panel, not when the next frame comes | in `MiniIOMobileFramebuffer` | unchanged |
+| The iPhone XR's screen class, 1.85 times fewer pixels | `fbwidth=828 fbheight=1792 fbscale=2 fbsubtype=1792` | idle GPU time 2.2 ms, not 6.8; gestures not faster; the wallpaper black |
+| The iPhone 12 mini's screen class | `fbwidth=`, `fbheight=`, `fbscale=`, `fbsubtype=` | 103 to 107, with the red rdar://45025538 status bar |
+| The wallpaper hidden, for swipes | `wallpaper_freeze=2` | 101 to 103, as with it: the wallpaper is not what holds swipes under 120. It is what holds the home button |
+
+## What did help
+
+On hakios-metal, each as the commit that made the change measured it, in the order they were found.
+
+| Change | Before | After |
+|---|---|---|
+| Eight cores, not one, for the first boot | first frame at 159 s | 86 s |
+| `fb_threads=6`, not 3 | Settings' scroll 75 | 84 |
+| `wallpaper_cache=1` | swipes 85 to 91; an app's close 40 | swipes 97 to 103; an app's close 22 to 30, slower: the poster changes under its zoom |
+| `ui_lite=1` | an app's close 40 | 55 to 58, with Reduce Transparency and Reduce Motion on |
+| `luma_boost` left out, where QuartzCore's library has its own | 83% of the GPU's timed passes | gone; `metal_luma_boost=1` draws it |
+
+## metal2vulkan, on the way
+
+| When (3 November) | What | Result |
+|---|---|---|
+| `vk_test` | Turnip alone | a submission and its fence wait 0.5 ms at best, 2.0 on average |
+| `m2v_test` | the Metal device alone | a full-screen clear committed and waited for in 1.08 ms |
+| the window server, first | **the picture was wrong**: grey shapes, the variants not chosen yet | 3456 command buffers, 0 failed, 226k draws in 150 s; swipes 71 to 80, scroll 47, an app's open 25, GPU 17 to 36 ms a frame |
+| the window server, right | the variants chosen by label, own pages as textures | swipes 50 to 57, scroll 41 |
+
+The first window-server numbers are higher than the later ones because less was being drawn. They are here so that nobody takes them
+for a result.
+
+## OpenGL ES, for comparison
+
+The default path, which is not Metal: Settings scrolled at 107 to 114 a second on the four big cores (`cpus=4`, `fb_hz=120 ca_vbl=1`,
+31 October, [hakios-sm7325](https://github.com/oosexgang/hakios-sm7325) `a8e7a87`). The conditions differ from the table above in the core count and in the day's kernel, so that is a reference point and not
+a comparison run.
+
+## Tearing
+
+The panel reads the very buffer the driver writes. It takes the scan 8.3 ms to read it and the driver about 3 ms to write it, so a frame
+written across the line being read came out torn: a piece of the last frame and a piece of this one, moving bands with doubled icons and
+text wherever something moved. Seen on the phone.
+
+PENDING: `fb_beam`, the default once its commit lands, writes each thread's rows behind the scan line, read from the interface's own
+`INTF_LINE_COUNT`, so that the next scan reads all of the new frame. The scan measured 2433 lines, 8338 us. The bands were gone. If the
+counter does not count as a line counter should, frames stay on their beat, and the log says so.
+
+The frame rates with `fb_beam` are still being tuned, and the table at the top is without it.
+
+<!-- FINAL-NUMBERS -->
+
+| With `fb_beam` | hakios-metal |
+|---|---|
+| Page swipe | being tuned |
+| Settings' scroll | being tuned |
+| Home button | being tuned |
diff --git a/docs/reference/metal.md b/docs/reference/metal.md
new file mode 100644
index 0000000..c51e53c
--- /dev/null
+++ b/docs/reference/metal.md
@@ -0,0 +1,189 @@
+# Metal on the Adreno
+
+Two implementations of Metal draw the window server on the phone's Adreno 642L. This page says what each is, how to build, run and
+measure it, and what is not known. The numbers: [Metal measurements](metal-measurements.md). How it got here, step by step:
+[the plan](../metal-plan.md).
+
+**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 about 90. 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
+
+| | hakios-metal | metal2vulkan |
+|---|---|---|
+| Route | Metal, `HakiosMetalCA`, hakios-metal (the Adreno's own PM4 packets), HakiosGPU | Metal, AdrenoMetal's frontend, metal2vulkan, Turnip, `hakios-drm`, HakiosGPU |
+| Shaders | AIR to NIR to ir3, by Mesa's compiler inside the process | AIR through metal2vulkan into Vulkan pipelines, which Turnip compiles |
+| Where the code is | `userland/src/HakiosMetalCA.m` here, [hakios-metal](https://github.com/oosexgang/hakios-metal) beside this tree | `tools/mk-turnip.sh`, `tools/mk-m2v.sh`, `tools/m2v/`, `tools/mesa/`; the rest fetched by those scripts |
+| Whose | ours; the plug-in began as vcvkk's (origin **to verify**, [third-party licenses](../../THIRD_PARTY_LICENSES.md)) | [UniXNU](https://github.com/UniXNU/UniXNU)'s stack, ported from the Adreno 740 and a later system |
+| Build | `METAL_PLUGIN=ca` | `METAL_PLUGIN=ca TURNIP=1 M2V=1` |
+| Boot arguments | `gpu=1 metal=1 ca_metallib=...` | the same and `metal_m2v=1` |
+| Page swipe, frames a second | 100 to 104 | 50 to 57 |
+| GPU time a frame | about 10 ms at the home screen | 14 to 21 ms |
+| In `prebuilt/` | no | no, and it must not be without the check below ([Licenses](#licenses)) |
+
+The third path is the default one, and it is not Metal: CoreAnimation's OpenGL ES renderer through Mesa's freedreno (`gpu=1`, an image
+built with `GL=1`).
+
+## Interfaces
+
+### HakiosGPU (`drivers/gpu/hakios.gpu.cpp`)
+
+The kernel's GPU driver serves all three paths through the same IOKit user client. Its requests are Linux's msm DRM requests by
+number, and two of its own:
+
+| Request | Takes | Does |
+|---|---|---|
+| `0x7e` | an IOSurface's ID | a buffer over the surface; asked with `kHakiosDescribe`, only what it would be like |
+| `0x7d` | an address and a size in whole pages of the caller's own (`struct hakios_user_memory`) | a buffer over those pages, Linux's userptr. Wired through an `IOMemoryDescriptor` over the caller's task for as long as the buffer lives, entered into the GPU's address space, pushed out of the CPU's cache by physical address at every submission naming them. Read-only pages are taken as such: a window server's view of another program's backing store. Unwired when the buffer goes, and never kept for reuse. Each refusal is logged with its reason |
+
+### Turnip on Darwin (`tools/mesa/turnip-darwin.patch`, `tools/mesa/hakios-drm/`)
+
+Mesa 25.0.7's Vulkan driver, cross-built with its msm backend and no DRM window system.
+
+- `hakios-drm` stands in for libdrm. Requests become calls of HakiosGPU's user client. DRM syncobjs, which Turnip makes its fences and
+ semaphores of, are kept in the process over the kernel's fences: timelines, waits, signal, query, transfer. There is one GPU and
+ one connection in a process, which is why that is enough.
+- `VK_EXT_external_memory_host`: an IOSurface's pointer is imported by the surface's ID (the frontend says which surface is mapped
+ where, `hakios_drm_host_surface`), any other page-aligned pointer through request `0x7d`.
+- `VK_NV_linear_color_attachment`: linear tiling already had every feature of optimal tiling in Turnip; the extension says so.
+- `vkGetInstanceProcAddr` is exported: there is no Vulkan loader, and metal2vulkan opens the driver by that entry point.
+- The cache line size comes from `hw.cachelinesize`, since `CTR_EL0` traps in user space; buffers are mapped through `hakios_drm_map`.
+
+### The window server (`userland/src/HakiosMetalCA.m`)
+
+QuartzCore on this system has its uber shaders only as specialised variants inside `default.pipelinelib`, and no `default.metallib` at
+all. Two things follow, on either path:
+
+- `tools/ca-metallib.py` makes the `default.metallib` the window server asks for, from QuartzCore's own variants and a later
+ CoreAnimation's library that you supply. It stays on your machine, and `ca_metallib=` names it at boot.
+- The plug-in picks the variant by the pipeline's label. For metal2vulkan that goes through `native_bridge_metal_variant_hook`, which
+ `tools/m2v/adrenometal-ios16.patch` adds to the frontend. `HakiosMetalCA` also gives the metal2vulkan device its own opening of
+ QuartzCore's pipeline library and a `targetDeviceInfo`: without them the pictures came out as grey shapes.
+
+## Build
+
+Everything runs on Linux or in WSL 2 (commands for Windows: [Windows](../windows.md#metal-a-run-measured-from-windows)). Neither path
+works from `prebuilt/` alone: `PREBUILT=1` compiles nothing, and `prebuilt/userland` has no Metal plug-in, so these need the cross
+toolchain of `xnu-deps/setup.sh`.
+
+The library the window server asks for, for either path:
+
+```sh
+CA_QC_METALLIB=/path/to/default.metallib tools/ca-metallib.py ~/ca-share # off a Mac; on a Mac it reads the Mac's own
+```
+
+**hakios-metal.** The repository goes beside this one, or `HAKIOS_METAL=` names it:
+
+```sh
+(cd ../hakios-metal && make ios HAKIOS=../hakios-xnu-kernel MESA=1) # needs tools/mk-mesa.sh's tree
+METAL_PLUGIN=ca RC_JOBS=rc.jobs.bench EXTRA_SHARE=~/ca-share REST=1 SYSTEM=1 userland/build.sh
+```
+
+**metal2vulkan.** Nothing of it is in `prebuilt/`: you fetch and build it yourself. You need what `tools/mk-mesa.sh` needs,
+`glslangValidator` (apt: `glslang-tools`), rustup's cargo with Rust 1.98 and its `aarch64-apple-ios` target, `llvm-as` of LLVM 21
+(apt: `llvm-21`), clang, and the theos iPhoneOS 16.5 SDK.
+
+```sh
+tools/mk-mesa.sh # Mesa 25.0.7 with tools/mesa/*.patch
+tools/mk-turnip.sh # xnu-deps/build/mesa/out/libvulkan_freedreno.dylib
+tools/mk-m2v.sh # xnu-deps/build/m2v/out/: frontend.o, libadreno_metal_bridge.a
+METAL_PLUGIN=ca TURNIP=1 M2V=1 RC_JOBS=rc.jobs.bench EXTRA_SHARE=~/ca-share REST=1 SYSTEM=1 userland/build.sh
+```
+
+Build these before the image: `userland/build.sh` links metal2vulkan into the plug-in only if `xnu-deps/build/m2v/out` is already there.
+`tools/mk-m2v.sh` pins [UniXNU/AdrenoMetal](https://github.com/UniXNU/AdrenoMetal) at `243d63c` and
+[steelbrain/metal2vulkan](https://github.com/steelbrain/metal2vulkan) at `624bab3` with AdrenoMetal's 30 patches, and adds
+`tools/m2v/`. Programs and libraries over 4 MB go into the system image, with a link in the small one (`/usr/local/redwood`).
+
+Two programs check the path before the window server is involved:
+
+| Image | Boot | The program | On the phone (3 November) |
+|---|---|---|---|
+| `TURNIP=1 RC_JOBS=rc.jobs.vktest` | `gpu=1` | `userland/src/vk_test.c`: Turnip once round | `Adreno 7c+ Gen 3`, Vulkan 1.3.305, a 4 MB `vkCmdFillBuffer` checked word by word, a submission and its fence wait 0.5 ms at best, 2.0 on average: PASS |
+| `TURNIP=1 M2V=1 RC_JOBS=rc.jobs.m2vtest` | `gpu=1` | `userland/src/m2v_test.m`: the Metal device, a blit, a clear, surfaces and own pages as textures | the device in 134 ms, a 4 MB blit fill and a 1080 x 2400 clear checked word by word and pixel by pixel, a full-screen clear committed and waited for in 1.08 ms: PASS |
+
+## Boot arguments
+
+Every argument is in [the catalogue](../boot-args.md), which is made from the source; this table says what the ones of Metal do.
+
+| Argument | Layer | What it does |
+|---|---|---|
+| `metal=1` | kernel, plug-in | the accelerator names the Metal plug-in; without it the window server finds no device and stays on OpenGL ES, saying nothing. With `METAL_PLUGIN=ca` the window server alone is shown the device (`metal_all=1`: every process) |
+| `ca_metallib=PATH` | `inject.c` | QuartzCore's library for the window server |
+| `metal_m2v=1` | plug-in | the window server's device is metal2vulkan's. Needs an image built with `M2V=1` |
+| `tu_debug=FLAGS` | plug-in | Turnip's `TU_DEBUG` in the window server (`sysmem`, `gmem`, `perf`, ...); with `metal_m2v=1` |
+| `m2v_utrace=1` | plug-in | Turnip's GPU trace of every render pass into a file; the 30 commonest events of each 5 s printed. With `metal_m2v=1` |
+| `metal_fps=1` | plug-in | frame and pass counters every 5 s: what `tools/metal-run.sh` sets |
+| `metal_fps=passes` | plug-in | also every pass of one slow command buffer in 200, with its attached and touched colour attachments |
+| `metal_fps=mainpass` | plug-in | also the draws of a pass of 40 draws or more over 4 ms (in sysmem, where draws are timed) |
+| `metal_fps=draws` | plug-in | also each draw of a sysmem pass timed alone, and the time counted by program |
+| `metal_defer=1` | plug-in | the window server's command buffers recorded on a thread of hakios-metal's own: a draw costs its render thread about 5 us instead of about 40 |
+| `metal_luma_boost=1` | plug-in | draws `luma_boost`, which is otherwise left out where the library has its own |
+| `wallpaper_cache=1` | SpringBoard | the wallpaper's window rasterized by the window server |
+| `wallpaper_freeze=2` | SpringBoard | the wallpaper hidden: what it costs, measured |
+| `wallpaper_freeze=1` | SpringBoard | the wallpaper's window as one still picture. In this tree the picture comes out one colour and is not used. PENDING: taken from the IOSurface on the panel (`kern.hakios.fb_surface`) |
+| `ui_lite=1`, `ui_lite=0` | SpringBoard | Reduce Transparency and Reduce Motion on, off again. Without it the settings are left alone |
+| `fbwidth=`, `fbheight=`, `fbscale=`, `fbsubtype=` | framebuffer | another iPhone's screen class: `fbwidth=828 fbheight=1792 fbscale=2 fbsubtype=1792` is the XR's |
+| `touch_poll_us=N` | touch driver | the touch screen read every N microseconds. The driver's default is 8000; `tools/metal-run.sh` sets 4000 |
+| `fb_hz=120`, `fb_threads=6`, `fb_measure=1` | framebuffer | the driver's beat at the panel's rate, six processors scaling a frame onto the panel, the panel's own rate measured once |
+| `fb_beam=1` | framebuffer | PENDING, not in this tree's kernel until that commit lands. The default: each thread's rows are written behind the panel's scan line. `fb_beam=0`: whenever the beat comes, as before. [Tearing](metal-measurements.md#tearing) |
+
+PENDING also: the sysctl `kern.hakios.fb_surface`, the IOSurface last put on the panel.
+
+## Measure
+
+```sh
+tools/metal-run.sh # 180 s, hakios-metal; the summary in logs/<time>-metal.txt
+MORE="metal_m2v=1" tools/metal-run.sh # the same on metal2vulkan
+MORE="wallpaper_cache=1" tools/metal-run.sh # any argument beside the defaults; a later one of a name wins
+```
+
+An image built with `RC_JOBS=rc.jobs.bench` unlocks, waits a minute for the start-up work to end, and does the same round four times:
+Settings opened from its icon, its list scrolled, the home button, a page swipe there and back. So each kind of motion is measured
+four times in the same state of the system, and runs can be compared.
+
+`tools/metal-run.sh` takes the phone from Android, its bootloader or the loader, uploads the system image, runs, and writes a summary:
+`tools/frames.py`'s frames per gesture, the plug-in's `fps:` lines, what was refused, the frames on the panel, the shader cache and any
+crash. It sets `gpu=1 metal=1 metal_fps=1 touch_lat=1 touchscreen=1 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`, 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.
+
+`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
+drawing through Metal says no `tl: g`: its frames are counted by the swap that handed each over, so `draw` and `idle` are 0 there,
+meaning unknown.
+
+## Known gaps
+
+- **Under 120.** While a finger drags, the window server waits 8 to 14 ms on GPU fences and frames come at 75 to 80 a second; after
+ the finger lifts, 185 of 205 frames of a swipe take 8.3 ms. The cause of the wait is not established.
+- **The home button** takes 28 frames a second with `wallpaper_cache=1` and 78 with the wallpaper hidden. The wallpaper is many
+ full-screen layers from another process, and rasterizing its window does not stop them being composed again.
+- **metal2vulkan renders each frame to a tiled image and merges it back with a compute pass.** The linear attachment path stays unused
+ because a second, non-linear attachment is in the pass, and the extension wants every colour attachment linear.
+- **Tearing.** The panel reads the one buffer the driver writes. `fb_beam` is the answer being tuned; it is not in this tree yet.
+- **Not the same stack as UniXNU's.** Theirs runs on the Adreno 740 with its own kernel driver, [Adreno740](https://github.com/UniXNU/UniXNU/blob/main/docs/drivers/adreno740.md),
+ and a newer system. Only the part above that driver was taken. What is measured here says nothing about theirs.
+- **hakios-metal is not pinned.** `userland/build.sh` takes whatever is beside the tree; `metal_defer=1` needs its
+ `hakios_metal_queue_set_deferred`.
+- **Other systems' libraries.** The window server's library takes the rest of its shaders from a later CoreAnimation than this
+ system's, because this system has none. That it behaves the same as a matched one is not shown.
+
+## What is not verified
+
+- The results are of one phone, a POCO X5 Pro 5G. No other Adreno has run either path, and QEMU has no GPU.
+- They are of the bench's runs, 180 s by default. They do not say how the rates hold over a longer run or with a hot phone, and they
+ take the GPU's clock as the 550 MHz it is set to, not as read back frame by frame.
+- The only client they describe is the system's own interface. Nothing here shows that a Metal program in general runs, and games
+ are not claimed.
+- The build commands above were written from the scripts and were not re-run on a clean machine when this page was written.
+- HakiosGPU's request `0x7d` lets a client wire its own pages. It has not been through a [driver review](../driver-review/gpu-display.md).
+- The frame rates are what `tools/frames.py` counts from the window server's swaps and the driver's frames, not a camera on the panel.
+
+## Licenses
+
+metal2vulkan is `GPL-2.0-or-later OR LGPL-3.0-or-later`. `M2V=1` links its runtime statically into the plug-in and `m2v_test`, so a
+binary built that way has obligations whichever you choose. Whether and how such a binary may be distributed is **to verify**, and none
+is distributed: [third-party licenses](../../THIRD_PARTY_LICENSES.md), [compliance](../../COMPLIANCE.md).
diff --git a/docs/reference/tools.md b/docs/reference/tools.md
index 0cb60da..37edf07 100644
--- a/docs/reference/tools.md
+++ b/docs/reference/tools.md
@@ -41,6 +41,12 @@ Every `make` target is a script below it; run the script itself for its options
| `provenance-check.py` | nothing in the tree that must not be, and every piece of code that can write to a phone declared | |
| `metallib.py` | a `.metallib` taken apart | [AIR](../air.md) |
| `metallib-test.sh`, `metal-plugin-test.sh` | the Metal plug-in's reading of libraries and its objects, under sanitizers | [Metal plan](../metal-plan.md) |
+| `metal-run.sh` | one Metal run on the phone, measured, with a summary in `logs/` | [Metal](metal.md#measure) |
+| `frames.py` | how evenly the frames of a run's gestures came, and what held up the slow ones | [Metal](metal.md#measure) |
+| `ca-metallib.py` | QuartzCore's `default.metallib` for the window server, on your machine, from what you supply | [Metal](metal.md#the-window-server-userlandsrchakiosmetalcam) |
+| `metal-cache-seed.sh` | the window server's compiled shader stages off the phone, into the next image | [Windows](../windows.md#metal-a-run-measured-from-windows) |
+| `mk-mesa.sh`, `mk-turnip.sh` | Mesa 25.0.7 for the Darwin user space, and its Vulkan driver | [Metal](metal.md#build) |
+| `mk-m2v.sh` | UniXNU's Metal on Vulkan: AdrenoMetal's frontend over metal2vulkan, fetched at pinned revisions | [Metal](metal.md#build) |
| `modem-cycle.sh` | a whole phone session in one command | [On the phone](../getting-started/phone.md) |
| `soc-args.py` | the `soc_*` addresses out of a device tree | |
| `backup-partitions.py` | a read-only backup of the phone's partitions, each copy proven | [Install, safely](../install-safe.md) |
diff --git a/docs/ru/metal.md b/docs/ru/metal.md
index d0a3be5..eb9bcd8 100644
--- a/docs/ru/metal.md
+++ b/docs/ru/metal.md
@@ -1,5 +1,15 @@
# Metal
+> **Обновление, 4 ноября 2026.** Этот разбор написан в октябре, и вывода раздела 4 («(В): ни то, ни другое») больше нет: теперь оконный
+> сервер рисует через Metal на Adreno 642L телефона, двумя путями, и оба рисуют правильно. **hakios-metal** (близко к пути (А) раздела 4,
+> без Vulkan: AIR через NIR в ir3, собственные пакеты PM4): перелистывание страниц 100–104 кадра в секунду, прокрутка Settings около 90.
+> **metal2vulkan** (стек UniXNU: фронтенд AdrenoMetal, metal2vulkan, Turnip — пути, которого в разделе 4 не было): перелистывание 50–57,
+> прокрутка 41. Панель 120 Гц; **120 кадров в секунду не достигнуто**. Без `metal=1` система по-прежнему рисует через OpenGL ES. Стена с
+> `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, где проходит граница, которую пришлось бы реализовать, и
стоит ли её переходить. Всё, что ниже, проверено по извлечённой системе
(`sysimage/rootfs`, кэш `sysimage/20F66__iPhone10,3_6/dyld_shared_cache_arm64`), по исходникам порта и
diff --git a/docs/windows.md b/docs/windows.md
index aec592a..8a39546 100644
--- a/docs/windows.md
+++ b/docs/windows.md
@@ -67,22 +67,44 @@ Nothing is flashed: everything is booted from RAM, and a reboot brings Android b
## Metal: a run, measured, from Windows
-The window server drawing through Metal (`METAL_PLUGIN=ca`) and the frame-rate bench, with one command in Git Bash.
+The window server drawing through Metal (`METAL_PLUGIN=ca`) and the frame-rate bench, with one command in Git Bash. What the two paths
+are and what the arguments do: [Metal on the Adreno](reference/metal.md).
+
+The plug-in is compiled, so the build needs the cross toolchain (`xnu-deps/setup.sh`) and [hakios-metal](https://github.com/oosexgang/hakios-metal)
+beside the checkout; `PREBUILT=1` compiles nothing, and `prebuilt/userland` has no plug-in.
```sh
# WSL, in ~/hakios: QuartzCore's library for CoreAnimation, then the image with the Metal plug-in and the bench.
# Off a Mac, name a later CoreAnimation's library to take the rest of its shaders from (a Mac's
-# QuartzCore.framework/Versions/A/Resources/default.metallib copied over, or iOS 17's out of its IPSW):
+# QuartzCore.framework/Versions/A/Resources/default.metallib copied over, or a later system's out of its IPSW):
CA_QC_METALLIB=/mnt/c/.../default.metallib tools/ca-metallib.py ~/ca-share
-METAL_PLUGIN=ca RC_JOBS=rc.jobs.bench EXTRA_SHARE=~/ca-share PREBUILT=1 REST=1 SYSTEM=1 userland/build.sh
+(cd ../hakios-metal && make ios HAKIOS=../hakios MESA=1)
+METAL_PLUGIN=ca RC_JOBS=rc.jobs.bench EXTRA_SHARE=~/ca-share REST=1 SYSTEM=1 userland/build.sh
cp userland/root.apfs userland/system.apfs /mnt/d/.../hakios/userland/
# Git Bash, in the Windows checkout (the phone in Android is fine: the script takes it into the loader):
tools/metal-run.sh # 180 s; the summary in logs/<time>-metal.txt
MORE="metal_gmem=1" tools/metal-run.sh # with tiled rendering (each pass left in sysmem says why)
+MORE="wallpaper_cache=1" tools/metal-run.sh # any boot-argument beside the defaults; a later one of a name wins
SHOTS=20 tools/metal-run.sh # and a screenshot every 20 s, logs/<time>-shots/
```
+For UniXNU's Metal on Vulkan, build its pieces in WSL first, then the same image with two more options, and name it at boot. It takes
+rustup's cargo with Rust 1.98 and the `aarch64-apple-ios` target, `llvm-as` of LLVM 21, `glslang-tools`, and the theos iPhoneOS 16.5 SDK:
+
+```sh
+# WSL, in ~/hakios:
+tools/mk-mesa.sh && tools/mk-turnip.sh && tools/mk-m2v.sh
+METAL_PLUGIN=ca TURNIP=1 M2V=1 RC_JOBS=rc.jobs.bench EXTRA_SHARE=~/ca-share REST=1 SYSTEM=1 userland/build.sh
+cp userland/root.apfs userland/system.apfs /mnt/d/.../hakios/userland/
+
+# Git Bash:
+MORE="metal_m2v=1" tools/metal-run.sh
+MORE="metal_m2v=1 tu_debug=perf" tools/metal-run.sh # and Turnip's own account of its render passes
+```
+
+The summary's frames per gesture come from `tools/frames.py`, which runs anywhere Python does: `python tools/frames.py logs/last.log`.
+
`tools/metal-run.sh` keeps `/private/var` between boots by default (`ufs=2 ufs_write=1 var_store=1`, the partition
`darwin` only; `PERSIST=0` for none), so the shader stages the window server compiles are compiled once. To put them
into the image, so that not even the first boot compiles them: with the phone back in Android,
diff --git a/drivers/gpu/conf b/drivers/gpu/conf
index 931c63a..77267bc 100644
--- a/drivers/gpu/conf
+++ b/drivers/gpu/conf
@@ -5,5 +5,5 @@
driver ADRENO
file bsd/dev/hakios.adreno.c
file iokit/Kernel/hakios.gpu.cpp iokitcpp
- help the Adreno 642L of the SC7280 woken step by step (adreno=N), and HakiosGPU, the IOKit service Mesa and
- help the window server draw through (gpu=1, adreno_keep=1). Needs the GPU's firmware from the phone (fw-gpu/)
+ help the Adreno 642L of the SC7280 woken step by step (adreno=N), and HakiosGPU, the IOKit service Mesa, Metal and
+ help the window server draw through (gpu=1, adreno_keep=1; docs/reference/metal.md). Needs the GPU's firmware from the phone (fw-gpu/)