Movatterモバイル変換


[0]ホーム

URL:


Skip to content

How to build

First, you should read the official Android documentation for kernel build:

  1. Build kernels
  2. GKI release builds

WARNING

This page is for GKI devices, if you use an old kernel, please referIntergrate for non-GKI devices.

Build kernel

Sync the kernel source code

sh
repo init -u https://android.googlesource.com/kernel/manifestmv <kernel_manifest.xml> .repo/manifestsrepo init -m manifest.xmlrepo sync

The<kernel_manifest.xml> file is a manifest that uniquely identifies a build, allowing you to make it reproducible. To do this, you should download the manifest file fromGKI release builds.

Build

Please check theBuilding kernels first.

For example, to build anaarch64 kernel image:

sh
LTO=thin BUILD_CONFIG=common/build.config.gki.aarch64 build/build.sh

Don't forget to add theLTO=thin flag; otherwise, the build may fail if your computer has less than 24 GB of memory.

Starting from Android 13, the kernel is built bybazel:

sh
tools/bazel build --config=fast //common:kernel_aarch64_dist

INFO

For some Android 14 kernels, to make Wi-Fi/Bluetooth work, it might be necessary to remove all GKI protected exports:

sh
rm common/android/abi_gki_protected_exports_*

Build kernel with KernelSU

If you can successfully build the kernel, adding support for KernelSU will be relatively easy. In the root of kernel source directory, run any of the options listed below:

sh
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -
sh
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s main
sh
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s v0.5.2

Then, rebuild the kernel and you will get a kernel image with KernelSU!


[8]ページ先頭

©2009-2025 Movatter.jp