Skip to content
This repository has been archived by the owner on Nov 18, 2024. It is now read-only.

Custom Build kernel

Custom Build kernel #5

Workflow file for this run

name: Custom Build kernel
on:
watch:
types: [started]
workflow_dispatch:
inputs:
KERNEL_SOURCE_BRANCH:
description: 'Kernel Source Code'
required: true
default: ''
DISABLE_CONFIG:
description: 'Disable Kernel Config(split with whitespace)'
required: true
default: 'CONFIG_LOCALVERSION_AUTO CONFIG_DEBUG_INFO CONFIG_MODVERSIONS CONFIG_CC_WERROR CONFIG_CRYPTO_DEV_QCOM_ICE'
ENABLE_CONFIG:
description: 'Enable Kernel Config(split with whitespace)'
required: true
default: 'CONFIG_OVERLAY_FS CONFIG_BUILD_ARM64_DT_OVERLAY CONFIG_BUILD_ARM64_APPENDED_DTB_IMAGE'
RELEASE_REPO_TAG:
description: 'Release To Repository With Tag'
required: true
default: 'HuaJi66/Xiaomi_Kernel_OpenSource/tag'
BUILD_ARGS:
description: 'Build Arga'
required: true
default: 'build_pad5p'
TOOLCHAIN:
description: 'Choice Toochain'
required: true
default: 'llvm'
type: choice
options:
- "nexus"
- "neutron"
- "nex14"
- "aosp"
- "zyc"
- "slim"
- "eva-gcc"
- "yuki"
- "llvm"
ENABLE_CCACHE:
description: 'Enable Ccache'
required: true
default: true
type: boolean
KERNELSU_TAG:
description: 'KernelSU TAG'
required: false
default: 'v0.9.5'
type: choice
options:
- 'v1.0.0'
- 'v0.9.5'
- 'v0.9.4'
- 'v0.9.3'
- 'v0.9.2'
- 'v0.9.1'
- 'v0.9.0'
jobs:
build:
name: Build Kernel by ${{ github.actor }}
runs-on: ubuntu-22.04
if: github.event.repository.owner.id == github.event.sender.id
env:
CCACHE_COMPILERCHECK: "%compiler% -dumpmachine; %compiler% -dumpversion"
CCACHE_NOHASHDIR: "true"
CCACHE_HARDLINK: "true"
CI: "false"
steps:
- uses: actions/checkout@v4
- name: Prepare Configuration
run: |
# Release
echo "PUBLISH_RELEASE_REPO_AUTHOR=$(echo ${{ inputs.RELEASE_REPO_TAG }} | awk -F '/' '{ print $1 }')" >> $GITHUB_ENV
echo "PUBLISH_RELEASE_REPO=$(echo ${{ inputs.RELEASE_REPO_TAG }} | awk -F '/' '{ print $2 }')" >> $GITHUB_ENV
echo "PUBLISH_RELEASE_VERSION=$(echo ${{ inputs.RELEASE_REPO_TAG }} | awk -F '/' '{ print $3 }')" >> $GITHUB_ENV
if [ ! -z "${{ env.PUBLISH_RELEASE_REPO_AUTHOR }}" ] && [ ! -z "${{ env.PUBLISH_RELEASE_REPO }}" ] && [ ! -z "${{ env.PUBLISH_RELEASE_VERSION }}" ]; then
echo "PUBLISH_RELEASE=false" >> $GITHUB_ENV
else
echo "PUBLISH_RELEASE=true" >> $GITHUB_ENV
fi
- name: Set swap
uses: pierotofy/set-swap-space@master
with:
swap-size-gb: 10
- name: Setup ccache
if: ${{ inputs.ENABLE_CCACHE }} == 'true'
uses: hendrikmuhs/[email protected]
with:
key: build-kernel-${{ env.PUBLISH_RELEASE_VERSION }}
max-size: 10G
- name: Download kernel source
run: |
export GITHUB_TOKEN="${{ secrets.ACTION }}"
export OWNER=${{ github.actor }}
curl -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.raw" https://raw.githubusercontent.com/${{ github.actor }}/Build_Kernel_Action/enuma/shell/down_git.sh -o down_git.sh
chmod +x down_git.sh && bash down_git.sh "${{ inputs.KERNEL_SOURCE_BRANCH }}"
- name: Build Kernel With Custom
run: |
sudo apt-get update && sudo apt install -y cpio flex bc python2
export GITHUB_TOKEN="${{ secrets.ACTION }}"
export ENABLE_CONFIG="${{ inputs.ENABLE_CONFIG }}"
export DISABLE_CONFIG="${{ inputs.DISABLE_CONFIG }}"
export KBUILD_BUILD_HOST="action_builder"
export KBUILD_BUILD_USER="$(echo ${{ github.actor }} | tr A-Z a-z)"
export KERNEL_TAG="${{ env.PUBLISH_RELEASE_VERSION }}"
export KERNEL_SOURCE="${{ env.KERNEL_SOURCE }}"
export KERNELSU_TAG="${{ inputs.KERNELSU_TAG }}"
export TOOLCHAIN="${{ inputs.TOOLCHAIN }}"
cd $GITHUB_WORKSPACE/android-kernel
curl -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.raw" https://raw.githubusercontent.com/${{ github.actor }}/Build_Kernel_Action/enuma/shell/build.sh -o build.sh
curl -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.raw" https://raw.githubusercontent.com/${{ github.actor }}/Build_Kernel_Action/enuma/build_custom.sh -o build_custom.sh
chmod +x *.sh && ./build_custom.sh ${{ inputs.BUILD_ARGS }}
if [ ! -f CHANGELOG.md ];then
echo -e "# Build Log\n- Build Date: $(date)\n- Linux Version: $(make kernelversion)\n- Complier: `cat out/.config | grep -w "Compiler" | sed 's/^# Compiler: //'`" > CHANGELOG.md
fi
- name: Upload Release
uses: actions/upload-artifact@v4
with:
name: ${{ env.PUBLISH_RELEASE_VERSION }}
path: android-kernel/release/*
- name: Release Kernel
uses: softprops/action-gh-release@v2
if: env.PUBLISH_RELEASE == 'true'
with:
repository: ${{ env.PUBLISH_RELEASE_REPO_AUTHOR }}/${{ env.PUBLISH_RELEASE_REPO }}
name: ${{ env.PUBLISH_RELEASE_VERSION }} Kernel For Xiaomi Pad 5 Pro Devices
tag_name: ${{ env.PUBLISH_RELEASE_VERSION }}
files: |
android-kernel/release/*.zip
android-kernel/release/Image*
android-kernel/release/dtb*
body_path: android-kernel/CHANGELOG.md
prerelease: false
make_latest: true
# note you'll typically need to create a personal access token
# with permissions to create releases in the other repo
# token: ${{secrets.ACTION}}