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
# What may be a binary, or a blob in a source file, in this repository, and why.
# Read by tools/provenance-check.py, which CI runs on every push. Format: STATUS GLOB reason
# open redistributable
# pending known, not settled: the check passes with a warning
# vendor proprietary: the check fails until the file leaves the tree
# flash a script allowed to write to the phone's storage, by a person's hand
# The first line that matches a path decides. A file that no line explains fails the check.
# --- built from this repository -----------------------------------------------------------------------
open prebuilt/hakios-kernel the kernel, built from Apple's open xnu-8796.121.2 plus xnu/hakios.patch and xnu/files: APSL-2.0, corresponding source here and at Apple
open prebuilt/loader.efi the boot loader, built from xnuloader/loader.c: MIT
open prebuilt/userland/* our programs and libraries, built from userland/src: MIT
open devices/redwood/prebuilt/BootShim.bin built from the shim of Mu-Silicium with our change (uefi/hakios.patch): BSD-2-Clause-Patent
# --- a description of the hardware ------------------------------------------------------------------------
pending devices/redwood/prebuilt/device-tree.dtb the phone's device tree, compiled from Linux sources that are GPL-2.0; confirm the headers, or have each user pull it from their own phone as tools/soc-args.py already does
pending devices/redwood/uefi/files/Resources/DTBs/redwood.dtb the same device tree, for the UEFI build
# --- the touch controller's firmware, compiled into a driver ---------------------------------------------
pending drivers/input/hakios.focaltech_fw.h FocalTech's firmware as a C array, from a blob on the phone: the kernel (hakios.goodix.c) includes it, so it cannot simply be removed; owner to decide between a licence from the vendor and loading the blob from the phone at run time like the rest of the firmware
# --- proprietary: Qualcomm's and Xiaomi's, taken out of the phone's own UEFI; not for a public tree ---------
vendor devices/redwood/uefi/files/Binaries/redwood/* UEFI drivers extracted from the vendor's xbl firmware (QcomPkg, MiPkg, RawFiles and the EDK2 modules as the vendor built them)
vendor devices/redwood/prebuilt/SILICIUM_UEFI.fd the built UEFI image: carries those drivers
# --- everything that can write to the phone's storage: a short list, each limited in code --------------------
# (the default run writes one thing: the loader's own log into the phone's logdump partition)
flash xnuloader/loader.c the loader writes its own log (a few KB) into the phone's `logdump` partition at the end of a run and, only with ufs_write=1, into the partition `darwin` from BLOCK_WRITE_FIRST on; it REFUSES every other write (BLOCK_OP_WRITE: "not darwin ... never")
flash drivers/storage/hakios.ufs.c the kernel's side: no write at all without ufs_write=1, then only /dev/rufs_darwin, whole blocks from UFS_WRITE_FIRST on, and one writer at a time
flash tools/darwin-write.py writes an image into `darwin` from Android (adb, root) after checking the GPT, the partition's identity and the block range, only to /dev/block/by-name/darwin, reading every write back; every attempt is logged
flash tools/backup-partitions.py WRITES NOTHING to the phone (only ls, blockdev, dd if= and sha256sum, as root, over adb); it is declared because the restore notes it writes for a person (restore.txt) contain the fastboot lines that would put each partition back, which the scan cannot tell from a command to run
flash tools/backup-partitions-test.py the same tool's test, against a stand-in adb: the text it checks for is those notes
flash tools/userdata-carve.py prints the dd commands that cut the `darwin` partition off the end of Android's userdata (a new GPT); a person runs them once, by hand, under Android, and only for the optional persistence; the default run needs no such partition