A custom kernel for Redmi 9 (lancelot) with KernelSU and SukiSU Ultra support, based on Proton kernel.
- KernelSU and SukiSU Ultra for root
- SUSFS and OverlayFS support
- Built with custom Clang for performance
- Automated releases via GitHub Actions
This kernel for the Redmi 9 (lancelot) supports KernelSU and SukiSU Ultra. Flash it using a custom recovery (e.g., TWRP, OrangeFox) or Fastboot. Download the latest release from the Releases page.
- Unlocked Bootloader: Ensure your device’s bootloader is unlocked.Tools
- Custom Recovery: Install TWRP or another custom recovery for recovery flashing (not required for Fastboot).
- Backup: Back up your data and current kernel/boot partition to avoid issues.
- Downloads: Get
AnyKernel3-KernelSU_10342-lancelot-YYYYMMDDHHMM.zip
for recovery orImage.gz-dtb-KernelSU_10342-lancelot-YYYYMMDDHHMM
for Fastboot from the latest release.
- Download the ZIP:
- Download the
AnyKernel3-KernelSU_10342-lancelot-YYYYMMDDHHMM.zip
file from the Releases page.
- Download the
- Boot into Recovery:
- Power off your device.
- Boot into TWRP or your custom recovery (usually by holding Volume Up + Power).
- Flash the ZIP:
- In TWRP, select Install and navigate to the downloaded
AnyKernel3.zip
file. - Swipe to flash the ZIP.
- (Optional) Clear cache/dalvik if prompted or required.
- In TWRP, select Install and navigate to the downloaded
- Reboot:
- Select Reboot > System in TWRP.
- Your device will boot with the new kernel.
- Verify:
- Use a root checker or KernelSU app to confirm the kernel is installed and root is working.
- Download the Kernel Image:
- Download the
Image.gz-dtb-KernelSU_10342-lancelot-YYYYMMDDHHMM
file from the Releases page.
- Download the
- Set Up Fastboot:
- Install ADB and Fastboot on your computer (download here).
- Enable USB debugging on your device and connect it to your computer.
- Boot into Fastboot Mode:
- Power off your device.
- Boot into Fastboot mode (usually by holding Volume Down + Power).
- Flash the Kernel:
- Open a terminal/command prompt in the folder containing the
Image.gz-dtb
file. - Run the following command:
fastboot flash boot Image.gz-dtb-KernelSU_10342-lancelot-YYYYMMDDHHMM
- Wait for the flash to complete.
- Open a terminal/command prompt in the folder containing the
- Reboot:
- Run:
fastboot reboot
- Your device will boot with the new kernel.
- Run:
- Verify:
- Use a root checker or KernelSU app to confirm the kernel is installed and root is working.
- Custom Recovery: Flashing via TWRP is easier and supports AnyKernel3’s automatic kernel installation. Use this method unless you lack a custom recovery.
- Fastboot: Flashing via Fastboot directly replaces the boot image. Ensure the
Image.gz-dtb
is compatible with your ROM. - Issues: If the device fails to boot, restore your backup or reflash the stock boot image. Join our Telegram group/community for support (https://t.me/Jbub5_Discussion).
- Root: After flashing, install the KernelSU app to manage root access.
- Custom Recovery Method: Uses
AnyKernel3.zip
, which is designed for recovery flashing. AnyKernel3 automatically extracts and installs the kernel (Image.gz-dtb
) into the boot partition, making it user-friendly. - Fastboot Method: Uses the raw
Image.gz-dtb
file to directly flash the boot partition. This is useful if no custom recovery is installed but requires a computer and Fastboot setup. - Artifacts: The instructions reference the artifact names generated by your workflow (e.g.,
AnyKernel3-KernelSU_10342-lancelot-YYYYMMDDHHMM.zip
), based on your environment variables (UPLOADNAME
,DEVICE
,BUILD_TIME
). - Safety: Emphasizes backups and verification to prevent bootloops or data loss.
- Support: https://t.me/Jbub5_Discussion.
Click to open
Note: Unselect
Copy the kernel-tree_lancelot branch only
if you are building for merlin.
Note: Reload this page if the yellow circle does not appear.
Click to open
All options are located in config.env
Change this to your kernel repository link.
For example: https://github.com/Jbub5/android_kernel_xiaomi_mt6768
Change this to your kernel branch.
For example: kernel-tree
Change this to your kernel defconfig name.
For example: lancelot_defconfig
Change this to the kernel binary that needs to be flashed, generally consistent with BOARD_KERNEL_IMAGE_NAME
in your AOSP device tree.
For example: Image.gz-dtb
Common names include Image
, Image.gz
.
For example: arm64
Enable KernelSU support.
KernelSU 1.0 no longer supports non-GKI kernels. The last supported version is v0.9.5, please make sure to use the correct branch.
Select the branch or tag of KernelSU:
main branch (development version):KERNELSU_TAG=main
- Latest TAG (stable version):
KERNELSU_TAG=v0.9.5
- Specify the TAG (such as
v0.5.2
):KERNELSU_TAG=v0.5.2
Customize the size and hash values of the KernelSU manager signature, if you don't need to customize the manager then please leave them empty or fill in the official default values:
KSU_EXPECTED_SIZE=0x033b
KSU_EXPECTED_HASH=c371061b19d8c7d7d6133c6a9bafe198fa944e50c1b31c9d8daa8d7f1fc2d2d6
You can type ksud debug get-sign <apk_path>
to get the size and hash of the apk signature.
This will revert the commit that removed non-GKI support, making it possible to continue using official KernelSU up to version 1.0.1. Using versions newer than 1.0.1 is not possible due to the removal of non-GKI support from the manager.
This is used in the installation of KernelSU via kprobe. If kprobe is broken in your kernel or you don't know what it is then don't touch this config.
See details: https://kernelsu.org/guide/how-to-integrate-for-non-gki.html#integrate-with-kprobe
If kprobe does not work in your kernel, then try enabling this option, this will automatically patch kernel source code to support KernelSU.
See details: https://kernelsu.org/guide/how-to-integrate-for-non-gki.html#manually-modify-the-kernel-source
If enabled will automatically put the configs needed for OverlayFS into your defconfig.
If enabled will automatically put the configs needed for APatch into your defconfig.
This option provides fix for bmax121/APatch#400.
There is no official support for older Android and MIUI, and bug reports will not be accepted on them.
This option provides support for MIUI 12.5 and custom ROMs based on Android 11 through 12, but breaks support for Android 13 and above.
You can use a non-official clang such as proton-clang.
Fill in a link that includes
.git
if it is a git repository.
Git repository or direct chain of compressed zip files is supported.
For example: main
Due to #23, we provide an option to customize the Google main branch. The main ones include:
Clang Branch |
---|
master |
master-kernel-build-2021 |
master-kernel-build-2022 |
Or other branches, please search for them according to your own needs at https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86.
Enter the Clang version to use.
Clang Version | Corresponding Android Version | AOSP-Clang Version |
---|---|---|
12.0.5 | Android S | r416183b |
14.0.6 | Android T | r450784d |
14.0.7 | r450784e | |
15.0.1 | r458507 | |
17.0.1 | r487747b | |
17.0.2 | Android U | r487747c |
Generally, Clang12 can compile most of the 4.14 and above kernels. My MI 6X 4.19 uses r450784d.
Enables usage of standart GCC toolchain.
Enable GCC 64C cross-compiler.
Enable GCC 32C cross-compiler.
Some kernels require additional compilation commands to compile correctly. Generally, no other commands are needed, so please search for information about your kernel. Please separate the command and the command with a space.
For example: LLVM=1 LLVM_IAS=1
Can use custom AnyKernel3.
If it is a git repository, please fill in the link containing
.git
Supports direct links to git repositories or zip compressed packages.
Customize the warehouse branch of AnyKernel3.
Upload DTBO. Some devices require it.
Added from previous workflows, view historical commits
Build boot.img, and you need to provide a Source boot image
.
As the name suggests, it provides a boot image source system that can boot normally and requires a direct chain, preferably from the same kernel source and AOSP device tree as your current system. Ramdisk contains the partition table and init, without which the compiled image will not boot up properly.
For example: https://raw.githubusercontent.com/xiaoleGun/KernelSU_action/main/boot/boot-wayne-from-Miku-UI-latest.img
LTO is used to optimize the kernel but sometimes causes errors.
Sometimes even a harmless warning breaks the build.
Switching to other drivers fixed spontaneous reboots when turning on Wi-Fi on some devices, but resulted in decreased network speeds. This option will revert to the previous drivers and thus fix the network speed.
To clean unnecessary packages and free up more disk space. If you need these packages, please disable this option.
Enable the cache to make the second kernel compile faster (or slower).
- Proton kernel: -Jbub5
- KernelSU: KernelSU
- kernelSU Next KernelSU-Next
- AnyKernel3: Jbub5