A customizable GitHub Actions workflow for building Linux Kernel 5.15 GKI with KernelSU (KSU) and SUSFS support
🚨 This workflow is designed for building kernels for specific Android devices!
To use this workflow for a different device, you must update the following:
Component | What to Change |
---|---|
🔗 Kernel Source | Update kernelSourceURL and kernelBranch to match your device's kernel source |
🔧 Defconfig | Set kernelDevice to your device's defconfig (e.g., sm8450_defconfig ) |
📝 Patches | Modify or add device-specific patches for compatibility |
🔐 KSU/SUSFS | Ensure KernelSU and SUSFS patches align with your kernel and Android version |
📦 AnyKernel3 | Use a device-specific AnyKernel3 template for flashing |
⚙️ Build Configs | Adjust compiler flags, LTO mode, and optimizations for your hardware |
- ❌ Build failures
- ❌ Incompatible kernel images
- ❌ Device bootloops
- ❌ Potential hardware damage
💡 Always test thoroughly on your device before widespread use!
A GitHub Actions workflow to build a Linux Kernel 5.15 for Android devices, with optional support for KernelSU (KSU) and SUSFS for advanced root functionality. It produces flashable ZIP files using AnyKernel3.
Feature | Description |
---|---|
🐧 Linux Kernel 5.15 | Stable kernel optimized for Android 13 |
🤖 Automated Builds | GitHub Actions automates kernel compilation |
🔐 KSU + SUSFS | Optional KernelSU with SUSFS for root and advanced filesystem features |
⚙️ LTO Support | Choose between Thin or Full LTO for performance optimization |
📦 Flashable ZIP | Ready-to-flash AnyKernel3 ZIPs for recovery installation |
📱 Telegram Notifications | Optional Telegram integration for build status updates |
- Fork this repository by clicking the "Fork" button, or clone it to your own repository.
- Ensure you have a GitHub account with Actions enabled.
- Go to the Actions tab in your repository.
- Select the "Test Build" workflow.
- Click "Run workflow" and provide the following inputs:
Input | Description | Default Value |
---|---|---|
kernelSourceURL |
URL of the kernel source repository | https://github.com/topnotchfreaks/kernel_msm-5.15 |
kernelBranch |
Kernel source branch | codelinaro |
kernelDevice |
Device defconfig (e.g., gki_defconfig ) |
gki |
localVersion |
Custom kernel version suffix (e.g., -mybuild ) |
"" (empty) |
buildKSU |
Build KSU variant? | true (builds both KSU and non-KSU variants) |
ltoMode |
LTO optimization mode | Thin (options: Thin , Full ) |
- Click "Run workflow" to start the build process.
- The workflow builds:
- A non-KSU kernel variant.
- A KSU variant (if
buildKSU
istrue
).
- Build time is typically 20-40 minutes, depending on the LTO mode and hardware.
- After the build completes, go to the workflow run summary in the Actions tab.
- Download the following artifacts:
- Individual kernel images (
kernel-noksu
andkernel-ksu
). - A flashable ZIP file (
Kernel-5.15_YYYY-MM-DD.zip
).
- Individual kernel images (
- Flash the ZIP file via a custom recovery (e.g., TWRP or OrangeFox).
Receive build status notifications and artifacts directly on Telegram.
- Create a Telegram Bot:
- Message @BotFather on Telegram.
- Follow the instructions to create a bot and obtain a
TELEGRAM_BOT_TOKEN
.
- Get Your Chat ID:
- Message your bot or a service like @GetIDsBot to get your
TELEGRAM_USER_ID
.
- Message your bot or a service like @GetIDsBot to get your
- Add Secrets to GitHub:
- Go to your repository → Settings → Secrets and variables → Actions.
- Add two secrets:
TELEGRAM_BOT_TOKEN
: Your bot token from BotFather.TELEGRAM_USER_ID
: Your Telegram chat ID.
- Enable Notifications:
- The workflow will automatically send build results (success or failure) to your Telegram chat.
- Setup Workspace: Installs dependencies (Clang, LLVM, etc.) and sets up the build environment.
- Clone Kernel Source: Clones the specified kernel source and branch.
- Download Clang: Fetches the latest Clang toolchain from
topnotchfreaks/clang
. - Configure Environment: Sets up swap space based on LTO mode (
8G
for Thin,20G
for Full). - Apply Patches:
- LineageOS disguise patch.
- Clang 21+ compatibility patch (if needed).
- KernelSU and SUSFS patches (for KSU variant).
- Build Kernel:
- Configures the kernel with the specified defconfig.
- Applies LTO mode (
Thin
orFull
) and customlocalVersion
. - Compiles the kernel using Clang and LLVM.
- Package Output:
- Creates a flashable ZIP using AnyKernel3.
- Uploads kernel images and the ZIP as artifacts.
- Telegram Notification: Sends build results to Telegram (if configured).
- Kernel Version: 5.15
- Android Version: 13
- Compiler: Clang (fetched from
topnotchfreaks/clang
) - LTO Modes: Thin (faster builds) or Full (better optimization)
- Variants: Non-KSU and KSU (with SUSFS support)
Special thanks to these amazing developers:
- @PhamtomK12 – Original Kernel Builder Owner
- @ssocozy - Project Contributor
- @NVG-064 - Project Contributor
- @ShirkNeko – SUSFS Integration & susfs4ksu patches
We welcome contributions to improve this workflow! Here's how you can help:
- Report Issues: Open an issue for bugs or build failures.
- Suggest Features: Propose new features or optimizations.
- Submit Pull Requests: Contribute code improvements or new patches.
- Add Device Support: Help adapt the workflow for other devices.
🚨 For Advanced Users Only
- Flashing custom kernels may void your device warranty.
- Always backup your data before flashing.
- Test thoroughly on your device to avoid bootloops or hardware issues.
- The contributors are not responsible for any device damage.
- Issues: Open an issue on this repository.
- Community: Join relevant Telegram groups or X communities for kernel development support.
Happy building! 🎉