|
| 1 | +# Warning |
| 2 | +**中文:** |
| 3 | +内核源码仍在开发中,可能会导致一些不可预料的问题,请谨慎使用。 |
| 4 | +**English:** |
| 5 | +The kernel source code is still under development and may cause some unpredictable problems. Please use it with caution. |
| 6 | + |
| 7 | +# ApartTUSITU's Xiaomi SM8250 Kernel |
| 8 | + |
| 9 | +## 目录 / Table of Contents |
| 10 | +- [简介 / Introduction](#简介--introduction) |
| 11 | +- [特性 / Features](#特性--features) |
| 12 | +- [注意事项 / Notes](#注意事项--notes) |
| 13 | +- [社区 / Community](#社区--community) |
| 14 | +- [支持的设备 / Supported Devices](#支持的设备--supported-devices) |
| 15 | +- [构建方法 / Build Instructions](#构建方法--build-instructions) |
| 16 | + - [快速构建 / Quick Build](#快速构建--quick-build) |
| 17 | + - [手动构建 / Manual Build](#手动构建--manual-build) |
| 18 | + |
| 19 | +--- |
| 20 | + |
| 21 | +## 简介 / Introduction |
| 22 | +**中文:** |
| 23 | +该 repo 基于 [LineageOS/android_kernel_xiaomi_sm8250](https://github.com/LineageOS/android_kernel_xiaomi_sm8250) 的 `lineage-23.2` 分支。HyperOS/MIUI 所需的代码及部分设备所需驱动是对照着 [Strawing 的仓库](https://github.com/liyafe1997/kernel_xiaomi_sm8250_mod) 的提交记录扣的,它们来自 [UtsavBalar1231 的仓库](https://github.com/UtsavBalar1231/kernel_xiaomi_sm8250) 和 [Xiaomi_Kernel_OpenSource](https://github.com/MiCode/Xiaomi_Kernel_OpenSource)。 |
| 24 | + |
| 25 | +**English:** |
| 26 | +This repository is based on the `lineage-23.2` branch of [LineageOS/android_kernel_xiaomi_sm8250](https://github.com/LineageOS/android_kernel_xiaomi_sm8250). |
| 27 | + |
| 28 | +Code required for HyperOS/MIUI support, as well as some device-specific drivers, was selectively cherry-pickedby comparing commit histories from [Strawing's repo](https://github.com/liyafe1997/kernel_xiaomi_sm8250_mod), which in turn sources changes from [UtsavBalar1231's repo](https://github.com/UtsavBalar1231/kernel_xiaomi_sm8250) and [Xiaomi_Kernel_OpenSource](https://github.com/MiCode/Xiaomi_Kernel_OpenSource). |
| 29 | + |
| 30 | +This kernel stands on the shoulders of giants, combining contributions from multiple upstreams to make it as practical and well-rounded as possible. |
| 31 | + |
| 32 | +--- |
| 33 | + |
| 34 | +## 特性 / Features |
| 35 | +**中文:** |
| 36 | +本内核支持 [ReSukiSU](https://github.com/ReSukiSU/ReSukiSU)(基于 [SukiSU Ultra](https://github.com/SukiSU-Ultra/SukiSU-Ultra), 一个 KernelSU 的 fork,支持 KPM) & [SuSFS](https://gitlab.com/simonpunk/susfs4ksu)。请自行安装 ReSukiSU 的管理器。NoKernelSU 版本支持应用 Magisk 和 APatch(及他们的分支)。 |
| 37 | + |
| 38 | +**Release** 里的编译好的内核成品由 `android16-aptusitu-new` 分支编译,应当能在原版 MIUI/HyperOS 和第三方的基于 AOSP 的各种 Android11-16 的 ROM 上使用。欢迎大家尝试并反馈(提 Issue 或 Pull Requests)! 酷友们到 [这个帖子](https://www.coolapk.com/feed/67088487) 讨论或反馈,也可以加入 QQ 群,或者给我私信反馈! |
| 39 | + |
| 40 | +以下是一些具体的功能: |
| 41 | +1. 支持 USB 串口驱动(CH340/FTDI/PL2303/OTI6858/TI/SPCP8X5/QT2/UPD78F0730/CP210X) |
| 42 | +2. 支持 CANBus 和 USB CAN (如 CANable) 适配器 |
| 43 | +3. F2FS 开启了 realtime discard 以更好地 TRIM 闪存 |
| 44 | +4. 支持 EROFS |
| 45 | +5. zRAM 支持 LZ4、LZ4HC、lz4k_oplus、LZ4KD、ZSTD 等压缩算法 |
| 46 | +6. 向后移植 5.10 BPF(支持安卓 16) |
| 47 | +7. 触摸屏驱动、相机驱动、音频驱动、GPU/DRM/MSM、CNSS2 驱动使用小米版本(来自 UtsavBalar1231's repo 和 MiCode, AOSP 版 Display/DRM 驱动为 LineageOS 版本), 并且触摸屏驱动具有双击亮屏节点 |
| 48 | +8. 修复[电量卡在 1% 的问题](https://github.com/liyafe1997/Xiaomi-fix-battery-one-percent),并且支持解容 |
| 49 | +9. 集成 [BBG(Baseband-guard)](https://github.com/vc-teahouse/Baseband-guard) |
| 50 | + |
| 51 | +**English:** |
| 52 | +This kernel supports [ReSukiSU](https://github.com/ReSukiSU/ReSukiSU) (based on [SukiSU Ultra](https://github.com/SukiSU-Ultra/SukiSU-Ultra), a fork of KernelSU with KPM support) & [SuSFS](https://gitlab.com/simonpunk/susfs4ksu). |
| 53 | +Please install the ReSukiSU Manager by yourself. |
| 54 | +The NoKernelSU version supports Magisk and APatch (and their forks). |
| 55 | + |
| 56 | +The prebuilt kernel in the **Release** section is compiled from the `android16-aptusitu-new` branch, and should work on stock MIUI/HyperOS as well as third-party AOSP-based ROMs for Android 11–16. |
| 57 | +Feedback is welcome (via Issues or Pull Requests)! Coolapk users can join the discussion in [this post](https://www.coolapk.com/feed/67088487), also can join my QQ group, or send me private feedback. |
| 58 | + |
| 59 | +Below are some of the key features: |
| 60 | +1. Support for USB serial drivers (CH340 / FTDI / PL2303 / OTI6858 / TI / SPCP8X5 / QT2 / UPD78F0730 / CP210X) |
| 61 | +2. Support for CAN bus and USB CAN adapters (e.g. CANable) |
| 62 | +3. F2FS with realtime discard enabled for improved flash TRIM behavior |
| 63 | +4. Support for EROFS |
| 64 | +5. zRAM with support for multiple compression algorithms, including LZ4, LZ4HC, lz4k_oplus, LZ4KD, and ZSTD |
| 65 | +6. Backported BPF from Linux 5.10 (Android 16 compatible) |
| 66 | +7. Touchscreen, camera, audio, GPU/DRM/MSM, and CNSS2 drivers use Xiaomi-specific implementations (sourced from UtsavBalar1231’s repository and MiCode. The AOSP version of the Display/DRM driver is LineageOS version.); also, `double_tap` node has been added to the touchscreen driver |
| 67 | +8. Fixes [the issue where the battery percentage gets stuck at 1%](https://github.com/liyafe1997/Xiaomi-fix-battery-one-percent), and supports recognizing higher-capacity replacement batteries |
| 68 | +9. Integrate [BBG(Baseband-guard)](https://github.com/vc-teahouse/Baseband-guard) |
| 69 | + |
| 70 | +--- |
| 71 | + |
| 72 | +## 注意事项 / Notes |
| 73 | +**中文:** |
| 74 | +提示:该内核的 zip 包不包含 `dtbo.img`,并且不会刷你的 dtbo 分区。推荐使用原厂的 `dtbo`,或者来自第三方系统包自带的 dtbo(如果原作者确认那好用的话)。因为该源码 build 出来的 `dtbo.img` 有些小问题,比如在锁屏界面上尝试熄屏时,屏幕会突然闪一下到最高亮度。如果你刷过其它第三方内核,或者遇到一些奇怪的问题,建议检查一下你的 `dtbo` 是否被替换过。 |
| 75 | + |
| 76 | +**注意:如果你在用 HyperOS/MIUI 请刷 MIUI 的版本,AOSP 版因为 display 驱动不同,在 HyperOS/MIUI 上屏幕无法正常显示,如果刷内核之后开机黑屏,请先检查你是不是正在用着 HyperOS/MIUI 但是刷了 AOSP 版,默认不受理关于这条的反馈。** |
| 77 | + |
| 78 | +**English:** |
| 79 | +**Note**: The kernel zip package does **not** contain `dtbo.img` and will not flash your dtbo partition. |
| 80 | +It is recommended to use the stock `dtbo`, or one from the bundled files of a third-party ROM (if the original author confirms it works well). |
| 81 | +The `dtbo.img` built from this source has some issues—for example, on the lock screen, the display may suddenly flash to max brightness when trying to turn off the screen. |
| 82 | +If you have flashed other third-party kernels or encounter strange issues, please check whether your `dtbo` has been replaced. |
| 83 | + |
| 84 | +**Warning**: If you are using HyperOS/MIUI, please flash the **MIUI version**. |
| 85 | +The AOSP version has different display drivers, which will cause the screen not to display properly on HyperOS/MIUI. |
| 86 | +If you get a black screen after flashing, check if you are on HyperOS/MIUI but flashed the AOSP version. |
| 87 | +Feedback about this specific issue will not be accepted by default. |
| 88 | + |
| 89 | +--- |
| 90 | + |
| 91 | +## 社区 / Community |
| 92 | +**中文:** |
| 93 | +欢迎加入 ApartTUSITU's QQ 交流群: [700675046](https://qm.qq.com/q/Md7nXA3Toa)。 |
| 94 | + |
| 95 | +**English:** |
| 96 | +Join ApartTUSITU's QQ Group: [700675046](https://qm.qq.com/q/Md7nXA3Toa). |
| 97 | + |
| 98 | +--- |
| 99 | + |
| 100 | +## 支持的设备 / Supported Devices |
| 101 | +| 设备代号 / Codename | 设备名称 / Device Name | |
| 102 | +|---------------------|-----------------------------------| |
| 103 | +| psyche | Xiaomi 12X | |
| 104 | +| thyme | Xiaomi 10S | |
| 105 | +| umi | Xiaomi 10 | |
| 106 | +| munch | Redmi K40S / POCO F4 | |
| 107 | +| lmi | Redmi K30 Pro / POCO F2 Pro | |
| 108 | +| cmi | Xiaomi 10 Pro | |
| 109 | +| cas | Xiaomi 10 Ultra | |
| 110 | +| apollo | Xiaomi 10T / Redmi K30S Ultra | |
| 111 | +| alioth | Xiaomi 11X / POCO F3 / Redmi K40 | |
| 112 | +| elish | Xiaomi Pad 5 Pro | |
| 113 | +| enuma | Xiaomi Pad 5 Pro 5G | |
| 114 | +| dagu | Xiaomi Pad 5 Pro 12.4 | |
| 115 | +| pipa | Xiaomi Pad 6 | |
| 116 | + |
| 117 | +--- |
| 118 | + |
| 119 | +## 构建方法 / Build Instructions |
| 120 | + |
| 121 | +### 快速构建 / Quick Build |
| 122 | +**中文:** |
| 123 | +1. fork 本仓库(别忘了点个 Star~) |
| 124 | +2. 进入 **Actions** |
| 125 | +3. 如果你要为所有支持的设备编译内核,找到 `Build All Devices Kernel (Matrix Parallel + Release)`,点击 `Run workflow` |
| 126 | +4. 如果你要为单个设备编译内核,找到 `Build Kernel`, 点击 `Run workflow` 并选择必要内容 |
| 127 | + |
| 128 | +**English:** |
| 129 | +1. Fork this repo (don’t forget to leave a Star~) |
| 130 | +2. Go to **Actions** |
| 131 | +3. If you want to compile the kernel for all supported devices, find `Build All Devices Kernel (Matrix Parallel + Release)` and click `Run workflow` |
| 132 | +4. If you want to compile the kernel for a single device, find `Build Kernel`, click `Run workflow`, and select the necessary options |
| 133 | + |
| 134 | +--- |
| 135 | + |
| 136 | +### 手动构建 / Manual Build |
| 137 | +**中文:** |
| 138 | +1. 准备基本构建环境。 |
| 139 | + 需要常用工具链 `git`、`make`、`curl`、`bison`、`flex`、`zip` 等,以及一些软件包。 |
| 140 | + - 在 Debian/Ubuntu: |
| 141 | + ``` |
| 142 | + sudo apt install build-essential git curl wget bison flex zip bc cpio libssl-dev ccache tar |
| 143 | + ``` |
| 144 | + 还需要 `python` (仅有 `python3` 不够),可安装: |
| 145 | + ``` |
| 146 | + sudo apt install python-is-python3 |
| 147 | + ``` |
| 148 | + |
| 149 | + - 在 RHEL/RPM 系统: |
| 150 | + ``` |
| 151 | + sudo yum groupinstall 'Development Tools' |
| 152 | + sudo yum install wget bc openssl-devel ccache tar |
| 153 | + ``` |
| 154 | + |
| 155 | + 注意:`build.sh` 中启用了 `ccache`,路径是 `$HOME/.cache/ccache_mikernel`。可修改或删除。 |
| 156 | + |
| 157 | +2. 下载 [ZyC-Clang v15](https://github.com/ZyCromerZ/Clang/releases/tag/15.0.7-20251111-release) 工具链: |
| 158 | + ``` |
| 159 | + mkdir zyc-clang |
| 160 | + cd zyc-clang |
| 161 | + wget https://github.com/ZyCromerZ/Clang/releases/download/15.0.7-20251111-release/Clang-15.0.7-20251111.tar.gz |
| 162 | + tar -zxvf Clang-15.0.7-20251111.tar.gz |
| 163 | + cd .. |
| 164 | + ``` |
| 165 | + |
| 166 | +3. 构建: |
| 167 | + - 不使用 KernelSU: |
| 168 | + ``` |
| 169 | + bash build.sh TARGET_DEVICE |
| 170 | + ``` |
| 171 | + - 使用 KernelSU: |
| 172 | + ``` |
| 173 | + bash build.sh TARGET_DEVICE ksu |
| 174 | + ``` |
| 175 | +
|
| 176 | + 示例: |
| 177 | + - lmi (Redmi K30 Pro/POCO F2 Pro) 不使用 KernelSU: |
| 178 | + ``` |
| 179 | + bash build.sh lmi |
| 180 | + ``` |
| 181 | + - umi (Xiaomi 10) 使用 KernelSU: |
| 182 | + ``` |
| 183 | + bash build.sh umi ksu |
| 184 | + ``` |
| 185 | +
|
| 186 | + 另外,`buildall.sh` 可一次性为所有设备构建。 |
| 187 | +
|
| 188 | +**English:** |
| 189 | +1. Prepare the build environment. |
| 190 | + You need `git`, `make`, `curl`, `bison`, `flex`, `zip`, etc. |
| 191 | + - On Debian/Ubuntu: |
| 192 | + ``` |
| 193 | + sudo apt install build-essential git curl wget bison flex zip bc cpio libssl-dev ccache tar |
| 194 | + ``` |
| 195 | + You also need `python` (not just `python3`): |
| 196 | + ``` |
| 197 | + sudo apt install python-is-python3 |
| 198 | + ``` |
| 199 | +
|
| 200 | + - On RHEL/RPM-based OS: |
| 201 | + ``` |
| 202 | + sudo yum groupinstall 'Development Tools' |
| 203 | + sudo yum install wget bc openssl-devel ccache tar |
| 204 | + ``` |
| 205 | +
|
| 206 | + Note: `ccache` is enabled in `build.sh` (`$HOME/.cache/ccache_mikernel`). You may remove/modify it. |
| 207 | +
|
| 208 | +2. Download [ZyC-Clang v15](https://github.com/ZyCromerZ/Clang/releases/tag/15.0.7-20251111-release) toolchain: |
| 209 | + ``` |
| 210 | + mkdir zyc-clang |
| 211 | + cd zyc-clang |
| 212 | + wget https://github.com/ZyCromerZ/Clang/releases/download/15.0.7-20251111-release/Clang-15.0.7-20251111.tar.gz |
| 213 | + tar -zxvf Clang-15.0.7-20251111.tar.gz |
| 214 | + cd .. |
| 215 | + ``` |
| 216 | +
|
| 217 | +3. Build: |
| 218 | + - Without KernelSU: |
| 219 | + ``` |
| 220 | + bash build.sh TARGET_DEVICE |
| 221 | + ``` |
| 222 | + - With KernelSU: |
| 223 | + ``` |
| 224 | + bash build.sh TARGET_DEVICE ksu |
| 225 | + ``` |
| 226 | +
|
| 227 | + Example: |
| 228 | + - lmi (Redmi K30 Pro/POCO F2 Pro) without KernelSU: |
| 229 | + ``` |
| 230 | + bash build.sh lmi |
| 231 | + ``` |
| 232 | + - umi (Xiaomi 10) with KernelSU: |
| 233 | + ``` |
| 234 | + bash build.sh umi ksu |
| 235 | + ``` |
| 236 | +
|
| 237 | + Additionally, `buildall.sh` can build for all supported devices at once. |
0 commit comments