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: comparison with the other XNU-on-a-phone projects, from their public pages; LEGAL: three layers, what is written to the phone
shimoku2f65c9517898
diff --git a/LEGAL.md b/LEGAL.mdindex f7cc8a6..45e4422 100644--- a/LEGAL.md+++ b/LEGAL.md@@ -11,10 +11,37 @@ claim that any use of the project is lawful in your jurisdiction. Running the furequires software and firmware you must obtain and are licensed to use yourself; whether you maydo so is your responsibility. If in doubt, consult a lawyer.+## Three layers, and who decides what++HakiOS is an adaptation of the Darwin kernel to hardware that is not Apple's, in the way Android is an adaptation of+Linux to phones. It has three layers, and the project says plainly which one it stands behind.++1. **The open core.** The kernel port (a patch to Apple's open-source XNU, APSL 2.0), the boot loader, the drivers,+ the tools, the configurations. All of it is source in this repository, builds and runs with nothing of Apple's and+ nothing of any phone's (`make qemu-open`), and is what this project develops, documents and supports.+2. **What you put on top of it.** The kernel can start an operating-system user space that you supply. The project+ ships none, distributes none, and does not decrypt, circumvent or patch anything to obtain one: the tools only lay+ out, on your own machine, files that you have downloaded yourself from the vendor. **Whether you may use such+ software on this hardware is your decision and your responsibility.** Be aware of what you are deciding: Apple's+ software licence for iOS ties it to Apple-branded hardware and restricts copying and modification, courts have+ treated that differently (see `docs/legal-review.md`), and the answer depends on your country and on what you do.+ The project does not tell you that it is permitted, and does not tell you that it is not; it tells you that it is+ not the project's to decide.+3. **Apple's services.** Activation, Apple ID, iCloud, iMessage, the App Store: not supported and not a goal. Nothing+ here makes a device pass as an iPhone to Apple's servers, and a change that tries to is refused.++## What the project writes to your phone++By default the boot loader runs from RAM (`fastboot boot`) and a reboot restores Android. It does write one thing: its+own log, a few KB, to the phone's `logdump` partition at the end of a run. Only if you turn on `ufs_write=1` does the+kernel write, and then only to a partition called `darwin` that you created yourself (`tools/userdata-carve.py` prints+the commands and changes nothing). Every other write is refused by the loader. `tools/provenance.allow` lists each+program that can write to flash, and CI fails if one appears that is not listed.+## What this repository contains- **The kernel changes**: a patch to Apple's open-source XNU (`xnu/hakios.patch`) and added- source files (`xnu/files/`). These are a derivative work of XNU and are licensed under the+ source files (`xnu/files/`, `drivers/`). These are a derivative work of XNU and are licensed under theApple Public Source License 2.0 (`LICENSE.APSL`). See `COMPLIANCE.md` for how the APSL termsare met.- **Our own original code**: the boot loader (`xnuloader/`), user-space programsdiff --git a/docs/comparison.md b/docs/comparison.mdnew file mode 100644index 0000000..22b3e52--- /dev/null+++ b/docs/comparison.md@@ -0,0 +1,56 @@+# 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+(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.++| | [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 iOS 16 | a general UEFI environment for iOS/macOS on ARM64, in the manner of OpenCore | one phone, bring-up of iOS 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) |+| 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 |++## What this project does that the others' pages do not describe++These are things that exist in this repository and that a reader can check:++- **A configuration system, like Linux's.** `configs/defconfig`, `configs/<device>_defconfig`, fragments, a `.config`,+ `savedefconfig`, and dependency and length checks ([configs.md](configs.md)). A kernel that is configured by its+ command line gets a file format for it, with the typo caught before the boot rather than after.+- **A version string that says what it is built from**, shown by the loader and by `sysctl kern.hakios.version`+ ([versioning.md](versioning.md)).+- **A catalogue of every boot-argument**, made from the source by a scanner, checked in CI, so the list cannot go+ stale ([boot-args.md](boot-args.md), 300+ arguments).+- **An open configuration that needs nothing of Apple's and nothing of the phone's**: `make qemu-open` boots the kernel+ with its own userland and prints the banner, `kern.hakios.version` and a hello. This is the part anybody can+ contribute to without touching an IPSW or a firmware file. (Tested.)+- **A provenance guard** (`tools/provenance-check.py`, in CI): it refuses a binary that is not explained, a file of+ 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,+ modem bring-up. [driver-review/](driver-review) says what each is, and what has and has not been verified.++## What the others have that this one does not++- ios-sweet and Bergamota are small enough to read in an afternoon, and Bergamota targets a newer iOS (18) with its+ own tool for the arm64e/pointer-authentication gap. HakiOS targets the iOS 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.+- Bergamota ships a macOS control app. HakiOS has `xl` and `make`, which are command lines.++## What nobody here can do++Run an Apple account, activation, iMessage or the other Apple services: no project here can, and ours does not try+(see [LEGAL.md](../LEGAL.md)). None of the four is an iPhone to Apple's servers, and none should pretend to be.++## 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.