Skip to content

Kernel Builder

Kernel Builder #52

Workflow file for this run

name: Kernel Builder
on:
workflow_dispatch:
inputs:
MANIFEST_URL:
description: 'Kernel Manifest'
required: true
default: 'https://github.com/cd-Crypton/android_kernel-manifest'
MANIFEST_BRANCH:
description: 'Kernel Manifest Branch'
required: true
default: 'realme/sm6225'
BUILD_CONFIG:
description: 'Customized build.config file'
required: true
default: 'sm6225/build.config.sm6225'
KERNEL_IMAGE_NAME:
description: 'Image, Image.gz, Image.gz-dtb, etc.'
required: true
default: 'Image.gz'
ANYKERNEL3:
description: 'Make flashable AnyKernel3 zip'
type: boolean
required: true
default: false
jobs:
build:
name: Build Kernel by ${{ github.actor }}
runs-on: ubuntu-20.04
if: github.event.repository.owner.id == github.event.sender.id
permissions:
contents: write
steps:
# This action checks-out your repository under $GITHUB_WORKSPACE, so your workflow can access it.
- name: Checkout
uses: actions/checkout@v4
# Install necessary packages for building android kernel
- name: Cleanup
uses: rokibhasansagar/slimhub_actions@main
- name: Set Swap Space
uses: pierotofy/set-swap-space@master
with:
swap-size-gb: 32
# Install repo tool in case it was not yet installed
- name: Build Environment
run: |
sudo apt update -y
sudo apt install bison flex rsync bison device-tree-compiler bc -y
- name: Install Repo Tool
run: |
git config --global color.ui false
if ! command -v repo &> /dev/null; then
echo "'repo' command not found. Installing..."
mkdir -p ~/bin # Create bin directory if it doesn't exist
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
sudo ln -sf ~/bin/repo /usr/bin/repo
echo "'repo' command installed successfully."
else
echo "'repo' command already exists."
fi
# Initial the kernel manifest then sync after
- name: Initialize Manifest and Sync
run: |
mkdir -p android
cd android
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
repo init --depth=1 -u ${{ inputs.MANIFEST_URL }} -b ${{ inputs.MANIFEST_BRANCH }}
repo sync
# Starts the compiling process of android kernel
- name: Build Kernel
run: |
cd android
BUILD_CONFIG="${{ inputs.BUILD_CONFIG }}" build/build.sh 2>&1 | tee build.log
# Check if the out directory consist of target kernel image
- name: Setup kernel
continue-on-error: true
run: |
mkdir -p android/kernelbuild
mkdir -p android/modulebuild
cp -nf $(find android/out -name '${{ inputs.KERNEL_IMAGE_NAME }}*') android/kernelbuild/ 2>/dev/null
# Upload the release, if build is successful
- name: Upload to Release
uses: softprops/action-gh-release@v1
with:
files: |
android/kernelbuild/${{ inputs.KERNEL_IMAGE_NAME }}*
name: Android Kernel Release | ${{ github.run_id }}
tag_name: ${{ github.run_id }}
body: |
## Build Information
Manifest: ${{ inputs.MANIFEST_URL }}/tree/${{ inputs.MANIFEST_BRANCH }}