Build notes - chickendrop89/device_xiaomi_gemstones-kernel GitHub Wiki

Building this source:

Building using CI/CD (Actions)

  • GitHub actions can be used to automatically build the kernel with all of it's configurations
  • It can also be used to build other common kernels, provided the same build structure
  • chickendrop89/ack-build-workflow

Cloning the source, and build environment manually:

  • There is a custom repo manifest in the readme branch root directory, Download it, and move it into some directory.
  • If you are planning to build a custom source, follow the steps in #Forking before the last step here
  • Expecting the manifest is in the current directory, execute these commands
repo init -u https://android.googlesource.com/kernel/manifest -m $(pwd)/chickernel.xml
repo sync --fetch-submodules
💚 Building using kleaf (bazel)

Building using kleaf

# --config=fast speeds up the build
bazel build //common:<build config>
  • After building, the artifacts can be found somewhere at bazel-out

Kleaf accepts these configurations:

  • chickernel
  • chickernel_ksun
  • chickernel_ksun_susfs
📜 Building using build script

Building using build script

BUILD_CONFIG=common/<build config>
FAST_BUILD=1 # Not required, forces thinLTO

build/config.sh nconfig # Edit build configuration
build/build.sh # Build the kernel
  • After building, the artifacts can be found at out/dist/android13-5.15

Build script accepts these configurations:

  • build.config.gki.aarch64.chickernel
  • build.config.gki.aarch64.chickernel.ksun
  • build.config.gki.aarch64.chickernel.ksun.susfs

Forking

When forking this repo, unselect this option!

[x] Copy the "readme" branch only

Then, later in the cloning step (if following the guide and building manually). Edit these lines in the downloaded chickernel.xml:

<remote name="common-repo" fetch="(YOUR GITHUB USER URL)"/>  

And if you entered a different repository name, or changed branch name. Edit this line as well:

<project path="common" name="(YOUR FORK NAME)" remote="common-repo" revision="(YOUR FORK BRANCH)" >
  <linkfile src="." dest=".source_date_epoch_dir" />
</project>

Upstreaming the source:

  • Example: upstreaming the kernel to latest ACK LTS
git remote add ack https://android.googlesource.com/kernel/common
git fetch ack android13-5.15-lts
git merge ack/android13-5.15-lts

# Then fix merge conflicts if any

Upstreaming KernelSU Next:

  • Example: change directory to your source, and run:
git submodule update --init --remote

Upstreaming SuSFS:

  • Upstreaming SuSFS implementation in kernel is kinda tricky, because it involves applying patches, and re-doing everything
  • Clone the gki-android13-5.15 branch into your working directory outside the kernel, and after you do the 1st step mentioned below, do everything as according the guide in it's README

I do it someway like this:

  1. First, i revert previous implementation commit
  2. I merge the directories from kernel_patches/ to my tree
  3. I apply the patch: git apply *.patch --reject --whitespace=fix

Notice

  • I am also new to building GKI kernels, feel free to leave any feedback, or open issue if you have any problems. Thanks
⚠️ **GitHub.com Fallback** ⚠️