Documentation
On this page

Kernel

The kernel tree

What the kernel is made of, how it is built, and where the Open Mapple parts live.

What it is

Two repositories make the kernel:

  • xnu_kernel_mediatek_common is Apple’s xnu-8796.141.3 with the patch series of ios-sweet and ios-viva as commits, each naming its origin, and Open Mapple’s drivers for MediaTek phones on top. Apple’s files and the changes to them are under the Apple Public Source License 2.0; the files ios-sweet and ios-viva added are MIT. .upstream_base_commits lists the few files taken from other upstreams (the FreeBSD manual pages and one test) with their commits.
  • xnu_kernel_mediatek_mt6781 is the SoC’s layer: CPU frequency and thermal, the GPU probe, the MDP, scaler and JPEG engines, the camera, SCP and audio front end. mka kernel lays its iokit/ and osfmk/ over the common tree.

How it is built

mka kernel stages the common tree and the SoC layer in a copy of darwin-xnu-build (at a pinned commit, with the Kernel Debug Kit 13.5) and builds KERNEL_CONFIG=DEVELOPMENT (the userdebug variant) or RELEASE (user), with MACHINE_CONFIG=MT6781 and ARCH_CONFIG=ARM64 for macOS 13.5. It is built again only when the sources change. The kernel’s version string is mapple-mt6781-g<8 hex digits of the common tree's HEAD>, with -dirty when it has uncommitted changes, and the builder in it is openmapple, not the user who built it. A RELEASE kernel has no USB link. See Build targets.

Where things are

PathWhat
iokit/Kernel/arm/the IOKit services: Mapple* (platform expert, GIC, framebuffer, GPU, surfaces, key store, power source, Bluetooth) and MTK* (keypad, EINT, PMIC wrapper, I2C, GPIO) and the MT6631 Wi-Fi
iokit/Kernel/arm/hid/HID services: the keypad and PMIC keys, the ILI7807S touch, the sensor services
bsd/dev/BSD-side drivers: mtk_ufs.c, mtk_audio.c, mtk_torch.c, mtk_cam.c, mtk_scp.c, mtk_bt.c, mt6631_wifi.c, usb_link.c and mapple_sysctl.c
bsd/kern/amfi_stub.c and the other places the kernel is changed for iOS
osfmk/arm64/the memory holes (arm_vm_init.c) and, in the SoC layer, mt6781_cpufreq.c and the other chip parts
tools/host tests, pre-commit.sh (style check) and remote_build.sh

Code for this phone sits behind #if defined(ARM64_BOARD_CONFIG_MT6781) (or MT6781); device.conf’s soc selects the layer. Every driver that touches hardware does nothing until its boot-argument asks.

Source: README.md, .upstream_base_commits, bsd/, iokit/ and osfmk/ of the kernel at dcb77a0; core/mka.sh of mapple_build at f7431bb; the SoC layer’s README.md at 426b4f6.

Applies to Release 1 · Updated 15 November 2026