Read this in other languages: English, 中文.
kade is an Android kernel driver automation framework built on top of lyenv. It provides a configuration-driven, reproducible workflow for building GKI and non-GKI kernels locally and in CI (GitHub Actions).
This repository is designed to work with:
- lyenv: https://github.com/systemnb/lyenv
- kade plugin https://github.com/systemnb/lyenv-plugin-center
- ✅ GKI and non-GKI kernel support
- ✅ Single configuration file (
kadeflow.yaml) - ✅ GitHub Actions ready
- ✅ External or in-tree driver integration
- ✅ ABI upstream patching and ABI symbol export
- ✅ Artifact export (modules, images, dist outputs)
- ✅ Optional post-build commands (compile_commands, image unpack, etc.)
.
├── code/ # Driver source directory (external driver)
│ ├── Makefile
│ ├── mydriver.c
│ └── Kconfig # optional
│
├── abi.symbols # ABI symbols (optional, recommended)
├── kadeflow.yaml # Main automation configuration
│
├── .github/
│ └── workflows/
│ └── kade.yml # GitHub Actions workflow
│
├── README.md
└── README_zh.md
When using an external driver, kade treats one directory in the repository as the driver source directory.
code/
Configured via:
gki:
driver:
in_tree: false
external_src_dir: "${GITHUB_WORKSPACE}/code"Only this directory will be copied into the kernel source tree. Other repository files are ignored.
The directory name is not hardcoded. Any path may be used.
ABI symbols should be version-controlled and reviewed like source code.
Create a file such as:
abi.symbols
Example:
# ABI symbols required by this driver
register_kprobe
unregister_kprobe
kallsyms_lookup_name
Reference it in kadeflow.yaml:
abi:
upstream_patch: true
symbols_file: "${GITHUB_WORKSPACE}/abi.symbols"kade will automatically execute:
kade abi_upstream
kade abi --file abi.symbolsbefore building.
kadeflow.yaml is the single source of truth for CI and automation.
All kade configuration is derived from this file.
kade:
config_overrides:
kernel:
flavor: "gki"
gki:
android_version: 13
kernel_version: "5.15"
target_arch: "aarch64"
driver:
project_name: "mydriver"
in_tree: false
external_src_dir: "${GITHUB_WORKSPACE}/code"
module_name: "mydriver.ko"
overwrite: trueEnable non-GKI mode:
kernel:
flavor: "non_gki"non_gki:
source:
type: "repo"
repo_url: "https://github.com/vendor/kernel.git"
branch: "main"non_gki:
source:
type: "local"
local_path: "/absolute/path/to/kernel"non_gki:
source:
type: "zip"
zip_path: "${GITHUB_WORKSPACE}/kernel.zip"
zip_strip_root: truenon_gki:
build:
mode: "script"
script: "build.sh"
args: []
artifacts_dir: "out"non_gki:
build:
mode: "make"
make:
defconfig: "vendor_defconfig"
kernel_series: "4.9_plus"
toolchain_path_prefix: "/root/toolchain/clang/bin:/root/toolchain/gcc32/bin:/root/toolchain/gcc64/bin"non-GKI kernels do not use Bazel.
kade runs:
python3 gen_compile_commands.py -d <out_dir>Override the directory if needed:
compile_commands:
non_gki_out_dir: "out/android13-5.15/common"By default, the GitHub Action will:
- Install lyenv
- Create and activate a lyenv project
- Install the kade plugin
- Apply configuration from
kadeflow.yaml - Execute:
kade preparekade depskade synckade abi_upstreamkade abi(if symbols provided)kade buildkade export
- Upload exported artifacts
After running:
eval "$(lyenv activate)"all installed plugins (including kade) are available globally.
All paths in kadeflow.yaml support environment variables such as:
${GITHUB_WORKSPACE}${LYENV_HOME}
They are expanded automatically before kade runs.
- Files under the
codedirectory are GPL-2.0-only. - All other parts except the
codedirectory are Apache License 2.0.
Defined by the repository owner.
- lyenv: https://github.com/systemnb/lyenv
- lyenv-plugin-center: https://github.com/systemnb/lyenv-plugin-center