liyafe1997 / kernel_xiaomi_sm8250_mod

Xiaomi sm8250(865/870) devices kernel
Other
27 stars 11 forks source link
android linux-kernel xiaomi

About this repo

English

This repo (android14-lineage21-mod branch) is based on Lineage OS 21 xiaomi sm8250 kernel source.

Originally this repo (android12-stable-mod or android14-stable-mod branch) is fork from UtsavBalar1231's repo, but the android14-stable branch has freeze problem when the device sleep for a while or wake up. So now I switched to lineage21 codebase. The MIUI features code and some parts of the drivers is still copied from UtsavBalar1231's branch.

So still Thanks to @UtsavBalar1231!

The main purpose of maintaining and building this kernel is to fix this battery stuck at 1% problem, and provide KernelSU integrated pre-built image(flashable anykernel3 zip). Also provides a more intuitive and easy-to-use build script and build guide that allow you to try to build by yourself.

(The devices affected by the "1% battery bug" are: alioth, apollo, lmi, thyme, umi, pipa. Because they all use the PM8150, aka Qualcomm fuel gauge GEN4. For the other devices are not affected by that bug, you can use this kernel for KernelSU purpose, as a replacement of the orginal stock kernel. Also, as the people tested, this kernel NoKernelSU version is good for applying APatch).

The pre-built kernel image/zip is built on the android14-lineage21-mod branch. It should works on both stock MIUI and third-party AOSP based Android 11-14 ROMs. You are welcomed to give feedback (Issues/Pull Requests)!

Note: The zip does not include the dtbo.img and it will not replace your dtbo partition. It is recommanded to keep the stock dtbo or the dtbo from your third-party rom (If the builder comfirmed it works well). Since there are some problems with the dtbo.img which built from this source, one of them is the screen will suddently goes to the highest brightness when shut try to shut off the screen in the lock screen. If you had flashed any other third-party kernels, and you got some weird problem, you should keep an eye to check your dtbo has been replaced or not.

Supported devices: Code Name Device Name
psyche Xiaomi Mi 12X
thyme Xiaomi Mi 10S
umi Xiaomi Mi 10
munch Poco F4 / Redmi K40S
lmi Redmi K30 Pro
cmi Xiaomi Mi 10 Pro
cas Xiaomi Mi 10 Ultra
apollo Xiaomi Mi 10T / Redmi K30S Ultra
alioth Xiaomi Mi 11X / POCO F3 / Redmi K40
elish Xiaomi Pad 5 Pro
enuma Xiaomi Pad 5 Pro 5G
dagu Xiaomi Pad 5 Pro 12.4
pipa Xiaomi Pad 6

中文

该repo (android14-lineage21-mod 分支)主要基于Lineage OS 21 xiaomi sm8250 kernel source

原来这个repo(即android12-stable-mod/android14-stable-mod分支)是fork自UtsavBalar1231的仓库,但切到android14-stable分支的时候,发现那套代码有睡死问题(202408的几个release),所以现在切到了基于lineage21的代码来搞。MIUI特性的代码以及部分的设备驱动抠自UtsavBalar1231的仓库。

所以仍然感谢 @UtsavBalar1231

维护和编译这个内核的主要目的是想修复电量卡在1%的问题,以及提供带KernelSU的预编译好的内核。以及再提供一个更直观和易用的编译脚本和README,方便大家自己折腾和修改,编译自己的内核!

(其中受“1%电量bug”影响的设备有:alioth, apollo, lmi, thyme, umi, pipa,因为它们都用了PM8150即高通的GEN4电量计。其它不受此bug影响的设备大可把这个内核当成个带KernelSU的官核平替,如果你想找一个带KernelSU的内核的话。并且据大家测试,该内核不带KernelSU版本可以应用APatch

Release里的编译好的内核成品由android14-lineage21-mod分支编译,应当能在原版MIUI和第三方的基于AOSP的各种Android11-14的ROM上使用。欢迎大家尝试并反馈(提Issue或Pull Requests)!酷友们到酷安的这个帖子讨论或反馈,也可以给我私信反馈!

注意:该内核的zip包不包含dtbo.img,并且不会刷你的dtbo分区。推荐使用原厂的dtbo,或者来自第三方系统包自带的dtbo(如果原作者确认那好用的话)。因为该源码build出来的dtbo.img有些小问题,比如在锁屏界面上尝试熄屏时,屏幕会突然闪一下到最高亮度。如果你刷过其它第三方内核,或者遇到一些奇怪的问题,建议检查一下你的dtbo是否被替换过。

度盘备用下载链接:https://pan.baidu.com/share/init?surl=11ocz7ggZ79gzRfWvsdbJA&pwd=ty58 (建议优先从Github Release下载)

欢迎加入内测QQ群: 459094061

支持的设备: 设备代号 设备名称
psyche 小米12X
thyme 小米10S
umi 小米10
munch 红米K40S
lmi 红米K30 Pro
cmi 小米10 Pro
cas 小米10 Ultra
apollo 小米10T / 红米K30S Ultra
alioth 小米11X / POCO F3 / 红米K40
elish 小米平板5 Pro
enuma 小米平板5 Pro 5G
dagu 小米平板5 Pro 12.4
pipa 小米平板6

How to build

  1. Prepair the basic build environment.

    You have to have the basic common toolchains, such as git, make, curl, bison, flex, zip, etc, and some other packages. In Debian/Ubuntu, you can

    sudo apt install build-essential git curl wget bison flex zip bc cpio libssl-dev ccache

    And also, you have to have python (only python3 is not enough). you can install the apt package python-is-python3.

    In RHEL/RPM based OS, you can

    sudo yum groupinstall 'Development Tools'
    sudo yum install wget bc openssl-devel ccache

    Notice: ccache is enabled in build.sh for speed up the compiling. CCACHE_DIR has been set as $HOME/.cache/ccache_mikernel in build.sh. If you don't like you can remove or modify it.

  2. Download [proton-clang] compiler toolchain

    You have to have aarch64-linux-gnu, arm-linux-gnueabi, clang. Proton Clang is a good prebuilt clang cross compiler toolchain.

    The default toolchain path is $HOME/proton-clang/proton-clang-20210522/bin which is set in build.sh. If you are using another location please change TOOLCHAIN_PATH in build.sh.

    mkdir proton-clang
    cd proton-clang
    wget https://github.com/kdrag0n/proton-clang/archive/refs/tags/20210522.zip
    unzip 20210522.zip
    cd ..
  3. Build

    Build without KernelSU:

    bash build.sh TARGET_DEVICE

    Build with KernelSU:

    bash build.sh TARGET_DEVICE ksu

    For example, build for lmi (Redmi K30 Pro/POCO F2 Pro) without KernelSU:

    bash build.sh lmi

    For example, build for umi (Mi 10) with KernelSU:

    bash build.sh umi ksu

    And also, here is a buildall.sh can build for all supported models at once.