Skip to content

Build Kernel

Build Kernel #15

Workflow file for this run

name: Build Kernel
on:
workflow_dispatch:
schedule:
# 每周周六00:00运行. 时间设置参考: http://crontab.guru
- cron: '0 0 * * 6'
push:
branches:
- HEAD
pull_request:
branches:
- HEAD
jobs:
build:
runs-on: ubuntu-20.04
env:
CCACHE_COMPILERCHECK: "%compiler% -dumpmachine; %compiler% -dumpversion"
CCACHE_NOHASHDIR: "true"
CCACHE_MAXSIZE: "2G"
CCACHE_HARDLINK: "true"
KERNEL_DEFCONFIG: "a10s_defconfig"
KERNEL_CMDLINE: "ARCH=arm64 CC=clang CLANG_TRIPLE=aarch64-linux-gnu- CROSS_COMPILE=aarch64-linux-gnu- CROSS_COMPILE_ARM32=arm-linux-gnueabi- O=out"
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'true'
fetch-depth: 100
- name: Set up ccache
uses: hendrikmuhs/[email protected]
- name: Install dependencies
run: |
sudo apt-get update -y
sudo apt install gcc-aarch64-linux-gnu -y
sudo apt install gcc-arm-linux-gnueabi -y
sudo apt install binutils make python3 libssl-dev build-essential bc bison flex unzip libssl-dev ca-certificates xz-utils mkbootimg cpio device-tree-compiler git git-lfs -y
git clone https://github.com/kdrag0n/proton-clang --dept=1 -b master
make clean
make mrproper
- name: GetTime
id: get_time
run: |
echo "TIME=$(TZ=UTC-8 date +%m%d%H%M )" >> $GITHUB_OUTPUT
- name: Build Kernel-With-KernelSU
run: |
rm -rf KernelSU
rm -rf drivers/kernelsu
curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash -s main
export PATH=$PATH:$(pwd)/proton-clang/bin/
export CC=clang
export CLANG_TRIPLE=aarch64-linux-gnu-
export CROSS_COMPILE=aarch64-linux-gnu-
export CROSS_COMPILE_ARM32=arm-linux-gnueabi-
export ARCH=arm64
export SUBARCH=arm64
export ANDROID_MAJOR_VERSION=r
export KCFLAGS=-w
make O=out KCFLAGS=-w ARCH=arm64 CC="ccache clang" a10s_defconfig
make O=out KCFLAGS=-w ARCH=arm64 CC="ccache clang" -j$(nproc --all)
- name: Package kernel
run: |
git clone --depth=1 https://github.com/osm0sis/AnyKernel3 -b master AnyKernel3 && rm -rf AnyKernel3/.git AnyKernel3/.github AnyKernel3/LICENSE AnyKernel3/README.md
if [[ -f out/arch/arm64/boot/Image.gz-dtb ]]; then
cp out/arch/arm64/boot/Image.gz-dtb AnyKernel3/Image.gz-dtb
elif [[ -f out/arch/arm64/boot/Image-dtb ]]; then
cp out/arch/arm64/boot/Image-dtb AnyKernel3/Image-dtb
elif [[ -f out/arch/arm64/boot/Image.gz ]]; then
cp out/arch/arm64/boot/Image.gz AnyKernel3/Image.gz
elif [[ -f out/arch/arm64/boot/Image ]]; then
cp out/arch/arm64/boot/Image AnyKernel3/Image
fi
if [ -f out/arch/arm64/boot/dtbo.img ]; then
cp out/arch/arm64/boot/dtbo.img AnyKernel3/dtbo.img
fi
- name: Upload kernel to artifact
uses: actions/upload-artifact@v3
with:
name: final-kernal
path: out/arch/arm64/*