https://github.com/dabao1955/kernel_build_action
a action to build kernel automatically[force push warning!]
https://github.com/dabao1955/kernel_build_action
action actions android aosp-android builder ci kernel kernelsu
Last synced: 9 months ago
JSON representation
a action to build kernel automatically[force push warning!]
- Host: GitHub
- URL: https://github.com/dabao1955/kernel_build_action
- Owner: dabao1955
- License: apache-2.0
- Created: 2023-10-08T15:42:39.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-07-27T12:30:11.000Z (10 months ago)
- Last Synced: 2025-07-27T14:41:01.530Z (10 months ago)
- Topics: action, actions, android, aosp-android, builder, ci, kernel, kernelsu
- Language: Python
- Homepage:
- Size: 3.36 MB
- Stars: 112
- Watchers: 2
- Forks: 165
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
- awesome-kernelsu - **KernelSU Builder** - CI/CD building system with GitHub Actions (🛠️ Building from Source / Building Tools & Scripts)
README
Android Kernel Build Action
Powered By GitHub Actions
A workflow to automatically build an Android kernel
[](https://github.com/dabao1955/kernel_build_action/actions/workflows/main.yml)
[](https://github.com/dabao1955/kernel_build_action/issues)
[](https://github.com/dabao1955/kernel_build_action/stargazers)
[](https://github.com/dabao1955/kernel_build_action/forks)
[](https://github.com/dabao1955/kernel_build_action/blob/main/LICENSE)
[](https://github.com/dabao1955/kernel_build_action/releases/latest)
[](https://github.com/dabao1955/kernel_build_action/commits/main/)
> [!IMPORTANT]
> This workflow is universal. You need to have a certain understanding in writing github workflows and a little knowledge of the Android kernel to use this.
## Security Policy
See [Security.md](./SECURITY.md) for more details.
## How to use?
- First, you need to determine the kernel source code and configuration files.
- Find your kernel source repository and configure the workflow file according to the following example and README.md:
```yml
name: CI
on:
workflow_dispatch:
jobs:
build-kernel:
name: Build Kernel
runs-on: ubuntu-22.04
steps:
- name: Build
uses: dabao1955/kernel_build_action@main
with:
kernel-url: https://github.com/AcmeUI-Devices/android_kernel_xiaomi_cas
kernel-branch: taffy
config: cas_defconfig
arch: arm64
aosp-gcc: true
aosp-clang: true
android-version: 12
aosp-clang-version: r383902
```
Or use the [preset workflow file](https://github.com/dabao1955/kernel_build_action/blob/main/.github/workflows/build.yml) to modify it.
> [!NOTE]
> You do not need to fork this repository.
>
> If you just want to compile the kernel, please do not submit PR after modification!
- Finally, run the workflow you just wrote.
## Inputs
> [!WARNING]
>
> enable lxc or nethunter input options may cause kernel compilation failed!
| input | required | description | example value |
|---------------------|----------|-------------|---------|
| kernel-url | true | URL of Android kernel source code for your phone | https://github.com/username/project |
| kernel-dir | false | The directory name of the Android kernel source code. This option may be used for OPLUS Kernel source code. | kernel |
| depth | false | | 1 |
| vendor | false | | false |
| vendor-url | false | url of additional source code for the Android kernel source code. This option may be used for OPLUS source code. | https://github.com/username/project|
| vendor-dir | false | | vendor |
| kernel-branch | false | The branch of the source code that needs to be cloned, defaults branch to git clone is main | main |
| vendor-branch | false | The branch of the vendor source code that needs to be cloned, defaults branch to git clone is main | main |
| config | true | Compile the selected configuration file for the Android kernel | defconfig |
| arch | true | The architecture of your mobile phone SOC is arm64 by default | arm64 |
| android-version | true | The Android version required when downloading aosp-clang. If you want to use the latest aosp-clang or you do not use aosp-clang to compile the kernel, please ignore this option | 12 |
| ksu | false | Enable KernelSU | true |
| ksu-version | false | KernelSU version | v0.9.5 |
| ksu-lkm(may not build successfully for non-GKI devices) | false | Build KernelSU as a linux kernel module | true |
| ksu-other | false | | false |
| ksu-url | false | Use 3rd KernelSU | https://github.com/xxx/KernelSU/ |
| rekernel | false | Enable Re-Kernel support | true |
| disable-lto | false | Disable [Link Time Optimization](https://llvm.org/docs/LinkTimeOptimization.html) | false |
| lxc | false | Enable LXC and docker to config | false |
| lxc-patch | false | Add patch avoid not booting after enable lxc | false |
| nethunter | false | Enable Kali nethunter | false |
| nethunter-patch | false | | false |
| kvm | false | | false |
| ccache | false | Enable ccache(Only valid when compiled with clang) | false |
| aosp-gcc | false | Use aosp-gcc to compile the kernel or assist in compiling the kernel (when aosp-clang is enabled) | false |
| other-gcc32-url | false | Please fill in the download link of other gcc32 in this option. Supports .xz, .zip, .tar and .git formats | https://github.com/username/gcc |
| other-gcc32-branch | false | | main |
| other-gcc64-url | false | Please fill in the download link of other gcc64 in this option. Supports .xz, .zip, .tar and .git formats | https://github.com/username/gcc |
| other-gcc64-branch | false | | main |
| aosp-clang | false | Compile the kernel using aosp-clang | false |
| aosp-clang-version | false | please search for them according to your own needs at [official website](https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86) and choose the appropriate clang according to the Android system version instead of blindly choosing `r383902` | r383902 |
| other-clang-url | false | Please fill in the download link of other clang in this option. Supports .xz, .zip, .tar and .git formats | https://github.com/kdrag0n/proton-clang |
| other-clang-branch | false | | 10.0|
| anykernel3 | false | Package the compiled kernel using AnyKernel3. If this option is disabled, You need to fill `bootimg-url`. | false |
| anykernel3-url | false | 3rdparty AnyKernel3 url | https://github.com/username/AnyKernel3 |
| release | false | After the kernel compilation is completed, it will be automatically published to the releases page | true |
| access-token | false | Please fill it if you want to release kernel | ghp_xxxxxx |
| bootimg-url | false | A URL that can download the local boot.img | https://127.0.0.1/boot.img |
| extra-cmd | false | Compile the kernel with extra options, such as LD=ld.lld | AS=llvm-as |
## FAQ
> [!CAUTION]
> Please Read this first if you have some questions!
### How to use 3rd clang?
You should disable aosp-clang and android-ndk options to use it.
### Why KernelSU version built with this action is still v0.9.5?
See [KernelSU 's release note](https://github.com/tiann/KernelSU/releases/tag/v1.0.0) for more details.
### How to submit issue about features requests?
In principle, it only accepts Bug Reports and does not accept external Feature Requests; if you want new features, you are welcome to submit a Pull Request. We will still develop new features that we think are useful.
### Why the workflow exits with a code with an error value of some number?
- If you get an error while downloading the toolchain or pulling the source code, please check whether your option or source code address is legitimate.
- If you encounter problems during compilation, consider replacing the source code or replacing the compiler.
- If the action has a typo problem, PR welcome!
### Build failed while using third-party GCC ?
Try add LLVM=1 option with clang.
## Credits
- [KernelSU](https://github.com/tiann/KernelSU)
- [KernelSU_Action](https://github.com/XiaoleGun/KernelSU_Action)
- [slimhub_actions](https://github.com/rokibhasansagar/slimhub_actions)