Skip to content

Latest commit

 

History

History
169 lines (119 loc) · 7.63 KB

README_vanlia.md

File metadata and controls

169 lines (119 loc) · 7.63 KB
banner

Build Your Own Kernel with Github Action

English | 中文

License Language Issues Pull Requests

This Github Action helps you build kernels. It reads multiple kernel sources from a configuration file and builds them using different toolchains. Additionally, it supports patching the kernel with KernelSU and uploading the built kernel image.



  Configure  

  Quick Start  

  Local testing  


Development progress

  • Web page configuration Json compilation configuration file (to be released soon)
  • Use MagiskBoot to generate boot.img
  • Use script to compile kernel locally
  • Webpage for online kernel building
  • Support origin / custom AnyKernel3
  • Custom build info
  • Suppor Docker

Github Action

This action contains two jobs: Set-repos and Build-Kernel.

The Set-repos job reads the kernel sources from the configuration file and outputs them to the Build-Kernel job. The Build-Kernel job uses the outputted kernel sources to build the kernels and upload the built kernel images.

Trigger

Event name Description
workflow_dispatch Manually run

Workflow

Step Description
Install prerequisites Install the necessary dependencies for building the kernel
Setup Anykernel3 Clone the Anykernel3 repository to prepare for packaging the kernel
Clone kernel source Clone the kernel source code repository for the Android device
Get toolchains Obtain the required cross-compilation toolchains for building the kernel
Set args Set the necessary build parameters for the kernel
Update KernelSU Update the KernelSU tool to ensure compatibility with the new kernel
Make defconfig Generate the kernel configuration file
Build kernel Compile the kernel source code to create the kernel image
Upload Image Upload the kernel image file to a designated location
Upload Image.gz Upload the compressed kernel image file to a designated location
Upload dtb Upload the device tree blob file to a designated location
Upload dtbo.img Upload the device tree overlay image file to a designated location
Pack AnyKernel3.zip Package the kernel image and device tree files into an Anykernel3 zip file
Upload AnyKernel3 image Upload the Anykernel3 zip file to a designated location
Create GitHub Release Create a new release on GitHub to share the kernel with the community

Configuration File Syntax

See repo configuration file guidance.

How to use

This project's basic usage is as follows:

  1. Fork this project on GitHub.

  2. Modify the repos/repos*.json file through the Github website or pull it to your local machine and commit the changes.

  3. Go to the Action page on Github and find Build kernels, then Run workflow.

Notice

In this step, you may encounter the following error when executing softprops/action-gh-release@v1:

👩‍🏭 Creating new GitHub release for tag v20230619.7...
⚠️ GitHub release failed with status: 403
undefined
retrying... (2 retries remaining)
👩‍🏭 Creating new GitHub release for tag v20230619.7...
⚠️ GitHub release failed with status: 403
undefined
retrying... (1 retries remaining)
👩‍🏭 Creating new GitHub release for tag v20230619.7...
⚠️ GitHub release failed with status: 403
undefined
retrying... (0 retries remaining)
❌ Too many retries. Aborting...
Error: Too many retries.

The reason for this error is related to workflow permissions:

workflow permissions

Complete the permission settings and then you can publish your own Release normally.

  1. Wait for the compilation to finish, then download the compiled product from the corresponding page.

  2. Use your preferred packaging software to package the kernel (AnyKernel3, Android-Image-Kitchen, MagiskBoot, etc.)

Artifacts

Local testing

If you don't want to run the action on Github, you can use nektos/act to test this workflow locally and output the files.

Normal local build (kernel source code is fetched using Git)

This is the recommended local testing process. Simply install nektos/act and run the following command:

# Collect artifacts to /tmp/artifacts folder:
act --artifact-server-path /tmp/artifacts

If you want to store the artifacts in a different location, change /tmp/artifacts to your preferred directory.

If there are errors, use the -v flag to generate an error report and submit an issue. Here's the command:

# Collect artifacts to /tmp/artifacts folder:
act --artifact-server-path /tmp/artifacts -v

Full local build (kernel source code is stored locally)

If you need to perform a completely local build, consider building as follows:

  1. Set up a local Gitea or Gitlab Git service and modify the configuration file address to point to the local service address.

  2. Use git daemon to create a secondary image locally.

This is just a suggestion, and we do not provide a specific guide.

Acknowledgments

Contributor

contributors

Star history

Star History

License

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.