A workflow to automatically build an Android kernel
See Security.md for more details.
name: CI
on:
workflow_dispatch:
permissions:
contents: write
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
anykernel3: true
release: true
access-token: ${{ secrets.GITHUB_TOKEN }}
You can also use a local or relative path for the kernel source instead of cloning from a remote URL. This is useful when the kernel source is already checked out in the workflow.
name: CI
on:
workflow_dispatch:
permissions:
contents: write
jobs:
build-kernel:
name: Build Kernel
runs-on: ubuntu-22.04
steps:
- name: Checkout kernel source
uses: actions/checkout@v4
with:
repository: username/kernel_repo
ref: main
path: kernel/source
- name: Build
uses: dabao1955/kernel_build_action@main
with:
kernel-url: ./kernel/source/
config: defconfig
arch: arm64
aosp-clang: true
anykernel3: true
[!NOTE] - Local paths must end with
/(except.for current directory) - Supported formats:.,./,./kernel/,../kernel/,kernel/source/- The directory must be a valid kernel source containing:Makefile(with VERSION),Kconfig, andarch/directory - When using local path,kernel-branch,depth, andkernel-diroptions are ignored
Or use the preset workflow file 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!
| input | required | description | example value |
|---|---|---|---|
| kernel-url | true | URL of the Android kernel source code, or local/relative path. Local paths must end with / (except .). Supports: ., ./, ./kernel/, ../kernel/, kernel/source/ |
https://github.com/username/project |
| kernel-dir | false | Directory name for kernel source. Useful for OnePlus kernel sources | kernel |
| depth | false | Use git clone depth to save time and storage space | 1 |
| vendor | false | Enable vendor kernel source code | false |
| vendor-url | false | URL of vendor kernel source code (used on OnePlus kernel) | https://github.com/username/project |
| vendor-dir | false | Directory name for vendor kernel source | vendor |
| kernel-branch | false | Branch name of kernel source code (default = main) | main |
| vendor-branch | false | Branch name of vendor kernel source code (default = main) | main |
| config | true | Specific kernel config file to compile (default = defconfig) | defconfig |
| arch | true | CPU architecture (default = arm64) | arm64 |
| android-version | true | Android version for AOSP toolchain (Ignore if you want to use latest AOSP clang or use other clang) | 12 |
| ksu | false | Integrate KernelSU on kernel build | true |
| ksu-version | false | KernelSU version (default = v0.9.5) | v0.9.5 |
| ksu-lkm | false | Build KernelSU as kernel module (may fail on non-GKI devices) | true |
| ksu-other | false | Use third-party KernelSU fork | false |
| ksu-url | false | URL of third-party KernelSU fork (if you enable ksu-other flag) |
https://github.com/username/KernelSU/ |
| rekernel | false | Enable Re-Kernel support | true |
| disable-lto | false | Disable Link Time Optimization support | false |
| lxc | false | Enable LXC/Docker support | false |
| lxc-patch | false | Apply patch to avoid boot issues with LXC | false |
| nethunter | false | Enable Kali NetHunter support | false |
| nethunter-patch | false | Apply patch for Kali NetHunter support | false |
| kvm | false | Enable KVM (Kernel Virtual Machine) support | false |
| bbg | false | Enable BaseBandGuard support | false |
| ccache | false | Enable ccache (clang only) to speed up kernel compilation | false |
| aosp-gcc | false | Use AOSP GCC toolchain to compile the kernel (Enable when using AOSP clang toolchain) | false |
| other-gcc32-url | false | URL of custom GCC arm32 toolchain (Supports .tar.gz, .tar.xz, .tar.bz2, .gz, .xz, .bz2, .zip and .git formats) | https://github.com/username/gcc |
| other-gcc32-branch | false | Branch name of GCC arm32 toolchain | main |
| other-gcc64-url | false | URL of custom GCC arm64 toolchain (Supports .tar.gz, .tar.xz, .tar.bz2, .gz, .xz, .bz2, .zip and .git formats) | https://github.com/username/gcc |
| other-gcc64-branch | false | Branch name of GCC arm64 toolchain | main |
| aosp-clang | false | Use AOSP clang toolchain to compile the kernel | false |
| aosp-clang-version | false | AOSP clang version. See all AOSP clang versions. (default = r383902) | r383902 |
| other-clang-url | false | URL of custom clang toolchain (Supports .tar.gz, .tar.xz, .tar.bz2, .gz, .xz, .bz2, .zip and .git formats) | https://github.com/username/clang |
| other-clang-branch | false | Branch name of clang toolchain | main |
| anykernel3 | false | Use AnyKernel3 to package the compiled kernel. (if false, must provide bootimg-url) | false |
| anykernel3-url | false | URL for third-party AnyKernel3 | https://github.com/username/AnyKernel3 |
| release | false | Auto-publish kernel release after build | true |
| access-token | false | GitHub access token (needed for auto release) | ghp_xxxxxx |
| bootimg-url | false | URL to download local boot.img (required if anykernel3 = false) | https://127.0.0.1/boot.img |
| extra-make-args | false | Extra arguments for make, as a JSON array of strings support spaces and special characters |
["LOCALVERSION= (CI)", "AS=llvm-as"] |
[!CAUTION] Please Read this first if you have some questions!
You should disable aosp-clang and android-ndk options to use it.
See KernelSU 's release note for more details.
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.
Try add LLVM=1 option with clang.
$ claude mcp add kernel_build_action \
-- python -m otcore.mcp_server <graph>