Skip to content

About

HakiOS / XNU (Darwin 22.5) + Mu-Silicium UEFI bring-up for Xiaomi Redmi Note 12 Pro 5G (ruby, MediaTek MT6877)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

73 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HakiOS / XNU for Redmi Note 12 Pro 5G (ruby)

Device SoC GPU Status Latest

Русская версия (README_RU.md) · From-Scratch Build Guide (EN) · Сборка с нуля (RU)

Bare-metal Apple XNU 8796.121.2 (Darwin 22.5 / iOS 16.5 20F66) bring-up on the Xiaomi Redmi Note 12 Pro 5G (ruby, MediaTek MT6877 / Dimensity 1080) via a custom Mu-Silicium UEFI payload (v50_loader.efi) with working FT3680 touchscreen, hardware Arm Mali-G68 MC4 (Valhall v9) OpenGL ES 3.1 via Mesa 25.0.7 Panfrost, and zero modification to Android/UFS partitions.

Only boot_a (~6.56 MiB) is ever flashed — the entire iOS 16.5 root filesystem, OS/App cryptexes, userland overlay, and persistent /private/var are streamed live from the host PC over USB CDC-ECM using HNBD v1. Rollback to Android is a single fastboot flash boot_a boot.img.


On-Device Proof: iOS 16.5 on ruby

iOS 16.5 Home Screen (SpringBoard) iOS 16.5 Lock Screen USB ECM + NBD Auto-Attach (~1 s)
iOS 16.5 Home Screen on Redmi Note 12 Pro 5G iOS 16.5 Lock Screen on Redmi Note 12 Pro 5G Automatic USB ECM and NBD mount on host

Hardware Mali-G68 MC4 (OpenGL ES 3.1)

Verified on real ruby hardware across Stages 1–4 (v0.62a–v0.62d), with full CoreAnimation (backboardd/SpringBoard) acceleration & 800 MHz boost wired in v0.62e:

  • Chip & Power: MT6359P PMIF (VSRAM_GPU = 0.75 V, VGPU = 0.75 V), SPM MFG0..MFG5 (0x3f/0x3f), MFGPLL1 (POSDIV_POWER_4, 450 MHz verified → 800 MHz default in v0.62e), GPU_ID = 0x92041010 (Mali-G68 Valhall v9 r1p1), all 4 shader cores READY (0x50005).
  • Kernel & IOKit: 4-level 48-bit AArch64 MMU, GICv3 IRQs 485/486/487 (GPU/MMU/JOB), HakiosMali IOKit service, zero-copy IOSurface import with explicit non-coherent D-cache maintenance (22/22 checks in mali_test).
  • Mesa 25.0.7 Panfrost (Valhall v9): gl_test passed 943 / 943 hardware OpenGL ES 3.1 submits with 0 MMU faults and 0 leaks (1125×2436 fill @ 450 MHz: clear 0.26 ms, 1 blended texture 1.28 ms, 4 blended textures 4.31 ms).

Architecture (v0.62e)

LK (stock bootloader)
 └─► boot_a: Mu-Silicium UEFI + v50_loader.efi (Apple D22AP DeviceTree, 3x 1125×2436)
      └─► XNU 8796.121.2 (8/8 cores, Mali-G68 MC4 @ 800 MHz, FT3680 touch, USB ECM, HNBD)
           ├─► md0 (flashboot.apfs, 512 KiB) -> stage0 waits calmly for USB ECM link
           ├─► /dev/nbd1 (RO) -> root.apfs (~5.8 MiB: init, 413 daemons, Mesa Panfrost v9, ruby_ctld)
           ├─► /dev/nbd0 (RO composite, 7.79 GiB, zero host concat):
           │     c=0: rootfs.apfs  |  c=1: Cryptexes/OS (dyld cache)  |  c=2: Cryptexes/App
           ├─► /dev/nbd2 (RW) -> var.hfs (2 GiB sparse persistent HFS+ Journaled /private/var)
           └─► Real iOS 16.5 Apple TGA splash -> /sbin/launchd -> backboardd (Mali-G68) + SpringBoard

Current Subsystem Status (v0.62e)

Subsystem Status Notes
UEFI → XNU boot (v50_loader) WORKING Live FDT validation, Apple D22AP DeviceTree, real iOS 16.5 TGA splash, clean UEFI return
8-core SMP (6×A55 + 2×A78) WORKING PSCI CPU_ON, full FEAT_CCIDX cache decoding
Display (MiniIOMobileFramebuffer) WORKING 1125×2436 @ 3x on 1080×2400 OLED, 4-thread presenter, fb_ca_hz=120, opaque 0xFF000000 blanking (no Xiaomi splash bleed)
GPU (Mali-G68 MC4, Valhall v9) WORKING hakios.mtk_mfg_mt6877.c + HakiosMali IOKit + Mesa 25.0.7 Panfrost v9 + libhakios.gl.dylib (800 MHz, zero-copy IOSurface)
Touchscreen (FocalTech FT3680) WORKING MT6360 LDO3/LDO2 + SPI3 + automatic PRAM firmware upload (0x5662), 0..65535 normalized coords
Hardware Buttons (mtk_buttons) WORKING Power wake/sleep · Hold VolDown (0.7 s) = HOME · Hold VolUp+VolDown (1.5 s) = UEFI return
USB Networking (mtk_usb_ecm) WORKING USB2 QMU DMA CDC-ECM (1209:0003, 192.168.7.2/24) + ruby_ctld TCP console (:2323)
Network Storage (HNBD v1) WORKING Composite nbd0 (7.79 GiB RO), nbd1 (root.apfs RO), nbd2 (var.hfs RW persistent /private/var)
UFS Flash (mtk_ufs_ro) SAFE RO Strictly read-only (mtk_ufs_ro=1); Android and userdata untouched
iOS 16.5 Userland (SpringBoard) WORKING REST=1 (413 on-demand daemons), built-in apps, full animations (ui_lite=0), persistent settings

Quick Start (Build & Boot)

Need full step-by-step instructions starting from a clean Windows PC (WSL2 Debian install, usbipd-win, Theos SDK, IPSW extraction, compiling XNU + Mesa Panfrost v9 + userland)? Read docs/BUILD.md (or docs/BUILD_RU.md).

Once built, every boot is 3 commands with zero race conditions:

# Window 1 (WSL2 Debian) — start before rebooting the phone
python3 ~/hackios/ruby/tools/ruby_nbd.py --darwin --auto-net
# Window 2 (Windows PowerShell) — auto-attaches 1209:0003 into WSL2 (~1 s)
powershell -ExecutionPolicy Bypass -File C:\platform-tools\ruby_usb_auto.ps1

# Window 3 (Windows PowerShell, phone in fastboot)
cd C:\platform-tools
.\fastboot.exe flash boot_a .\Mu-ruby-v0.62e-darwin-splash.img
.\fastboot.exe reboot

Live checks from WSL2 once SpringBoard is up:

cd ~/hackios/ruby
python3 tools/ruby_net.py cmd "sysctl kern.hakios.mali"
python3 tools/ruby_net.py cmd "sysctl kern.hakios.mtk_touch"
python3 tools/ruby_net.py cmd "run /redwood/bin/gl_test fill"

Recent Milestones

Tag Milestone
v0.60b First on-device iOS 16.5 SpringBoard boot over USB NBD + zero-spam wait + ruby_usb_auto.ps1
v0.60c Persistent /private/var (var.hfs HFS+ RW on /dev/nbd2) + ruby_ctld (:2323) + MT6360 LDO2 fix
v0.60e–f Working FT3680 touchscreen (Boot ROM 0xEF → PRAM upload), native 3x 1125×2436, ui_lite=0, 4-thread 60fps
v0.61 Fixed Xiaomi splash bleed on screen-off (0xFF000000), early logs → real iOS 16.5 Apple TGA splash, REST=1 (413 daemons), --reset-var
v0.62a–b Mali-G68 MC4 power/clocks (MFG0..5, MFGPLL1), 4-level 48-bit MMU, GICv3 IRQs 485..487, 3/3 hardware self-tests (stage=6)
v0.62c HakiosMali IOKit service + zero-copy IOSurface + non-coherent cache sync (mali_test 22/22 PASS)
v0.62d Mesa 25.0.7 Panfrost Valhall v9 (0x9204) + gl_test 943/943 hardware OpenGL ES 3.1 jobs (0 MMU faults)
v0.62e Hardware OpenGL ES 3.1 CoreAnimation (backboardd/SpringBoard) + MFGPLL1 boost to 800 MHz

Documentation

Credits

About

HakiOS / XNU (Darwin 22.5) + Mu-Silicium UEFI bring-up for Xiaomi Redmi Note 12 Pro 5G (ruby, MediaTek MT6877)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages