Build Kernel (Sync source via Repo) #30
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Kernel (Sync source via Repo) | |
on: | |
workflow_dispatch: | |
inputs: | |
KERNEL_MANIFEST: | |
description: 'Kernel Manifest' | |
required: true | |
default: 'lightsummer233/kernel_manifest' | |
KERNEL_MANIFEST_BRANCH: | |
description: 'Kernel Manifest Branch' | |
required: true | |
default: 'android-msm-4.19-arisu' | |
BUILD_SCRIPT: | |
description: 'Build Script' | |
required: true | |
default: 'build_alioth.sh' | |
ADD_KERNELSU: | |
description: 'Add KernelSU' | |
required: true | |
default: false | |
type: boolean | |
ADD_PATH_UMOUNT: | |
description: 'Add `path_umount` for KernelSU' | |
required: true | |
default: false | |
type: boolean | |
ENABLE_CCACHE: | |
description: 'Enable ccache' | |
required: true | |
default: true | |
type: boolean | |
jobs: | |
build: | |
name: Build Kernel | |
runs-on: ubuntu-latest | |
env: | |
CCACHE_COMPILERCHECK: "%compiler% -dumpmachine; %compiler% -dumpversion" | |
CCACHE_NOHASHDIR: "true" | |
CCACHE_HARDLINK: "true" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Remove unused packages | |
uses: jlumbroso/free-disk-space@main | |
with: | |
tool-cache: ture | |
android: true | |
dotnet: true | |
haskell: true | |
large-packages: true | |
docker-images: true | |
swap-storage: false | |
- name: Setup Build Environment | |
run: | | |
echo "BUILD_TIME=$(TZ=Asia/Shanghai date "+%Y%m%d%H%M")" >> $GITHUB_ENV | |
sudo apt update | |
sudo apt install repo bc make bison build-essential curl flex g++-multilib gcc-multilib git gnupg gperf libfuse-dev lib32readline-dev lib32z1-dev liblz4-tool libsdl1.2-dev libssl-dev libxml2 libxml2-utils lzop pngcrush rsync schedtool squashfs-tools xsltproc zlib1g-dev libc6-dev-i386 libncurses6 libncursesw6 lib32ncurses-dev lib32ncurses6 lib32ncursesw6 libncurses5-dev | |
- name: Set swap to 10G | |
uses: pierotofy/set-swap-space@master | |
with: | |
swap-size-gb: 10 | |
- name: Setup ccache | |
if: github.event.inputs.ENABLE_CCACHE == 'true' | |
uses: hendrikmuhs/ccache-action@v1.2 | |
with: | |
key: build-kernel-${{ github.event.inputs.KERNEL_MANIFEST_BRANCH }} | |
max-size: 2G | |
- name: Checkout AnyKernel3 | |
uses: actions/checkout@v4 | |
with: | |
repository: lightsummer233/AnyKernel3 | |
path: build/AnyKernel3 | |
- name: Checkout Kernel Source | |
run: | | |
cd build | |
repo init -u https://github.com/${{ github.event.inputs.KERNEL_MANIFEST }}.git -b ${{ github.event.inputs.KERNEL_MANIFEST_BRANCH }} | |
repo sync | |
- name: Setup KernelSU | |
if: github.event.inputs.ADD_KERNELSU == 'true' | |
run: | | |
cd build/kernel | |
git config --global user.email "lightsummer233@awainatsu.moe" | |
git config --global user.name "lightsummer233" | |
git am ../../patch/KernelSU.patch | |
curl -LSs "https://raw.githubusercontent.com/lightsummer233/KernelSU/main/kernel/setup.sh" | bash -s main | |
git add -A && git commit -a -m "Add KernelSU" | |
- name: Setup path_umount | |
if: github.event.inputs.ADD_PATH_UMOUNT == 'true' | |
run: | | |
cd build/kernel | |
git am ../../patch/KernelSU-path_umount.patch | |
- name: Build Kernel | |
run: | | |
cd build | |
bash ${{ github.event.inputs.BUILD_SCRIPT }} | |
- name: Configuration AnyKernel3 | |
run: | | |
cd build | |
cp out/*/dist/Image AnyKernel3 | |
cp out/*/dist/dtbo.img AnyKernel3 | |
cp out/*/dist/dtb AnyKernel3 | |
- name: Upload Kernel | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ github.event.inputs.KERNEL_MANIFEST_BRANCH }}-${{ env.BUILD_TIME }} | |
path: | | |
build/AnyKernel3/ | |
!build/AnyKernel3/*.git* | |
!build/AnyKernel3/patch | |
!build/AnyKernel3/modules | |
!build/AnyKernel3/ramdisk | |
compression-level: 9 |