Skip to content

About

XRING O1 (Mali-G925) Droidspaces stack: GKI 6.18 kABI-safe kernel + Ubuntu 26.04 GPU desktop + 3-arch Wine. Built on Droidspaces-OSS, dijunkernel CI, anland, PanVK — see ACKNOWLEDGEMENTS.md

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

13 Commits

Folders and files

Repository files navigation

Droidspaces on XRING O1 — GKI 6.18 kABI 安全内核 + Ubuntu 26.04 GPU 桌面 + 三架构 Wine

English Version / Jump to English · 一键导入指南 / Import Guide

在小米平板 7 Ultra(jinghu,XRING O1 SoC)上跑通 GPU 加速 Linux 桌面容器、 且不破坏厂商 kABI 的完整可复现方案。

零 CRC 漂移的 GKI 6.18.21 内核 · Droidspaces v7.2.0 · Ubuntu 26.04 ARM64 · Mali-G925 Vulkan 1.3.278 经 Zink · 原生 niri-anland 桌面 · Wine + DXVK 2.7.1 覆盖 arm64 / x86 / x86_64。


摘要

本仓库是小米平板 7 Ultra(jinghu,XRING O1 SoC,Mali-G925-Immortalis MC16 r0p1) 上完整跑通 Droidspaces Linux 桌面容器的可复现方案。核心难点是:厂商内核缺 CONFIG_PID_NS / CONFIG_IPC_NS / CONFIG_SYSVIPC,而补开这些项会改变 task_struct 布局,导致 286 个厂商预编译模块因 CRC 不符集体拒载 → bootloop。

本方案的关键结论:用 Droidspaces 官方的 GKI 6.12+ kABI 补丁,把那 24 字节搬进 task_struct 已有的空洞里,配合 KBUILD_GENDWARFKSYMS_STABLE=1,可以做到 2,786 个导出符号 CRC 零漂移,同时拿到全部 namespace 支持。现有 KernelSU LKM init_boot 完全不用动。

在此之上:Ubuntu 26.04 容器、O3 Mali 栈(Vulkan 1.3.278 + Zink OpenGL 4.6)、 原生 niri-anland 桌面(xwayland-satellite + xwayland)、以及 Wine + DXVK 2.7.1 的三种 Windows 架构(ARM64 原生 / 32 位 x86 / 64 位 x86_64)全部实测跑通硬件 D3D11。


快速上手(简易使用教程)

Caution

⚠️ 刷机红线警告(务必先读)

本教程与 boot-xring-o1-6.18-noksu-droidspaces-va39-gki553682993.img 内核镜像 仅限「已解锁 Bootloader(BL)」的设备使用!

未解锁 BL 的越狱 / 临时 root 设备严禁刷入本内核 —— 否则会触发 AVB 校验失败、 无法开机,直接变砖!

🔑 本 boot.img 不含 KernelSU(noksu 纯净内核)—— 需要通过 init_boot 分区实现 KernelSU(LKM 模式)。刷入 boot 分区不会影响你已经刷好的 init_boot KernelSU。

刷入前请务必确认:① 设备已完成 Bootloader 解锁;② 已用 fastboot boot / dd 等方式备份原厂 boot 分区镜像;③ 机型为小米平板 7 Ultra(jinghu)。 不确定自己是否已解锁 BL 的设备,请不要执行下面第 2 步。

零基础 6 步,全部资产直接从 v1.1.0 一个 release 下载,无需再翻 v1.0.0。

第 1 步 · 核对前提(不满足就不要往下走)

  • 设备:小米平板 7 Ultra(jinghu,XRING O1),且 Bootloader 已解锁。

  • 已刷好 KernelSU(LKM 模式),init_boot 里的 KSU 完全不用动。

  • 在设备上执行 uname -r,输出必须逐字匹配:

    6.18.21-android17-5-g284297031c53-abogki553682993-4k
    

    内核版本不一致就不要刷,否则大概率开不了机。

  • 先备份原厂 boot 分区(变砖或想回退时唯一救命稻草):

    adb shell su -c 'dd if=/dev/block/bootdevice/by-name/boot_b of=/data/local/tmp/boot_b-backup.img'
    adb pull /data/local/tmp/boot_b-backup.img .

第 2 步 · 刷入安全内核(⚠️ 再次强调:仅限已解锁 BL 的设备)

Caution

这一步会替换 boot 分区里的内核。再次强调:本 boot.img 仅限已解锁 Bootloader(BL)的 设备刷入;未解锁 BL 的越狱 / 临时 root 设备严禁刷入内核,否则会直接变砖!

🔑 本 boot.img 不含 KernelSU(noksu 纯净内核)—— KernelSU 需要通过 init_boot 分区 以 LKM 模式实现。刷入 boot 分区不会影响你已经刷好的 init_boot KernelSU。

  1. 从 v1.1.0 下载 boot-xring-o1-6.18-noksu-droidspaces-va39-gki553682993.img (GKI v4 纯内核镜像,ramdisk_size == 0,96 MiB / 100,663,296 字节,无需解包), 并核对校验和:

    sha256sum boot-xring-o1-6.18-noksu-droidspaces-va39-gki553682993.img
    # 期望:b816785aeca1d53ebdeb0f94d09d7d08b7c6bead697a80974c9885279439157e
  2. 无需解包,直接刷入 boot 分区(二选一):

    # 方式 A:fastboot(按你的槽位选对 boot / boot_b)
    fastboot flash boot boot-xring-o1-6.18-noksu-droidspaces-va39-gki553682993.img
    fastboot reboot

    方式 B:把 .img 推到平板,用 Kernel Flasher 直接选择该 boot.img 刷入 boot 分区并重启。

  3. 重启后 uname -r 应变为 …-abogki553682993-4k,且 KernelSU 依旧可用 —— 本 boot.img 不含 KernelSU(noksu),你的 KernelSU 来自 init_boot 分区 (LKM 模式),刷 boot 分区不会影响它。

第 3 步 · 安装客户端 App

  • 安装 Droidspaces App(v7.2.0+)。
  • 安装 Anland App(桌面呈现端)。

第 4 步 · 刷入宿主一键模块

从 v1.1.0 下载 u2604-host-oneclick-1.1.0.zip,在 KernelSU 管理器里 「模块 → 从存储安装」选中该 zip,重启生效。它会自动完成:

  • 配置 SELinux 规则,让 droidspacesd 在 Enforcing 下正常跑;
  • 磁吸键盘触控板独占(仅在容器前台且亮屏时抓取,否则立刻还给 HyperOS);
  • 亮度 / 音量同步(含控制中心亮度条修复);
  • Anland 守护与 GPU 升频。

第 5 步 · 一键导入容器

从 v1.1.0 下载容器 rootfs,二选一:

  • App 图形界面直导(推荐):下载 ubuntu2604-xring-o1-panvk-public-rootfs.tar.xz, 推到平板后在 Droidspaces App 里点 Import rootfs —— App 自动建 64 GB 稀疏 ext4、 解包并跑 post_extract_fixes.sh。
  • 命令行导入:下载 ubuntu2604-xring-o1-panvk-public-rootfs.tar.zst(解压更快), 按 docs/README-IMPORT.md 的手动 CLI 路径操作。

详细配置勾选项、默认账户与健康检查见 docs/README-IMPORT.md。

第 6 步 · 启动桌面

在 Droidspaces App 里启动容器 → 打开 Anland App,即可进入 120Hz GNOME 50 + PanVK 桌面(Mali-G925-Immortalis MC16,16 核全开)。

Caution

⚠️ 再次提醒(请反复确认)

严禁在未解锁 Bootloader(BL)的越狱 / 临时 root 设备上刷入本 boot.img —— 否则会直接变砖! 本内核镜像与上述刷机流程仅限已解锁 BL 的设备使用。

🔑 本 boot.img 不含 KernelSU(noksu 纯净内核)—— KernelSU 需要通过 init_boot 分区 以 LKM 模式实现;刷入 boot 分区不会影响你已经刷好的 init_boot KernelSU。

如需回滚:把第 1 步备份的原厂 boot.img 用 fastboot flash boot 刷回即可 (boot / boot_b 按你的槽位选对)。


目标平台

项 值
设备 小米平板 7 Ultra — jinghu / <PRODUCT-MODEL>
SoC XRING O1(ro.board.platform=O1_asic)
GPU Mali-G925-Immortalis MC16 r0p1,厂商 Vulkan 1.3.278,kbase r49p1(CSF)
系统 Android 17(SDK 37),A/B,erofs,4K 页
内核 GKI 6.18.21 — 6.18.21-android17-5-g284297031c53-abogki553682993-4k
地址空间 VA_BITS=39(512 GB 用户态范围)— 不要改成 48,会 bootloop
DRM 节点 只有 /dev/dri/card0(226:0);不存在 renderD*
Root KernelSU(ksud 3.3.1),模块位于 /data/adb/modules/
内存 15.9 GB + 8 GB swapfile + 16 GB zram(lzo-rle)
屏幕 3200×2136 @ 120 Hz,密度 360

原样保留: init_boot 里现有的 KernelSU LKM 完全不动、继续可用。 本项目只替换 boot 分区里的内核。


验证状态矩阵

组件 结果 证据
GKI 6.18.21 noksu-ds 内核 ✅ 通过 2,786/2,786 原厂 vmlinux CRC 完全一致(0 漂移,MISMATCHED = 0)· 0 个 C 符号 CRC 变化 · task_struct=4736、module=1664、VA_BITS=39 · droidspaces check 10/10 [MUST HAVE] + 9/10 [RECOMMENDED] + 9/9 [OPTIONAL] · 286 个原厂模块正常加载 · 现有 KernelSU LKM 开箱即用
Droidspaces v7.2.0 ✅ 通过 droidspacesd 在 SELinux Enforcing 下运行
Ubuntu 26.04 ARM64 容器 ✅ 通过 32 GB 稀疏 ext4 镜像,systemd 作为 PID 1,system-is-running=degraded→running
O3 Mali GPU 栈 ✅ 通过 xring-o3-mali-stack-2026.11.12-v1 + 重编的 Ubuntu 26.04 libgbm.so.1 shim + 根 cgroup 自动重启的 vkbridge-server KSU 模块 → Vulkan 1.3.278(Mali-G925-Immortalis,r49p1)+ Zink OpenGL 4.6 Core / GLES 3.2
原生 ARM64 桌面 ✅ 通过 niri-anland 26.4.0 + xwayland-satellite 0.8.3 + xwayland 24.1.10 的 .deb 在 Ubuntu 26.04 上构建;desktop-session.service active,带 ANLAND_DRM_DEVICE=/dev/dri/card0
Wine — ARM64 原生 ✅ 通过 wine-mali / Hangover 11.16
Wine — 32 位 x86 ✅ 通过 wine-mali + HODLL=wowbox64.dll + DXVK 2.7.1 x32 → D3D11 硬件加速在 Mali-G925-Immortalis 上通过
Wine — 64 位 x86_64 ✅ 通过 wine64-box / Box64 v0.4.5 + 便携版 Wine 11.23 + wineserver-box + DXVK 2.7.1 x64 → D3D11 硬件加速在 Mali-G925-Immortalis 上通过(VRAM 15327 MB,D3D_FEATURE_LEVEL_11_0)
Anland 实时上屏 ✅ 通过 打补丁的 anland-consumer-compat-5.19.apk(stride=0 → width 修正)以 3200×2136 @ 120 Hz 连接,pacing queue_fps=117(queue_fail=0),零拷贝 3200×2136 DMA-BUF 导入 Mali-G925-Immortalis,zwp_linux_dmabuf_v1 v3,anland-0 上实时运行 foot + waybar + niri-anland 热重载 scale 2.0

图例:✅ 已在小米平板 7 Ultra 真机上端到端验证。


架构

flowchart TD
    subgraph ANDROID["Android 17 / XRING O1 宿主"]
        direction TB
        BOOT["boot_b<br/>GKI 6.18.21 noksu-ds<br/>VA_BITS=39 · 4K 页<br/>2786/2786 CRC 完全一致"]
        INITBOOT["init_boot<br/>KernelSU LKM(未改动)"]
        DSAPP["Droidspaces v7.2.0 APK"]
        ANLAPP["Anland v5.24 consumer APK"]
        KSU["KSU 模块<br/>u2604_mali_host"]
        SUP["supervisor.sh<br/>根 cgroup · 自动重启"]
        VKB["vkbridge-server<br/>MaliBridge 宿主"]
        MALI[("/dev/mali0<br/>kbase r49p1 CSF")]
        CARD0[("/dev/dri/card0<br/>226:0")]
        DMA[("/dev/dma_heap")]
    end

    subgraph CONTAINER["Ubuntu 26.04 ARM64 容器(稀疏 ext4,systemd)"]
        direction TB
        DAEMON["droidspacesd<br/>SELinux Enforcing"]
        ICD["90-droidbridge.json<br/>绝对路径 ICD"]
        STACK["O3 Mali 栈<br/>mesa kopper + zink"]
        GBM["libgbm.so.1 shim<br/>转发 38 个符号"]
        NIRI["niri-anland 26.4.0<br/>desktop-session.service"]
        XWS["xwayland-satellite 0.8.3<br/>xwayland 24.1.10"]
        WINE["Wine + DXVK 2.7.1<br/>arm64 · x86 · x86_64"]
    end

    BOOT --> DAEMON
    INITBOOT --> KSU
    KSU --> SUP
    SUP --> VKB
    VKB --> MALI
    DSAPP --> DAEMON
    DAEMON -->|"/run/display.sock"| NIRI
    ANLAPP -.->|"display.sock"| NIRI

    MALI --> VKB
    VKB -->|"mali.sock"| STACK
    DMA --> STACK
    CARD0 --> NIRI
    CARD0 --> XWS

    ICD --> STACK
    STACK --> GBM
    GBM --> NIRI
    STACK --> WINE
    NIRI --> XWS
    NIRI -->|"Anland surface"| ANLAPP

    style ANDROID fill:#1a2332,stroke:#4a90d9,color:#e8f0f8
    style CONTAINER fill:#2d2416,stroke:#d9a441,color:#f8f0e8
Loading

数据流(文字说明)

  1. boot_b 承载自编译的 noksu-ds 内核。它的导出符号 CRC 与原厂内核逐字节相同, 因此 vendor_dlkm / system_dlkm 里全部 286 个厂商模块都能正常加载。
  2. init_boot 保留原厂 KernelSU LKM。ksuinit 通过 kallsyms 地址(SHN_ABS)绑定符号, 完全绕过 check_version() —— 所以 CRC 与它无关。
  3. KSU 模块 u2604_mali_host(v1.1.0)在 late_start 阶段拉起 5 个宿主守护进程, 每个都由带 pidfile 守卫的 supervisor 管理。每个 supervisor 都会把自己和子进程移入 根 cgroup 且永不退出,从而同时躲过 PR_SET_PDEATHSIG 与 Android 的按会话 cgroup 回收。 anland-sock-watch.sh 还会在每次容器重启后重新指向 Anland 显示套接字别名, refresh-display.sh 则在 HyperOS 强杀 presenter 后重新附着它。
  4. vkbridge-server 通过 unix 套接字(mali.sock)暴露 Mali 的 Vulkan, 该套接字位于一个 bind mount 上,容器内看到的是 /opt/mb-sock/mali.sock。
  5. 容器内部,libvulkan_droidbridge.so 由绝对路径 ICD 选中;Zink 跑在 kopper Mesa 构建上,libgbm.so.1 是重编的 shim。
  6. niri-anland 在 /dev/dri/card0 上合成,并把帧交给 /run/display.sock 的 Anland broker, 再由 Anland consumer APK 呈现在 Android surface 上。
  7. Wine 用三种不同方式走到 D3D11,最终都落在同一块 Mali 设备上。

仓库结构

.
├── README.md                              # 本文件
├── LICENSE                                # GPL-3.0
├── .gitignore
├── kernel/
│   ├── README.md                          # 构建开关、校验器、重打包、刷入/回滚
│   ├── patches/
│   │   ├── 001.GKI-6.12-or-above-fix_sysvipc_kabi.patch
│   │   ├── 001.GKI-6.12-or-above-fix_sysvipc_kabi.patch
│   │   ├── verify-kernel-artifact.py      # 离线 CRC + BTF + config 闸门
│   │   └── repack-boot.sh                 # magiskboot 重打包,rm -f kernel_dtb + SHA256 往返校验
├── host/
│   ├── README.md
│   ├── install-droidspaces.sh             # Droidspaces v7.2.0 + Anland v5.24 + 守护进程校验
│   ├── create-ubuntu2604.sh               # 32 GB 稀疏 ext4 Ubuntu 26.04 ARM64
│   ├── gpufreq-boost/                     # XRING O1 GPU 频率惰性加速(源码 + 容器内 CLI)
│   └── ksu-module/u2604_mali_host/        # 一键 KSU 模块 v1.1.0(仅源码,无 ELF)
│       ├── README.md                      # 守护进程、refresh-display.sh 逻辑、从源码构建
│       ├── module.prop
│       ├── customize.sh
│       ├── service.sh
│       ├── sepolicy.rule
│       ├── install-host-mali.sh
│       └── persist/                       # 6 个 supervisor + 2 个守护进程 C 源码
├── container/
│   ├── README.md
│   ├── setup-mali-stack.sh                # O3 栈 + libgbm shim + ICD + card0 + 校验
│   ├── u2604-container-localization.sh     # nosnap 钉死 + PackageKit polkit + zh_CN/Asia-Shanghai
│   ├── u2604-apps-arm64.sh                 # 10 款 ARM64 非 Snap 应用
│   ├── gnome-extensions/                   # 自研 GNOME Shell 50 扩展(仅源码)
│   │   └── android-brightness@u2604/      # 全宽 QS 亮度滑块,位于音量下方 colSpan=2
│   │       ├── extension.js
│   │       └── metadata.json
│   ├── libgbm-shim/shim.c                 # 38 符号转发 shim
│   ├── mutter-anland/                      # 4 个干净源码补丁 + 重建脚本(无二进制)
│   │   ├── README.md                       # 补丁顺序、必须加 --prefix=/usr 的说明
│   │   ├── prepare-source.sh               # Ubuntu src + quilt + Anland + 4 个 u2604 补丁
│   │   ├── mutter-anland-rebuild.sh        # meson/ninja + 原子部署 + 验收
│   │   ├── u2604-anland-scroll-invert.patch
│   │   ├── u2604-touchpad-seat-wrappers.patch
│   │   ├── u2604-touchpad-bridge-client.patch
│   │   └── u2604-anland-ondemand-present.patch
│   ├── xwayland/                           # 智能包装 + 一次性 glamor 验证
│   │   ├── README.md
│   │   ├── Xwayland                        # exec -a Xwayland + NODEVICE_SELECT=1
│   │   └── xwayland-glamor-verify.sh
│   ├── niri-anland/
│   │   ├── build-niri-ubuntu2604.sh       # O3 补丁 + sd-notify 0.5 修正 -> 3 个 .deb
│   │   ├── config.kdl
│   │   ├── ubuntu2604-desktop-session
│   │   └── desktop-session.service
│   └── wine/
│       ├── setup-wine-dxvk.sh             # Hangover + DXVK + Box64 v0.4.5 + Wine 11.23
│       ├── bin/wine-mali
│       ├── bin/wine64-box
│       ├── bin/wineserver-box
│       └── dxvk_probe.c
├── docs/
│   ├── README.md                          # 索引 + 上游 commit 对照
│   ├── 01-可行性报告.md … 08-桌面窗口方案定稿.md
│   ├── kernel-6.18-kabi-report.md
│   ├── userspace-architecture-report.md
│   ├── container-recovery.md              # 从零重建 ubuntu2604(64 GB 稀疏)
│   ├── assets-manifest.md
│   └── reports/                           # 已脱敏的工程 / 验收报告
└── repro/
    ├── README.md
    ├── dmabuf-test/                       # 发送端 + 接收端 + 着色器 + 脚本(无二进制)
    └── panvk/                             # kbase-ioctl-fix.py + ICD + caps(无 .so)

预构建产物 — GitHub Releases v1.1.0(Latest,含内核包)+ v1.0.0(原始内核 release)

二进制不在 git 里。刷机或安装所需的一切都挂在 release 上。

v1.1.0(Latest)— PanVK 容器 rootfs + KSU 一键模块 + 预构建 kABI 安全内核

⬇ 前往 Release v1.1.0

资产 用途 体积 SHA256
u2604-host-oneclick-1.1.0.zip KernelSU 一键模块:5 个宿主守护进程 + refresh-display.sh(不附带 MaliBridge 二进制) 1,031,955 B 65df94222948a8e37ace45b7ac32955fa60d077e97169d0728ddd35855c6f034
ubuntu2604-xring-o1-panvk-public-rootfs.tar.xz 清洗后的公开容器 rootfs — Droidspaces App「Import rootfs」一键导入格式 1,595,691,468 B 08da79008aa10bc1e1fccd0b151d0552ac2018784f8e944200a6d217d7c53618
ubuntu2604-xring-o1-panvk-public-rootfs.tar.zst 同一份 rootfs,供手动 CLI 导入(解压更快) 1,979,925,049 B 4d4884d67745206e705927a81dc8159e793afc481ab9c8f114d6d9bf17ee2059
boot-xring-o1-6.18-noksu-droidspaces-va39-gki553682993.img 预构建 kABI 安全内核 boot.img(noksu-ds,VA=39,GKI v4 纯内核,ramdisk_size == 0)— 无需解包,直接 fastboot flash boot 或用 Kernel Flasher 刷入 boot 分区;⚠️ 本 boot.img 不含 KernelSU(noksu),需要通过 init_boot 分区实现 KernelSU(LKM 模式),刷 boot 不影响已刷好的 init_boot KernelSU;⚠️ 仅限已解锁 Bootloader(BL)的设备使用,越狱 / 未解锁 BL 的设备刷入会直接变砖 96 MiB(100,663,296 B) b816785aeca1d53ebdeb0f94d09d7d08b7c6bead697a80974c9885279439157e
README-IMPORT.md 中英双语导入指南(含脱敏清单与许可归属) 33,307 B de5da15314b49773036b068b76e24969c17646686191fe15c9691fe691578bae
container.config.template 脱敏后的容器配置模板(static_nat_ip 与 uuid 留空) 3,582 B 02e362aa99faaa81eb3b3d902cbc3465bf6a90bada89b627dc0f9a7cddbf30a5
SHA256SUMS 上述 6 个公开文件的校验和 623 B 8c23d0d996b6b181a038de8ad6a1c66211f676d0a987c9287b279d29ca29dc48

Caution

⚠️ boot-xring-o1-6.18-noksu-droidspaces-va39-gki553682993.img 仅限已解锁 Bootloader(BL)的 设备刷入;未解锁 BL 的越狱 / 临时 root 设备严禁刷入内核,否则会触发 AVB 校验失败、直接变砖!

🔑 本 boot.img 不含 KernelSU(noksu 纯净内核)—— 需要通过 init_boot 分区实现 KernelSU (LKM 模式);刷入 boot 分区不会影响你已经刷好的 init_boot KernelSU。

刷机完整流程见上文 「快速上手(简易使用教程)」。

下载后先校验:

sha256sum -c SHA256SUMS      # 6 项全部 OK

v1.1.0 亮点

  • PanVK 16 核直驱开源图形栈 — rootfs 主 GPU 栈为 GPU_STACK=panvk(Mali-G925-Immortalis MC16 16 核全开),全程开源 Mesa / PanVK 直驱,宿主侧不需要任何 GPU 组件。
  • KSU 一键模块 u2604-host-oneclick-1.1.0.zip — 一个 zip 装齐 5 个宿主守护进程;含磁吸键盘 触控板 EVIOCGRAB 独占锁定(仅在容器 bridge 已连接 ∧ consumer 在前台 ∧ 屏幕亮时抓取, 否则立刻 EVIOCREVOKE 还给 HyperOS),以及 refresh-display.sh 修复:新的 attached() 判定要求 broker 上 ≥2 条 ESTABLISHED 连接且 consumer 进程存活, 修掉了「consumer 被 HyperOS 强杀后仍判 already attached → 桌面无 presenter、无法自愈」。
  • 控制中心亮度条修复 — 自研 GNOME Shell 扩展 android-brightness@u2604 以 colSpan=2 全宽渲染,紧邻音量条下方,不再是挤在右侧的窄条。
  • Droidspaces App .tar.xz 一键导入 — 把 …-public-rootfs.tar.xz 推到平板后在 App 里点 Import rootfs 即可,App 自动建 64 GB 稀疏 ext4、解包并跑 post_extract_fixes.sh, PC 侧不再需要 zstd / GNU tar。

容器 rootfs 与一键模块的完整说明见 docs/README-IMPORT.md(中英双语导入指南,含脱敏清单与许可归属)。

v1.0.0 — 预构建 GKI 6.18.21 kABI 安全内核(原始 release)+ niri-anland 路线 .deb

v1.1.0 的内核资产已改为 boot.img 直刷格式(boot-xring-o1-6.18-noksu-droidspaces-va39-gki553682993.img, GKI v4 纯内核、ramdisk_size == 0,无需解包);v1.0.0 仍保留原 AnyKernel3 zip 与三个 niri-anland 路线 .deb:

资产 是什么
ak3-xring-o1-6.18-noksu-droidspaces-va39-gki553682993.zip AnyKernel3 可刷内核包(noksu-ds,VA=39)— 仅存在于 v1.0.0;v1.1.0 已改用 boot-…img 直刷镜像;⚠️ 仅限已解锁 BL 设备刷入,越狱 / 未解锁 BL 设备刷入直接变砖
niri-anland_26.4.0+anland5-1_arm64.deb 原生 ARM64 niri-anland 合成器
xwayland-satellite_0.8.3+anland5-1_arm64.deb Xwayland rootless satellite
xwayland_24.1.10-1_arm64.deb 配套的 Xwayland server

v1.1.0 的 PanVK rootfs 用的是 5 补丁 libmutter-18.so.0.0.0(含按需呈帧 ANLAND_ON_DEMAND_PRESENT)与智能包装版 Xwayland 2:24.1.10-1, 已内建在 rootfs 里,不需要上面这三个 .deb;它们是 niri-anland 路线的资产。

内核 Image SHA256(同样内嵌在 ci-out summary 里):

721e206940f962c3cb9c04dacd06100943801462251be8da62618ee315f8bb39

三个 .deb 由 container/niri-anland/build-niri-ubuntu2604.sh 构建; 内核则是把 kABI 补丁与 kernel/dijun-ci-config.md 里描述的 CI 改动 应用到 shu0011/dijun-kernel-ci @ 298abc34,再跑它的 CI 得到。


复现指南

下面每一步都对应仓库里的一个脚本,没有任何「然后魔法发生了」。

0. 前置条件

# 宿主工具链
sudo apt install -y android-tools-adb android-tools-fastboot python3 bpftool \
                    magiskboot build-essential

# 设备:KernelSU 可用,boot_b 已备份
adb shell su -c 'dd if=/dev/block/by-name/boot_b of=/sdcard/boot_b.stock.img'
adb pull /sdcard/boot_b.stock.img

1. 构建并刷入内核 → kernel/README.md

# a) 在上游之上应用 CI 补丁
git clone https://github.com/shu0011/dijun-kernel-ci && cd dijun-kernel-ci
git checkout 298abc34
git apply /path/to/repo/kernel/patches/001.GKI-6.12-or-above-fix_sysvipc_kabi.patch
# 然后按 kernel/dijun-ci-config.md 调整你的 CI fork

# b) 运行 noksu-ds workflow,取回 ci-out/noksu-ds/out/

# c) 过闸门 —— 必须打印 FINAL GATE: PASS
python3 /path/to/repo/kernel/verify-kernel-artifact.py \
    ci-out/noksu-ds/out --variant noksu-ds --stock-dir stock

# d) 重打包 boot.img(剔除伪造的 kernel_dtb,并做往返校验)
/path/to/repo/kernel/repack-boot.sh \
    --stock boot_b.stock.img \
    --kernel ci-out/noksu-ds/out/Image \
    --out new-boot.img \
    --expect-sha256 721e206940f962c3cb9c04dacd06100943801462251be8da62618ee315f8bb39

# e) 刷入
adb reboot bootloader
fastboot flash boot_b new-boot.img
fastboot reboot

内核补丁与它三个决定成败的开关 (KBUILD_GENDWARFKSYMS_STABLE=1、MODVERSIONS=y、MODULE_SCMVERSION=y)在 kernel/README.md 里有解释。

2. 安装 Droidspaces + Anland → host/README.md

# 从 Droidspaces APK 里取出二进制与 boot 模块
STAGE=/data/local/tmp/ds-install
adb shell su -c "mkdir -p $STAGE"
adb push droidspaces-aarch64 busybox-aarch64 boot-module Anland-v5.24.apk "$STAGE/"

adb push host/install-droidspaces.sh /data/local/tmp/
adb shell su -c 'sh /data/local/tmp/install-droidspaces.sh \
    --stage /data/local/tmp/ds-install \
    --anland-apk /data/local/tmp/ds-install/Anland-v5.24.apk'

# 重启,让 boot 模块在正确的 SELinux 上下文里启动 droidspacesd
adb reboot
adb shell su -c '/data/local/Droidspaces/bin/droidspaces check'   # 期望 10/10 MUST + 9/10 RECOMMENDED + 9/9 OPTIONAL

3. 创建 Ubuntu 26.04 容器 → host/README.md

STAGE=/data/local/tmp/ds-u2604-stage
adb shell su -c "mkdir -p $STAGE"
adb push ubuntu-26.04-resolute-arm64-rootfs.tar.xz "$STAGE/rootfs.tar.xz"
adb push post_extract_fixes.sh "$STAGE/"

adb push host/create-ubuntu2604.sh /data/local/tmp/
adb shell su -c 'sh /data/local/tmp/create-ubuntu2604.sh \
    --stage /data/local/tmp/ds-u2604-stage --name ubuntu2604 --size-gb 32'

4. 启动 MaliBridge 宿主 supervisor → host/README.md

STAGE=/data/local/tmp/ds-mali-stage
adb shell su -c "mkdir -p $STAGE"
adb push vkbridge-server "$STAGE/"       # 来自 xring-o3-mali-host-2026.11.08-2.tar.zst
adb push host/ksu-module/u2604_mali_host /data/local/tmp/u2604_mali_host
adb shell su -c 'sh /data/local/tmp/u2604_mali_host/install-host-mali.sh --stage /data/local/tmp/ds-mali-stage'

5. 安装 Mali GPU 栈 → container/README.md

adb push container/libgbm-shim/shim.c /data/local/tmp/
DS=/data/local/Droidspaces/bin/droidspaces
adb shell su -c "$DS -n ubuntu2604 run -- bash /opt/mb-sock/setup-mali-stack.sh --stage /opt/mb-sock"
# 期望:Vulkan 1.3.278 Mali-G925-Immortalis r49p1 · Zink OpenGL 4.6 Core

6. 构建桌面 → container/README.md

adb push container/niri-anland /data/local/tmp/niri-anland
adb shell su -c "$DS -n ubuntu2604 run -- su - ubuntu -c \
    'bash /opt/mb-sock/build-niri-ubuntu2604.sh --src /opt/mb-sock/anland-patched.tar.gz'"

# 安装会话包装脚本与 unit,然后启动
adb shell su -c "$DS -n ubuntu2604 run -- bash -lc '
    install -m 755 /opt/mb-sock/ubuntu2604-desktop-session /usr/local/bin/
    install -m 644 /opt/mb-sock/desktop-session.service /etc/systemd/system/
    install -m 644 /opt/mb-sock/config.kdl /home/ubuntu/.config/niri/config.kdl
    systemctl daemon-reload && systemctl enable --now desktop-session.service
    systemctl status desktop-session.service --no-pager -l'"

7. 安装 Wine + DXVK → container/README.md

adb shell su -c "$DS -n ubuntu2604 run -- bash /opt/mb-sock/setup-wine-dxvk.sh --stage /opt/mb-sock"

# 随时可手动复验
adb shell su -c "$DS -n ubuntu2604 run -- su - ubuntu -c \
    'HODLL=wowbox64.dll wine-mali Z:\\tmp\\dxvk_probe_x86.exe'"
adb shell su -c "$DS -n ubuntu2604 run -- su - ubuntu -c \
    'wine64-box Z:\\tmp\\dxvk_probe_x64.exe'"

8. (可选)重跑 GPU 缓冲实验 → repro/README.md

bash repro/dmabuf-test/run.sh                      # dma-buf -> VkImage 导入,逐像素校验
python3 repro/panvk/kbase-ioctl-fix.py <so> --check # PanVK ioctl 号 sanity 检查

回滚与安全

在刷任何东西之前,确认你有一份可读的 boot_b 备份:

adb shell su -c 'dd if=/dev/block/by-name/boot_b of=/sdcard/boot_b.stock.img'
adb pull /sdcard/boot_b.stock.img
sha256sum boot_b.stock.img      # 记录下来

任何时间、任何理由都能回滚:

adb reboot bootloader
fastboot flash boot_b boot_b.stock.img
fastboot reboot

本项目的安全属性:

属性 为什么重要
绝不触碰 boot_a 最后一根救命稻草的备用槽位
绝不触碰 init_boot 任何内核回滚都不会影响 KernelSU LKM
内核只替换 boot 的 kernel 载荷 ramdisk 不会被重签名或改动
repack-boot.sh 往返校验 SHA256 损坏的重打包不可能悄悄上机
verify-kernel-artifact.py 以 2786 个 CRC + BTF + config 为闸门 会拒绝任何会导致 bootloop 的构建
不调整任何分区大小,不用 fastboot -w,不用 flashall 这些脚本里不存在数据丢失路径

关键工程坑点与解法

1. magiskboot 在 6.18 上的 kernel / kernel_dtb 拆分 —— 两条 bootloop 路径

在 GKI 6.18 上,boot 镜像里的内核载荷是单个未压缩 arm64 Image (内核正文加上追加的 FDT —— jinghu 上为 43,731,456 字节)。magiskboot unpack 不会 把它整体保留,而是靠 DTB 扫描启发式地切开:

kernel      = 22,482,816 B
kernel_dtb  = 21,248,640 B      # KERNEL_SZ = 两者之和

两半都是承重的。切分点只是 magiskboot 扫描的产物,并非真实边界 —— 这就造成 两条互相独立的 bootloop 路径:

错误做法 后果
rm kernel_dtb 后重打包原始 kernel KERNEL_SZ 塌缩到 22,482,816 → Image 被截断 → bootloop
把新 Image 写进 kernel 却保留 kernel_dtb KERNEL_SZ 变成 43,731,456 + 21,248,640 → 载荷重复 → 损坏

唯一正确的组合是两件事都做:删掉 kernel_dtb 并且 把完整的 Image 装成 kernel。 magiskboot 随后会自己重新切分新 Image,KERNEL_SZ 就又对了。

因为切分是无损的,重打包后必须成立的不变式是:

sha256(cat kernel kernel_dtb) == sha256(Image)

kernel/repack-boot.sh 在产出镜像前正是强制这一点 —— 只比较 kernel 是错的(它只是启发式碎片),只比较大小会漏掉内容损坏。 已端到端验证:喂给它原厂 boot.img 与构建出的 Image,能逐字节复现已知的 参考镜像(b816785a…),而截断路径得到 b5b58f0b… 并被拒绝。

2. KBUILD_GENDWARFKSYMS_STABLE=1 不是可选项

Droidspaces 官方补丁把被移动的成员包进 union { char __kabi_ignored_0; struct sysv_sem sysvsem; }。这个 __kabi_ignored 前缀 只在 stable 模式下才被认账 —— scripts/gendwarfksyms/dwarf.c 的 is_kabi_ignored() 开头就是 if (!stable) return false;。

若不 export KBUILD_GENDWARFKSYMS_STABLE=1:

  • 补丁仍然能干净地打上,
  • 运行时布局仍然正确,
  • 但 task_struct 的类型串变了,于是每一个签名里提到 struct task_struct * 的导出符号都会得到新 CRC(WildKernels 在 6.18 上实测 6,388 个漂移符号), 所有厂商模块都会拒载。

因此 verify-kernel-artifact.py 会断言 build.log 里出现字面串 KBUILD_GENDWARFKSYMS_STABLE=1。

3. adbd 的 cgroup 回收会杀掉 GPU 桥 —— PR_SET_PDEATHSIG

vkbridge-server 设了 PR_SET_PDEATHSIG,父进程一死内核就 SIGKILL 它。 在 adb shell su -c '...' 下父进程是 adbd 会话,而 adb 一断开 Android 就会回收 整个按会话的 cgroup。桥会在传帧途中消失,容器里的 Vulkan 客户端拿到 ECONNRESET 或者直接卡死。

解法分两部分,缺一不可:

  1. 一个永不退出的 supervisor,让 PDEATHSIG 永不触发,并在 server 因其他任何原因 死掉时重新 exec 它。
  2. 把 supervisor 和 server 都移进根 cgroup(把 PID 写进 /sys/fs/cgroup/cgroup.procs), 让按会话的回收够不着它们。

再加上 oom_score_adj=0,避免内存压力时 LMKD 挑中 GPU 桥。 见 host/ksu-module/u2604_mali_host/persist/supervisor.sh。

4. 相对路径的 Vulkan ICD 会静默失败

Mali 栈 bundle 里自带的 ICD JSON 写的是:

{ "ICD": { "library_path": "../../../vkbridge/libvulkan_droidbridge.so" } }

Vulkan loader 会把相对 library_path 相对进程 CWD 解析,而不是相对 JSON 自己所在目录。 于是它在一个目录下能用,换个目录就返回 VK_ERROR_INCOMPATIBLE_DRIVER —— 且完全不提示原因。

解法: 永远往系统 ICD 目录里装一份绝对路径 ICD:

// /usr/share/vulkan/icd.d/90-droidbridge.json
{ "ICD": { "library_path": "/opt/mali-stack/current/vkbridge/libvulkan_droidbridge.so",
           "api_version": "1.4.341" } }

5. sd-notify 0.5 的 API 变更会打断 xwayland-satellite

xwayland-satellite 调的是 0.4 API:

sd_notify::notify(true, &[b"READY=1"])   // 0.4:第一个参数是 unset_environment

sd-notify 0.5 去掉了那个 bool。Ubuntu 26.04 带的正是 0.5,于是构建会以 E0061 (参数个数不对)失败。修法是一条幂等的 sed(0.5 总是 unset,所以丢掉该标志在行为上等价):

sed -i -E 's|sd_notify::notify\([[:space:]]*(true|false)[[:space:]]*,[[:space:]]*&|sd_notify::notify(\&|g' "$SAT_LIB"

已在 container/niri-anland/build-niri-ubuntu2604.sh 中处理。

6. WINEDLLOVERRIDES="mscoree,mshtml=" 防的是卡死,不只是噪音

首次 wineboot --init 时 Wine 会尝试下载并运行 Mono/Gecko 安装器。在无头容器里这会 永远挂住 —— wineboot 永不返回,prefix 停在半初始化状态。脚本化安装必须禁用这两个组件, 而 D3D 应用也从不需要它们。

7. Hangover 的 libarm64ecfex.dll 在 x86_64 上会执行 HLT #1

ARM64EC 不是通用的 x86_64 CPU。给 Hangover 的模拟层喂 64 位 x86 指令流,它会 执行 HLT #1 直接终止进程。这就是 64 位 Windows 二进制完全无法走 Hangover 的原因。

8. apt 的 Box64 0.3.8 在 39 位 VA 上会崩

XRING O1 跑的是 VA_BITS=39(512 GB 用户态范围)。Ubuntu 26.04 打包的 box64 是 0.3.8, 它假定 48 位地址空间 —— 一旦 guest 映射超过 512 GB,就会在 dynarec 里 SIGSEGV 或者因坏 trampoline 而 SIGILL。Box64 v0.4.5 是 VA-aware 的,由 setup-wine-dxvk.sh 从源码构建。

而且便携版 Wine 构建里的 wineserver 本身也是 x86_64,所以它需要同样处理。 没有 WINESERVER=/opt/wine-x64/bin/wineserver-box,每次 wine 调用都会永久阻塞, 等一个永远不启动(或以 Exec format error 死掉)的 server。

9. Mali 栈里的 libgbm.so.1 硬编码了一条 Arch 构建路径

自带的 shim 会 dlopen() /opt/mesa-kopper-retire-42194036783/candidate/usr/lib/libgbm.so.1.0.0, 而 Ubuntu 26.04 上不存在这个文件。gbm_create_device() 返回 NULL,所有 EGL/GLES 客户端 (zink、niri、Xwayland)都以 "failed to create gbm device" 死掉。

解法: 针对发行版自己的 libgbm 重编一个等价的转发 shim。 container/libgbm-shim/shim.c 导出同样的 38 个符号 (对照随包二进制核过 38/38,无缺无多),并把真实库路径作为编译期常量传入。

10. 没有 renderD* 节点 —— card0 必须手工创建

Droidspaces 的 --gpu 镜像表只扫描 /dev/dri 里的 renderD 前缀,所以 card0 永远不会被镜像进容器。而 XRING O1 根本没有 render 节点。容器必须自己建:

mknod /dev/dri/card0 c 226 0 && chmod 0666 /dev/dri/card0

已接入 xring-card0.service,带 DefaultDependencies=no / Before=graphical.target。

11. xring_gralloc 对原版 Anland v5.24 返回 stride=0(usage=0x900)

原版 Anland-v5.24.apk 通过 ANW_API_CPU 连接 SurfaceView 且不设 producer CPU usage 标志, 于是 xring_gralloc 分配出一块合法的线性 RGBA_8888 缓冲 (3200×2136×4 = 27,340,800 B,afbc header page num 0)、usage=0x900 —— 但返回 anb->stride == 0。原版 Anland 会拒绝它:

E Anland : buffer format/stride mismatch: requested=1 actual=1 stride=0
E Anland : only collected 0/4

解法: 使用 anland-consumer-compat-5.19.apk(来自 collegeming/xring-o3-droidspaces-package 的 release anland-consumer-compat-5.19,它会把 stride=0 回退成 width 并保留 SecondaryActivity),并在 container/niri-anland/ubuntu2604-desktop-session 里设置 ANLAND_PRESENT_BACKEND=legacy + ANLAND_SKIP_IMPLICIT_SYNC_WAIT=1。 注意 niri-anland 把虚拟输出命名为 anland-0(不是 Anland-1)。


致谢与上游

本项目完全站在别人的工作之上。

项目 作用 链接
Droidspaces-OSS(ravindu644) 容器运行时本体、它的 GKI kABI 补丁、post_extract_fixes.sh,以及整个 Android 侧模型 ravindu644/Droidspaces-OSS
dijun-kernel-ci(shu0011) 构建 CRC 忠实内核的 GKI 6.18 CI;本仓库补丁即对照 298abc34 的 diff shu0011/dijun-kernel-ci
xring-o3-droidspaces-package(collegeming) O3 Mali 栈 bundle、MaliBridge 宿主 server,以及 Anland consumer compat 构建 collegeming/xring-o3-droidspaces-package
anland(SuperTurtleDev) 显示 broker 与 niri producer,其构建配方产出了桌面的 .deb SuperTurtleDev/anland
MaliBridge 把 Mali 带进 glibc 容器的 Vulkan 桥(libvulkan_droidbridge.so) 见上面的 O3 包
hangover(AndreRH) 带 wowbox64 / libwow64fex / libarm64ecfex WoW64 thunk 的 ARM64 Wine AndreRH/hangover
box64(ptitSeb) x86 / x86_64 dynarec;v0.4.5 是第一个 VA-39 安全的版本 ptitSeb/box64
dxvk(doitsujin) D3D8/9/10/11 → Vulkan 翻译,三种架构 doitsujin/dxvk

用到但未 vendored 的其他上游:niri、 Smithay、 xwayland-satellite、 KernelSU、 Mesa、 AnyKernel3、 mali-panvk。


许可证(License)

GPL-3.0。

本仓库只包含原创脚本、补丁与文档,外加为本项目撰写、已脱敏的文档副本。 这里不再分发任何第三方二进制;release 资产由上面列出的上游源码构建,仍遵循各自许可 (Droidspaces-OSS 与 MaliBridge 为 GPL-3.0;Hangover、Box64、DXVK 各有自有许可)。

贡献(Contributing)

欢迎提 Issue 与 PR,尤其是:

  • 其他 jinghu 固件版本上的 CRC/BTF 结果,
  • Anland 最后一步 root 授权的真机确认,
  • 兄弟机型 XRING O1(dijun、violin)的等价方案。

反馈时请附上 uname -r、droidspaces version,以及 python3 kernel/verify-kernel-artifact.py 的输出。


⚠️ 免责声明 / Disclaimer

本项目为非官方研究项目,与小米(Xiaomi)、玄戒(XRING)、Google 及任何上游项目官方无关。

仓库内容涉及自编内核、刷写 boot 分区、KernelSU 模块、SELinux permissive 域等高危操作, 可能导致设备变砖、数据丢失、失去保修、无法接收 OTA。所有操作风险自负, 作者不对任何直接或间接损失承担责任。请务必先完整备份、确认能救砖再动手。

本项目不包含任何厂商专有二进制(Mali 驱动、固件等),也不用于规避 DRM、反作弊或任何付费机制; Wine / DXVK / Box64 / FEX 仅用于运行你自己拥有合法授权的软件。

部分流程需要从第三方仓库下载 APK 或内核,其许可与安全性由各自发布者负责,请自行甄别。

若权利人认为本仓库内容侵犯其权益,请通过仓库 Issues 联系,我们会及时删除。

完整条款见 DISCLAIMER.md。

许可证

  • 本仓库自有代码与文档:GPL-3.0(见 LICENSE)。
  • 仓库内含第三方补丁,各自遵循其上游许可,不适用本仓库的 GPL-3.0: 内核补丁 GPL-2.0-only、mutter 补丁 GPL-2.0-or-later、 Mesa 补丁 MIT、xwayland-satellite 相关 MPL-2.0。
  • 逐文件对照表见 LICENSES.md。

参考项目与致谢

本项目建立在以下公开工作的基础上。文中仅参考其思路、文档与接口,未复制任何未声明许可仓库的代码:

项目 许可 在本项目中的作用
ravindu644/Droidspaces-OSS GPL-3.0 容器运行时本体(APK 与 CLI),本仓库为其适配内容
collegeming/xring-o3-droidspaces-package 未声明 同族 XRING O3 机型复现包,参考 Mali 栈布局与资产校验方式
SuperTurtleDev/anland GPL-3.0 Anland 显示协议(Wayland on Android)
shu0011/dijun-kernel-ci 未声明 内核 CI 构建流程参考,见 kernel/dijun-ci-config.md
tiann/KernelSU GPL-3.0 LKM 形态的 root 方案
LyraVoid/FinaSU GPL-3.0 KernelSU 分支参考
osm0sis/AnyKernel3 见上游 内核 zip 打包模板(AK3)
mesa3d/mesa MIT 上游 Mesa,PanVK 补丁的基础
Alhkxsj/mesa MIT(同上游) PanVK 的 pan_kmod kbase 后端分支,本项目补丁基于它
JimVulkan/mali-panvk MIT PanVK for Mali 的另一条移植线,交叉验证结论
torvalds/linux GPL-2.0-only 内核补丁的最终上游
YaLTeR/niri 见上游 niri 合成器,niri-anland 桌面的基础
Supreeeme/xwayland-satellite MPL-2.0 在 niri 下提供 X11 支持
Smithay/Smithay MIT anland 所依赖的 Wayland 合成器框架
FEX-Emu/FEX MIT x86 / x86_64 用户态翻译
ptitSeb/box64 MIT x86_64 二进制翻译(Wine 路线)
AndreRH/hangover LGPL-2.1 ARM64 上的 WoW64 / Wine 支持
doitsujin/dxvk Zlib D3D9/10/11 → Vulkan 翻译层

致谢顺序与重要性无关。若你是上述项目的作者并希望调整署名方式,欢迎提 Issue。

完整版致谢清单见 ACKNOWLEDGEMENTS.md。

AI 工具使用声明

本仓库的代码、脚本与文档在编写过程中使用了以下 AI 工具辅助:

  • Gemini 4 Neon / Hydrogen
  • GLM-5.4
  • DeepSeek V4.1-Flash / DeepSeek V4.0-Pro
  • MiniMax M4

所有 AI 辅助产出的改动均经人工审阅并在真机上实测验证后才提交;AI 不参与最终判断, 仓库内容的正确性与安全性仍由维护者负责。


English

返回中文版 / Back to Chinese · 一键导入指南 / Import Guide

The complete original English README follows, unchanged.

Droidspaces on XRING O1 — GKI 6.18 kABI-safe kernel + Ubuntu 26.04 GPU desktop + 3-arch Wine

A complete, reproducible recipe for running a GPU-accelerated Linux desktop container on a Xiaomi Pad 7 Ultra (jinghu, XRING O1 SoC) without breaking vendor kABI.

Zero-CRC-drift GKI 6.18.21 kernel · Droidspaces v7.2.0 · Ubuntu 26.04 ARM64 · Mali-G925 Vulkan 1.3.278 via Zink · native niri-anland desktop · Wine + DXVK 2.7.1 across arm64 / x86 / x86_64.


摘要(中文)

本仓库是小米平板 7 Ultra(jinghu,XRING O1 SoC,Mali-G925-Immortalis MC16 r0p1) 上完整跑通 Droidspaces Linux 桌面容器的可复现方案。核心难点是:厂商内核缺 CONFIG_PID_NS / CONFIG_IPC_NS / CONFIG_SYSVIPC,而补开这些项会改变 task_struct 布局,导致 286 个厂商预编译模块因 CRC 不符集体拒载 → bootloop。

本方案的关键结论:用 Droidspaces 官方的 GKI 6.12+ kABI 补丁,把那 24 字节搬进 task_struct 已有的空洞里,配合 KBUILD_GENDWARFKSYMS_STABLE=1,可以做到 2,786 个导出符号 CRC 零漂移,同时拿到全部 namespace 支持。现有 KernelSU LKM init_boot 完全不用动。

在此之上:Ubuntu 26.04 容器、O3 Mali 栈(Vulkan 1.3.278 + Zink OpenGL 4.6)、 原生 niri-anland 桌面(xwayland-satellite + xwayland)、以及 Wine + DXVK 2.7.1 的三种 Windows 架构(ARM64 原生 / 32 位 x86 / 64 位 x86_64)全部实测跑通硬件 D3D11。


Target platform

项 值
Device Xiaomi Pad 7 Ultra — jinghu / <PRODUCT-MODEL>
SoC XRING O1 (ro.board.platform=O1_asic)
GPU Mali-G925-Immortalis MC16 r0p1, vendor Vulkan 1.3.278, kbase r49p1 (CSF)
OS Android 17 (SDK 37), A/B, erofs, 4K pages
Kernel GKI 6.18.21 — 6.18.21-android17-5-g284297031c53-abogki553682993-4k
Address space VA_BITS=39 (512 GB user range) — do not change to 48, it bootloops
DRM nodes only /dev/dri/card0 (226:0); there is no renderD*
Root KernelSU (ksud 3.3.1), modules under /data/adb/modules/
RAM 15.9 GB + 8 GB swapfile + 16 GB zram (lzo-rle)
Panel 3200×2136 @ 120 Hz, density 360

Preserved as-is: the existing KernelSU LKM in init_boot is untouched and keeps working. This project only replaces the kernel inside the boot partition.


Verified status matrix

Component Result Evidence
GKI 6.18.21 noksu-ds kernel ✅ PASS 2,786/2,786 stock vmlinux CRCs exact match (0 drift, MISMATCHED = 0) · 0 C-symbol CRC changes · task_struct=4736, module=1664, VA_BITS=39 · droidspaces check 10/10 [MUST HAVE] + 9/10 [RECOMMENDED] + 9/9 [OPTIONAL] · 286 stock modules load cleanly · existing KernelSU LKM works out of the box
Droidspaces v7.2.0 ✅ PASS droidspacesd running under SELinux Enforcing
Ubuntu 26.04 ARM64 container ✅ PASS 32 GB sparse ext4 image, systemd as PID 1, system-is-running=degraded→running
O3 Mali GPU stack ✅ PASS xring-o3-mali-stack-2026.11.12-v1 + rebuilt Ubuntu 26.04 libgbm.so.1 shim + root-cgroup auto-restarting vkbridge-server KSU module → Vulkan 1.3.278 (Mali-G925-Immortalis, r49p1) + Zink OpenGL 4.6 Core / GLES 3.2
Native ARM64 desktop ✅ PASS niri-anland 26.4.0 + xwayland-satellite 0.8.3 + xwayland 24.1.10 .debs built on Ubuntu 26.04; desktop-session.service active with ANLAND_DRM_DEVICE=/dev/dri/card0
Wine — ARM64 native ✅ PASS wine-mali / Hangover 11.16
Wine — 32-bit x86 ✅ PASS wine-mali + HODLL=wowbox64.dll + DXVK 2.7.1 x32 → D3D11 hardware PASS on Mali-G925-Immortalis
Wine — 64-bit x86_64 ✅ PASS wine64-box / Box64 v0.4.5 + portable Wine 11.23 + wineserver-box + DXVK 2.7.1 x64 → D3D11 hardware PASS on Mali-G925-Immortalis (VRAM 15327 MB, D3D_FEATURE_LEVEL_11_0)
Anland live on-screen ✅ PASS Mali-patched anland-consumer-compat-5.19.apk (stride=0 → width fix) connected at 3200×2136 @ 120 Hz, pacing queue_fps=117 (queue_fail=0), zero-copy 3200×2136 DMA-BUF imported into Mali-G925-Immortalis, zwp_linux_dmabuf_v1 v3, live foot + waybar + niri-anland hot-reload scale 2.0 on anland-0

Legend: ✅ verified end-to-end on real Xiaomi Pad 7 Ultra hardware.


Architecture

flowchart TD
    subgraph ANDROID["Android 17 / XRING O1 host"]
        direction TB
        BOOT["boot_b<br/>GKI 6.18.21 noksu-ds<br/>VA_BITS=39 · 4K pages<br/>2786/2786 CRC exact"]
        INITBOOT["init_boot<br/>KernelSU LKM (untouched)"]
        DSAPP["Droidspaces v7.2.0 APK"]
        ANLAPP["Anland v5.24 consumer APK"]
        KSU["KSU module<br/>u2604_mali_host"]
        SUP["supervisor.sh<br/>root cgroup · auto-restart"]
        VKB["vkbridge-server<br/>MaliBridge host"]
        MALI[("/dev/mali0<br/>kbase r49p1 CSF")]
        CARD0[("/dev/dri/card0<br/>226:0")]
        DMA[("/dev/dma_heap")]
    end

    subgraph CONTAINER["Ubuntu 26.04 ARM64 container (sparse ext4, systemd)"]
        direction TB
        DAEMON["droidspacesd<br/>SELinux Enforcing"]
        ICD["90-droidbridge.json<br/>ABSOLUTE path ICD"]
        STACK["O3 Mali stack<br/>mesa kopper + zink"]
        GBM["libgbm.so.1 shim<br/>38 symbols forwarded"]
        NIRI["niri-anland 26.4.0<br/>desktop-session.service"]
        XWS["xwayland-satellite 0.8.3<br/>xwayland 24.1.10"]
        WINE["Wine + DXVK 2.7.1<br/>arm64 · x86 · x86_64"]
    end

    BOOT --> DAEMON
    INITBOOT --> KSU
    KSU --> SUP
    SUP --> VKB
    VKB --> MALI
    DSAPP --> DAEMON
    DAEMON -->|"/run/display.sock"| NIRI
    ANLAPP -.->|"display.sock"| NIRI

    MALI --> VKB
    VKB -->|"mali.sock"| STACK
    DMA --> STACK
    CARD0 --> NIRI
    CARD0 --> XWS

    ICD --> STACK
    STACK --> GBM
    GBM --> NIRI
    STACK --> WINE
    NIRI --> XWS
    NIRI -->|"Anland surface"| ANLAPP

    style ANDROID fill:#1a2332,stroke:#4a90d9,color:#e8f0f8
    style CONTAINER fill:#2d2416,stroke:#d9a441,color:#f8f0e8
Loading

Data flow, in words

  1. boot_b carries the self-built noksu-ds kernel. Its exported-symbol CRCs are byte-identical to the stock kernel, so all 286 vendor modules in vendor_dlkm / system_dlkm load without complaint.
  2. init_boot keeps the stock KernelSU LKM. ksuinit binds symbols by kallsyms address (SHN_ABS), which bypasses check_version() entirely — so CRCs are irrelevant to it.
  3. The KSU module u2604_mali_host (v1.1.0) starts the 5 host daemons at late_start, each under its own pidfile-guarded supervisor. Every supervisor moves itself and its child into the root cgroup and never exits, which defeats both PR_SET_PDEATHSIG and Android's per-session cgroup reaping. anland-sock-watch.sh additionally re-points the Anland display-socket aliases after every container restart, and refresh-display.sh re-attaches the presenter when HyperOS has force-stopped it.
  4. vkbridge-server exposes Mali's Vulkan through a unix socket (mali.sock) on a bind mount that the container sees as /opt/mb-sock/mali.sock.
  5. Inside the container, libvulkan_droidbridge.so is selected by an absolute-path ICD; Zink runs on the kopper Mesa build, and libgbm.so.1 is the rebuilt shim.
  6. niri-anland composites on /dev/dri/card0 and hands frames to the Anland broker at /run/display.sock, which the Anland consumer APK presents on an Android surface.
  7. Wine reaches D3D11 three different ways, all landing on the same Mali device.

Repository layout

.
├── README.md                              # this file
├── LICENSE                                # GPL-3.0
├── .gitignore
├── kernel/
│   ├── README.md                          # build switches, verifier, repack, flash/rollback
│   ├── patches/
│   │   ├── 001.GKI-6.12-or-above-fix_sysvipc_kabi.patch
│   │   ├── 001.GKI-6.12-or-above-fix_sysvipc_kabi.patch
│   ├── verify-kernel-artifact.py          # offline CRC + BTF + config gate
│   └── repack-boot.sh                     # magiskboot repack with rm -f kernel_dtb + SHA256 round-trip
├── host/
│   ├── README.md
│   ├── install-droidspaces.sh             # Droidspaces v7.2.0 + Anland v5.24 + daemon verify
│   ├── create-ubuntu2604.sh               # 32 GB sparse ext4 Ubuntu 26.04 ARM64
│   ├── gpufreq-boost/                     # XRING O1 GPU freq lazy-boost (source + in-container CLI)
│   └── ksu-module/u2604_mali_host/        # one-click KSU module v1.1.0 (source only, no ELF)
│       ├── README.md                      # daemons, refresh-display.sh logic, build-from-source
│       ├── module.prop
│       ├── customize.sh
│       ├── service.sh
│       ├── sepolicy.rule
│       ├── install-host-mali.sh
│       └── persist/                       # 6 supervisors + 2 daemon C sources
├── container/
│   ├── README.md
│   ├── setup-mali-stack.sh                # O3 stack + libgbm shim + ICD + card0 + verify
│   ├── u2604-container-localization.sh     # nosnap pin + PackageKit polkit + zh_CN/Asia-Shanghai
│   ├── u2604-apps-arm64.sh                 # the 10 ARM64 non-Snap applications
│   ├── gnome-extensions/                   # custom GNOME Shell 50 extensions (source only)
│   │   └── android-brightness@u2604/      # full-width QS brightness slider, colSpan=2 below Volume
│   │       ├── extension.js
│   │       └── metadata.json
│   ├── libgbm-shim/shim.c                 # 38-symbol forwarding shim
│   ├── mutter-anland/                      # 4 clean source patches + rebuild scripts (no binaries)
│   │   ├── README.md                       # patch order, the mandatory --prefix=/usr note
│   │   ├── prepare-source.sh               # Ubuntu src + quilt + Anland + 4 u2604 patches
│   │   ├── mutter-anland-rebuild.sh        # meson/ninja + atomic deploy + acceptance
│   │   ├── u2604-anland-scroll-invert.patch
│   │   ├── u2604-touchpad-seat-wrappers.patch
│   │   ├── u2604-touchpad-bridge-client.patch
│   │   └── u2604-anland-ondemand-present.patch
│   ├── xwayland/                           # smart wrapper + one-shot glamor verification
│   │   ├── README.md
│   │   ├── Xwayland                        # exec -a Xwayland + NODEVICE_SELECT=1
│   │   └── xwayland-glamor-verify.sh
│   ├── niri-anland/
│   │   ├── build-niri-ubuntu2604.sh       # O3 patches + sd-notify 0.5 fix -> 3 .debs
│   │   ├── config.kdl
│   │   ├── ubuntu2604-desktop-session
│   │   └── desktop-session.service
│   └── wine/
│       ├── setup-wine-dxvk.sh             # Hangover + DXVK + Box64 v0.4.5 + Wine 11.23
│       ├── bin/wine-mali
│       ├── bin/wine64-box
│       ├── bin/wineserver-box
│       └── dxvk_probe.c
├── docs/
│   ├── README.md                          # index + upstream commit map
│   ├── 01-可行性报告.md … 08-桌面窗口方案定稿.md
│   ├── kernel-6.18-kabi-report.md
│   ├── userspace-architecture-report.md
│   ├── container-recovery.md              # rebuild ubuntu2604 from scratch (64 GB sparse)
│   ├── assets-manifest.md
│   └── reports/                           # sanitized engineering / acceptance reports
└── repro/
    ├── README.md
    ├── dmabuf-test/                       # sender + importer + shaders + scripts (no binaries)
    └── panvk/                             # kbase-ioctl-fix.py + ICD + caps (no .so)

Prebuilt artifacts — GitHub Releases v1.1.0 (Latest, incl. kernel) + v1.0.0 (original kernel release)

Binaries are not in git. Everything you need to flash or install is attached to the releases.

v1.1.0 (Latest) — PanVK container rootfs + KSU one-click module + prebuilt kABI-safe kernel

⬇ Go to Release v1.1.0

Asset What it is for Size SHA256
u2604-host-oneclick-1.1.0.zip KernelSU one-click module: the 5 host daemons + refresh-display.sh (MaliBridge binary not bundled) 1,031,955 B 65df94222948a8e37ace45b7ac32955fa60d077e97169d0728ddd35855c6f034
ubuntu2604-xring-o1-panvk-public-rootfs.tar.xz cleaned public container rootfs — Droidspaces App "Import rootfs" one-click import format 1,595,691,468 B 08da79008aa10bc1e1fccd0b151d0552ac2018784f8e944200a6d217d7c53618
ubuntu2604-xring-o1-panvk-public-rootfs.tar.zst same rootfs for manual CLI import (faster to extract) 1,979,925,049 B 4d4884d67745206e705927a81dc8159e793afc481ab9c8f114d6d9bf17ee2059
boot-xring-o1-6.18-noksu-droidspaces-va39-gki553682993.img prebuilt kABI-safe kernel boot.img (noksu-ds, VA=39, GKI v4 pure kernel, ramdisk_size == 0) — no unpacking needed, flash straight to the boot partition with fastboot flash boot or Kernel Flasher; ⚠️ this boot.img does NOT contain KernelSU (noksu) — KernelSU must be provided through the init_boot partition (LKM mode), and flashing boot does not affect the KernelSU already in init_boot; ⚠️ unlocked-Bootloader (BL) devices ONLY — jailbroken / locked-BL devices that flash it will be hard-bricked 96 MiB (100,663,296 B) b816785aeca1d53ebdeb0f94d09d7d08b7c6bead697a80974c9885279439157e
README-IMPORT.md bilingual (ZH/EN) import guide, with the de-identification list and licence attribution 33,307 B de5da15314b49773036b068b76e24969c17646686191fe15c9691fe691578bae
container.config.template de-identified container config template (static_nat_ip and uuid blanked) 3,582 B 02e362aa99faaa81eb3b3d902cbc3465bf6a90bada89b627dc0f9a7cddbf30a5
SHA256SUMS checksums of the six public files above 623 B 8c23d0d996b6b181a038de8ad6a1c66211f676d0a987c9287b279d29ca29dc48

Caution

⚠️ boot-xring-o1-6.18-noksu-droidspaces-va39-gki553682993.img may ONLY be flashed on devices with an unlocked Bootloader (BL); jailbroken / temporary-root devices with a locked BL must NEVER flash this kernel — it triggers an AVB verification failure and hard-bricks the device!

🔑 This boot.img does NOT contain KernelSU (a noksu clean kernel) — KernelSU must be provided through the init_boot partition (LKM mode); flashing the boot partition does not affect the KernelSU you already have in init_boot.

See the “Quick start” walkthrough above for the full flashing flow.

Verify after downloading:

sha256sum -c SHA256SUMS      # all 6 entries OK

v1.1.0 highlights

  • PanVK 16-core direct-drive open-source graphics stack — the rootfs's primary GPU stack is GPU_STACK=panvk (Mali-G925-Immortalis MC16, all 16 cores), pure open-source Mesa / PanVK driving the GPU directly, so nothing is needed on the host side for graphics.
  • KSU one-click module u2604-host-oneclick-1.1.0.zip — a single zip deploys all 5 host daemons; includes magnetic-keyboard touchpad EVIOCGRAB exclusive locking (grabs only while the container bridge is connected ∧ the consumer is in the foreground ∧ the screen is on, otherwise it immediately EVIOCREVOKEs back to HyperOS), plus the refresh-display.sh fix: the new attached() check requires ≥2 ESTABLISHED connections on the broker and a live consumer process, which fixes "consumer force-stopped by HyperOS but still judged already attached → no presenter on the desktop, never self-healing".
  • Control-centre brightness slider fix — the in-house GNOME Shell extension android-brightness@u2604 renders full-width with colSpan=2, immediately below the volume slider, instead of being squeezed into a narrow strip on the right.
  • Droidspaces App .tar.xz one-click import — push …-public-rootfs.tar.xz to the tablet, tap Import rootfs in the App, and it creates the 64 GB sparse ext4, extracts and runs post_extract_fixes.sh for you; zstd / GNU tar are no longer needed on the PC side.

The container rootfs and the one-click module are fully documented in docs/README-IMPORT.md (bilingual import guide, with the de-identification list and licence attribution).

v1.0.0 — prebuilt GKI 6.18.21 kABI-safe kernel (original release) + niri-anland route .debs

v1.1.0's kernel asset is now a directly flashable boot.img (boot-xring-o1-6.18-noksu-droidspaces-va39-gki553682993.img, a GKI v4 pure-kernel image with ramdisk_size == 0, no unpacking needed); v1.0.0 still keeps the original AnyKernel3 zip plus the three niri-anland route .debs:

Asset What it is
ak3-xring-o1-6.18-noksu-droidspaces-va39-gki553682993.zip AnyKernel3 flashable kernel package (noksu-ds, VA=39) — only on v1.0.0; v1.1.0 now ships the directly flashable boot-…img image instead; ⚠️ unlocked-BL devices ONLY, jailbroken / locked-BL devices will be hard-bricked
niri-anland_26.4.0+anland5-1_arm64.deb native ARM64 niri-anland compositor
xwayland-satellite_0.8.3+anland5-1_arm64.deb Xwayland rootless satellite
xwayland_24.1.10-1_arm64.deb matching Xwayland server

The v1.1.0 PanVK rootfs ships the 5-patch libmutter-18.so.0.0.0 (incl. on-demand present ANLAND_ON_DEMAND_PRESENT) and the smart-wrapper Xwayland 2:24.1.10-1 built in, so it does not need the three .debs above; those are the assets for the niri-anland route.

Kernel Image SHA256 (also embedded in ci-out summary):

721e206940f962c3cb9c04dacd06100943801462251be8da62618ee315f8bb39

The three .debs are built by container/niri-anland/build-niri-ubuntu2604.sh; the kernel is built by applying the kABI patch and the CI changes described in kernel/dijun-ci-config.md to shu0011/dijun-kernel-ci @ 298abc34 and running its CI.


Reproduction guide

Every step below maps to a script in this repo. Nothing is left as "and then magic happens".

0. Prerequisites

# host tooling
sudo apt install -y android-tools-adb android-tools-fastboot python3 bpftool \
                    magiskboot build-essential

# device: KernelSU working, boot_b already backed up
adb shell su -c 'dd if=/dev/block/by-name/boot_b of=/sdcard/boot_b.stock.img'
adb pull /sdcard/boot_b.stock.img

1. Build and flash the kernel → kernel/README.md

# a) apply the CI patch on top of upstream
git clone https://github.com/shu0011/dijun-kernel-ci && cd dijun-kernel-ci
git checkout 298abc34
git apply /path/to/repo/kernel/patches/001.GKI-6.12-or-above-fix_sysvipc_kabi.patch
# 然后按 kernel/dijun-ci-config.md 调整你的 CI fork

# b) run the noksu-ds workflow, collect ci-out/noksu-ds/out/

# c) gate it — this must print FINAL GATE: PASS
python3 /path/to/repo/kernel/verify-kernel-artifact.py \
    ci-out/noksu-ds/out --variant noksu-ds --stock-dir stock

# d) repack boot.img (strips the bogus kernel_dtb, verifies round-trip)
/path/to/repo/kernel/repack-boot.sh \
    --stock boot_b.stock.img \
    --kernel ci-out/noksu-ds/out/Image \
    --out new-boot.img \
    --expect-sha256 721e206940f962c3cb9c04dacd06100943801462251be8da62618ee315f8bb39

# e) flash
adb reboot bootloader
fastboot flash boot_b new-boot.img
fastboot reboot

The kernel patch and its three make-or-break switches (KBUILD_GENDWARFKSYMS_STABLE=1, MODVERSIONS=y, MODULE_SCMVERSION=y) are explained in kernel/README.md.

2. Install Droidspaces + Anland → host/README.md

# extract binaries + boot module from the Droidspaces APK
STAGE=/data/local/tmp/ds-install
adb shell su -c "mkdir -p $STAGE"
adb push droidspaces-aarch64 busybox-aarch64 boot-module Anland-v5.24.apk "$STAGE/"

adb push host/install-droidspaces.sh /data/local/tmp/
adb shell su -c 'sh /data/local/tmp/install-droidspaces.sh \
    --stage /data/local/tmp/ds-install \
    --anland-apk /data/local/tmp/ds-install/Anland-v5.24.apk'

# reboot so the boot module starts droidspacesd in the right SELinux context
adb reboot
adb shell su -c '/data/local/Droidspaces/bin/droidspaces check'   # expect 10/10 MUST + 9/10 RECOMMENDED + 9/9 OPTIONAL

3. Create the Ubuntu 26.04 container → host/README.md

STAGE=/data/local/tmp/ds-u2604-stage
adb shell su -c "mkdir -p $STAGE"
adb push ubuntu-26.04-resolute-arm64-rootfs.tar.xz "$STAGE/rootfs.tar.xz"
adb push post_extract_fixes.sh "$STAGE/"

adb push host/create-ubuntu2604.sh /data/local/tmp/
adb shell su -c 'sh /data/local/tmp/create-ubuntu2604.sh \
    --stage /data/local/tmp/ds-u2604-stage --name ubuntu2604 --size-gb 32'

4. Start the MaliBridge host supervisor → host/README.md

STAGE=/data/local/tmp/ds-mali-stage
adb shell su -c "mkdir -p $STAGE"
adb push vkbridge-server "$STAGE/"       # from xring-o3-mali-host-2026.11.08-2.tar.zst
adb push host/ksu-module/u2604_mali_host /data/local/tmp/u2604_mali_host
adb shell su -c 'sh /data/local/tmp/u2604_mali_host/install-host-mali.sh --stage /data/local/tmp/ds-mali-stage'

5. Install the Mali GPU stack → container/README.md

adb push container/libgbm-shim/shim.c /data/local/tmp/
DS=/data/local/Droidspaces/bin/droidspaces
adb shell su -c "$DS -n ubuntu2604 run -- bash /opt/mb-sock/setup-mali-stack.sh --stage /opt/mb-sock"
# expect: Vulkan 1.3.278 Mali-G925-Immortalis r49p1 · Zink OpenGL 4.6 Core

6. Build the desktop → container/README.md

adb push container/niri-anland /data/local/tmp/niri-anland
adb shell su -c "$DS -n ubuntu2604 run -- su - ubuntu -c \
    'bash /opt/mb-sock/build-niri-ubuntu2604.sh --src /opt/mb-sock/anland-patched.tar.gz'"

# install the session wrapper + unit, then start it
adb shell su -c "$DS -n ubuntu2604 run -- bash -lc '
    install -m 755 /opt/mb-sock/ubuntu2604-desktop-session /usr/local/bin/
    install -m 644 /opt/mb-sock/desktop-session.service /etc/systemd/system/
    install -m 644 /opt/mb-sock/config.kdl /home/ubuntu/.config/niri/config.kdl
    systemctl daemon-reload && systemctl enable --now desktop-session.service
    systemctl status desktop-session.service --no-pager -l'"

7. Install Wine + DXVK → container/README.md

adb shell su -c "$DS -n ubuntu2604 run -- bash /opt/mb-sock/setup-wine-dxvk.sh --stage /opt/mb-sock"

# manual re-verify at any time
adb shell su -c "$DS -n ubuntu2604 run -- su - ubuntu -c \
    'HODLL=wowbox64.dll wine-mali Z:\\tmp\\dxvk_probe_x86.exe'"
adb shell su -c "$DS -n ubuntu2604 run -- su - ubuntu -c \
    'wine64-box Z:\\tmp\\dxvk_probe_x64.exe'"

8. (Optional) Re-run the GPU buffer experiments → repro/README.md

bash repro/dmabuf-test/run.sh                      # dma-buf -> VkImage import, pixel-verified
python3 repro/panvk/kbase-ioctl-fix.py <so> --check # PanVK ioctl-number sanity check

Rollback & safety

Before flashing anything, make sure you have a readable boot_b backup:

adb shell su -c 'dd if=/dev/block/by-name/boot_b of=/sdcard/boot_b.stock.img'
adb pull /sdcard/boot_b.stock.img
sha256sum boot_b.stock.img      # record it

Rollback, any time, any reason:

adb reboot bootloader
fastboot flash boot_b boot_b.stock.img
fastboot reboot

Safety properties of this project:

Property Why it matters
boot_a is never touched last-resort fallback slot
init_boot is never touched the KernelSU LKM survives any kernel rollback
Kernel only replaces boot's kernel payload the ramdisk is not re-signed or modified
repack-boot.sh round-trip verifies SHA256 a corrupt repack can never reach the device silently
verify-kernel-artifact.py gates on 2786 CRCs + BTF + config refuses to pass a build that would bootloop
No partition is resized, no fastboot -w, no flashall no data loss path exists in these scripts

Key engineering pitfalls & solutions

1. magiskboot's kernel / kernel_dtb split on 6.18 — two ways to bootloop

On GKI 6.18 the boot image's kernel payload is a single uncompressed arm64 Image (kernel text plus appended FDTs — 43,731,456 B on jinghu). magiskboot unpack does not keep it whole; it heuristically splits it via a DTB scan:

kernel      = 22,482,816 B
kernel_dtb  = 21,248,640 B      # KERNEL_SZ = their sum

Both halves are load-bearing. The split point is an artifact of magiskboot's scan, not a real boundary — which creates two independent bootloop paths:

Mistake What happens
rm kernel_dtb, then repack the original kernel KERNEL_SZ collapses to 22,482,816 → Image is truncated → bootloop
Write the new Image into kernel but leave kernel_dtb KERNEL_SZ becomes 43,731,456 + 21,248,640 → payload duplicated → corrupt

The only correct combination is both: remove kernel_dtb and install the complete Image as kernel. magiskboot then re-splits the new Image itself and KERNEL_SZ comes out right again.

Because the split is lossless, the invariant that must hold after repacking is:

sha256(cat kernel kernel_dtb) == sha256(Image)

kernel/repack-boot.sh enforces exactly that before it will emit an image — comparing only kernel would be wrong (it is a heuristic fragment), and comparing only sizes would miss content corruption. Verified end to end: feeding it a stock boot.img and the built Image reproduces the known-good reference image byte for byte (b816785a…), while the truncated path yields b5b58f0b… and is rejected.

2. KBUILD_GENDWARFKSYMS_STABLE=1 is not optional

The official Droidspaces patch wraps the moved members in union { char __kabi_ignored_0; struct sysv_sem sysvsem; }. That __kabi_ignored prefix is honoured only in stable mode — scripts/gendwarfksyms/dwarf.c starts is_kabi_ignored() with if (!stable) return false;.

Without export KBUILD_GENDWARFKSYMS_STABLE=1:

  • the patch still applies cleanly,
  • the layout is still correct at runtime,
  • but task_struct's type string changes, so every exported symbol whose signature mentions struct task_struct * gets a new CRC (WildKernels measured 6,388 drifting symbols on 6.18), and every vendor module refuses to load.

verify-kernel-artifact.py therefore asserts the literal string KBUILD_GENDWARFKSYMS_STABLE=1 appears in build.log.

3. adbd cgroup reaping kills the GPU bridge — PR_SET_PDEATHSIG

vkbridge-server sets PR_SET_PDEATHSIG, so the kernel SIGKILLs it the instant its parent dies. Under adb shell su -c '...' the parent is the adbd session, and Android reaps the whole per-session cgroup when adb disconnects. The bridge vanishes mid-frame and container Vulkan clients get ECONNRESET or hang.

Fix, two parts, both required:

  1. A supervisor that never exits, so PDEATHSIG never fires, and that re-execs the server if it dies for any other reason.
  2. Move both supervisor and server into the root cgroup by writing their PIDs to /sys/fs/cgroup/cgroup.procs, so per-session reaping cannot reach them.

Plus oom_score_adj=0 so LMKD does not pick the GPU bridge during memory pressure. See host/ksu-module/u2604_mali_host/persist/supervisor.sh.

4. Relative-path Vulkan ICD silently fails

The ICD JSON shipped in the Mali stack bundle uses:

{ "ICD": { "library_path": "../../../vkbridge/libvulkan_droidbridge.so" } }

The Vulkan loader resolves a relative library_path against the process CWD, not against the JSON's own directory. It works from one directory and returns VK_ERROR_INCOMPATIBLE_DRIVER from everywhere else — with no hint about why.

Fix: always install an absolute-path ICD into the system ICD dir:

// /usr/share/vulkan/icd.d/90-droidbridge.json
{ "ICD": { "library_path": "/opt/mali-stack/current/vkbridge/libvulkan_droidbridge.so",
           "api_version": "1.4.341" } }

5. sd-notify 0.5 API change breaks xwayland-satellite

xwayland-satellite calls the 0.4 API:

sd_notify::notify(true, &[b"READY=1"])   // 0.4: first arg is unset_environment

sd-notify 0.5 dropped that bool. Ubuntu 26.04 ships 0.5, so the build dies with E0061 (wrong number of arguments). The fix is a single idempotent sed (0.5 always unsets, so dropping the flag is behaviourally equivalent):

sed -i -E 's|sd_notify::notify\([[:space:]]*(true|false)[[:space:]]*,[[:space:]]*&|sd_notify::notify(\&|g' "$SAT_LIB"

Handled in container/niri-anland/build-niri-ubuntu2604.sh.

6. WINEDLLOVERRIDES="mscoree,mshtml=" prevents a hang, not just noise

On first wineboot --init Wine tries to download and run the Mono/Gecko installers. In a headless container this hangs forever — wineboot never returns and the prefix is left half-initialised. Disabling those two components is required for a scripted setup, and D3D applications never need them.

7. Hangover's libarm64ecfex.dll executes HLT #1 on x86_64

ARM64EC is not a general x86_64 CPU. Hand Hangover's emulation layer a 64-bit x86 instruction stream and it executes HLT #1, terminating the process. This is why 64-bit Windows binaries cannot go through Hangover at all.

8. apt's Box64 0.3.8 crashes on a 39-bit VA

XRING O1 runs VA_BITS=39 (512 GB user range). Ubuntu 26.04's packaged box64 is 0.3.8, which assumes a 48-bit address space — the moment a guest maps above 512 GB you get SIGSEGV in the dynarec or SIGILL from a bad trampoline. Box64 v0.4.5 is VA-aware and is built from source by setup-wine-dxvk.sh.

And wineserver itself is x86_64 in the portable Wine build, so it needs the same treatment. Without WINESERVER=/opt/wine-x64/bin/wineserver-box, every wine call blocks forever waiting for a server that never starts (or dies with Exec format error).

9. libgbm.so.1 in the Mali stack hardcodes an Arch build path

The bundled shim dlopen()s /opt/mesa-kopper-retire-42194036783/candidate/usr/lib/libgbm.so.1.0.0, which does not exist on Ubuntu 26.04. gbm_create_device() returns NULL and every EGL/GLES client (zink, niri, Xwayland) dies with "failed to create gbm device".

Fix: rebuild an equivalent forwarding shim against the distro's own libgbm. container/libgbm-shim/shim.c exports the same 38 symbols (verified 38/38 against the shipped binary, no gaps, no extras) and takes the real library path as a compile-time constant.

10. There is no renderD* node — card0 must be created by hand

Droidspaces' --gpu mirror table scans /dev/dri for the renderD prefix only, so card0 is never mirrored into the container. XRING O1 has no render node at all. The container must create it itself:

mknod /dev/dri/card0 c 226 0 && chmod 0666 /dev/dri/card0

Wired into xring-card0.service with DefaultDependencies=no / Before=graphical.target.

11. xring_gralloc returns stride=0 for stock Anland v5.24 (usage=0x900)

Stock Anland-v5.24.apk connects its SurfaceView via ANW_API_CPU without setting a producer CPU usage flag, so xring_gralloc allocates a valid linear RGBA_8888 buffer (3200×2136×4 = 27,340,800 B, afbc header page num 0) with usage=0x900 — but returns anb->stride == 0. Stock Anland rejects it with:

E Anland : buffer format/stride mismatch: requested=1 actual=1 stride=0
E Anland : only collected 0/4

Fix: use anland-consumer-compat-5.19.apk (from collegeming/xring-o3-droidspaces-package release anland-consumer-compat-5.19, which falls back stride=0 → width and preserves SecondaryActivity), and set ANLAND_PRESENT_BACKEND=legacy + ANLAND_SKIP_IMPLICIT_SYNC_WAIT=1 in container/niri-anland/ubuntu2604-desktop-session. Note that niri-anland names the virtual output anland-0 (not Anland-1).


Credits & upstream

This project stands entirely on other people's work.

Project Role Link
Droidspaces-OSS (ravindu644) the container runtime, its GKI kABI patches, post_extract_fixes.sh, and the whole Android-side model ravindu644/Droidspaces-OSS
dijun-kernel-ci (shu0011) the GKI 6.18 CI that builds a CRC-faithful kernel; this repo's patch is diffed against 298abc34 shu0011/dijun-kernel-ci
xring-o3-droidspaces-package (collegeming) the O3 Mali stack bundle, MaliBridge host server, and the Anland consumer compat build collegeming/xring-o3-droidspaces-package
anland (SuperTurtleDev) the display broker and the niri producer whose build recipe produces the desktop .debs SuperTurtleDev/anland
MaliBridge the Vulkan bridge (libvulkan_droidbridge.so) that carries Mali into a glibc container see the O3 package above
hangover (AndreRH) ARM64 Wine with the wowbox64 / libwow64fex / libarm64ecfex WoW64 thunks AndreRH/hangover
box64 (ptitSeb) the x86 / x86_64 dynarec; v0.4.5 is the first VA-39-safe release ptitSeb/box64
dxvk (doitsujin) D3D8/9/10/11 → Vulkan translation, three architectures doitsujin/dxvk

Additional upstreams used but not vendored: niri, Smithay, xwayland-satellite, KernelSU, Mesa, AnyKernel3, mali-panvk.


License

GPL-3.0.

This repository contains only original scripts, patches and documentation, plus sanitized copies of documents authored for this project. No third-party binaries are redistributed here; the release assets are built from the upstream sources listed above and remain under their respective licenses (Droidspaces-OSS and MaliBridge are GPL-3.0; Hangover, Box64 and DXVK carry their own).

Contributing

Issues and PRs welcome, especially:

  • CRC/BTF results from other jinghu firmware builds,
  • on-device confirmation of the final Anland root-authorization step,
  • equivalent recipes for sibling XRING O1 devices (dijun, violin).

When reporting, please include uname -r, droidspaces version, and the output of python3 kernel/verify-kernel-artifact.py.


⚠️ 免责声明 / Disclaimer

本项目为非官方研究项目,与小米(Xiaomi)、玄戒(XRING)、Google 及任何上游项目官方无关。

仓库内容涉及自编内核、刷写 boot 分区、KernelSU 模块、SELinux permissive 域等高危操作, 可能导致设备变砖、数据丢失、失去保修、无法接收 OTA。所有操作风险自负, 作者不对任何直接或间接损失承担责任。请务必先完整备份、确认能救砖再动手。

本项目不包含任何厂商专有二进制(Mali 驱动、固件等),也不用于规避 DRM、反作弊或任何付费机制; Wine / DXVK / Box64 / FEX 仅用于运行你自己拥有合法授权的软件。

部分流程需要从第三方仓库下载 APK 或内核,其许可与安全性由各自发布者负责,请自行甄别。

若权利人认为本仓库内容侵犯其权益,请通过仓库 Issues 联系,我们会及时删除。

完整条款见 DISCLAIMER.md。

许可证

  • 本仓库自有代码与文档:GPL-3.0(见 LICENSE)。
  • 仓库内含第三方补丁,各自遵循其上游许可,不适用本仓库的 GPL-3.0: 内核补丁 GPL-2.0-only、mutter 补丁 GPL-2.0-or-later、 Mesa 补丁 MIT、xwayland-satellite 相关 MPL-2.0。
  • 逐文件对照表见 LICENSES.md。

参考项目与致谢

本项目建立在以下公开工作的基础上。文中仅参考其思路、文档与接口,未复制任何未声明许可仓库的代码:

项目 许可 在本项目中的作用
ravindu644/Droidspaces-OSS GPL-3.0 容器运行时本体(APK 与 CLI),本仓库为其适配内容
collegeming/xring-o3-droidspaces-package 未声明 同族 XRING O3 机型复现包,参考 Mali 栈布局与资产校验方式
SuperTurtleDev/anland GPL-3.0 Anland 显示协议(Wayland on Android)
shu0011/dijun-kernel-ci 未声明 内核 CI 构建流程参考,见 kernel/dijun-ci-config.md
tiann/KernelSU GPL-3.0 LKM 形态的 root 方案
LyraVoid/FinaSU GPL-3.0 KernelSU 分支参考
osm0sis/AnyKernel3 见上游 内核 zip 打包模板(AK3)
mesa3d/mesa MIT 上游 Mesa,PanVK 补丁的基础
Alhkxsj/mesa MIT(同上游) PanVK 的 pan_kmod kbase 后端分支,本项目补丁基于它
JimVulkan/mali-panvk MIT PanVK for Mali 的另一条移植线,交叉验证结论
torvalds/linux GPL-2.0-only 内核补丁的最终上游
YaLTeR/niri 见上游 niri 合成器,niri-anland 桌面的基础
Supreeeme/xwayland-satellite MPL-2.0 在 niri 下提供 X11 支持
Smithay/Smithay MIT anland 所依赖的 Wayland 合成器框架
FEX-Emu/FEX MIT x86 / x86_64 用户态翻译
ptitSeb/box64 MIT x86_64 二进制翻译(Wine 路线)
AndreRH/hangover LGPL-2.1 ARM64 上的 WoW64 / Wine 支持
doitsujin/dxvk Zlib D3D9/10/11 → Vulkan 翻译层

致谢顺序与重要性无关。若你是上述项目的作者并希望调整署名方式,欢迎提 Issue。

AI 工具使用声明

本仓库的代码、脚本与文档在编写过程中使用了以下 AI 工具辅助:

  • Gemini 4 Neon / Hydrogen
  • GLM-5.4
  • DeepSeek V4.1-Flash / DeepSeek V4.0-Pro
  • MiniMax M4

所有 AI 辅助产出的改动均经人工审阅并在真机上实测验证后才提交;AI 不参与最终判断, 仓库内容的正确性与安全性仍由维护者负责。

About

XRING O1 (Mali-G925) Droidspaces stack: GKI 6.18 kABI-safe kernel + Ubuntu 26.04 GPU desktop + 3-arch Wine. Built on Droidspaces-OSS, dijunkernel CI, anland, PanVK — see ACKNOWLEDGEMENTS.md

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages