import{_ as s,o as e,c as a,O as l}from"./chunks/framework.43781440.js";const y=JSON.parse('{"title":"How to build KernelSU?","description":"","frontmatter":{},"headers":[],"relativePath":"guide/how-to-build.md","filePath":"guide/how-to-build.md"}'),n={name:"guide/how-to-build.md"},o=l(`
First, you should read the Android Official docs for kernel build:
WARNING
This page is for GKI devices, if you use an old kernel, please refer how to integrate KernelSU for old kernel
repo init -u https://android.googlesource.com/kernel/manifest
mv <kernel_manifest.xml> .repo/manifests
repo init -m manifest.xml
repo syncThe <kernel_manifest.xml> is a manifest file which can determine a build uniquely, you can use the manifest to do a re-preducable build. You should download the manifest file from Google GKI release builds
Please check the official docs first.
For example, we need to build aarch64 kernel image:
LTO=thin BUILD_CONFIG=common/build.config.gki.aarch64 build/build.shDon't forget to add the LTO=thin flag, otherwise the build may fail if your computer's memory is less then 24Gb.
Starting from Android 13, the kernel is built by bazel:
tools/bazel build --config=fast //common:kernel_aarch64_distIf you can build the kernel successfully, then build KernelSU is so easy, Select any one run in Kernel source root dir:
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s maincurl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s v0.5.2And then rebuild the kernel and you will get a kernel image with KernelSU!
`,24),t=[o];function r(p,c,i,d,u,h){return e(),a("div",null,t)}const D=s(n,[["render",r]]);export{y as __pageData,D as default};