Build Kernel with KernelSU #34
This file contains hidden or 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 with KernelSU | |
| on: | |
| schedule: | |
| - cron: "0 0 */3 * *" | |
| workflow_dispatch: | |
| inputs: | |
| susfs_branch: | |
| description: "KernelSU branch/tag to checkout (e.g. main , susfs-rksu-master)" | |
| required: false | |
| default: "main" | |
| jobs: | |
| build: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Checkout kernel source | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - name: Set up build environment | |
| run: | | |
| sudo apt update | |
| sudo apt install -y \ | |
| build-essential \ | |
| bc \ | |
| kmod \ | |
| cpio \ | |
| flex \ | |
| bison \ | |
| libssl-dev \ | |
| libelf-dev \ | |
| libncurses5-dev \ | |
| libncurses-dev \ | |
| dwarves \ | |
| zstd \ | |
| python3 \ | |
| rsync \ | |
| wget \ | |
| git | |
| # 添加工具链缓存 | |
| - name: Cache toolchain | |
| id: cache-toolchain | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/toolchain | |
| key: toolchain-v2-${{ runner.os }}-clang-22.0.0git-20250920-${{ hashFiles('**/build.sh') }} | |
| restore-keys: | | |
| toolchain-v2-${{ runner.os }}-clang-22.0.0git-20250920- | |
| toolchain-v2-${{ runner.os }}- | |
| - name: Inject KernelSU using setup.sh | |
| run: | | |
| BRANCH="${{ github.event.inputs.susfs_branch || 'main' }}" | |
| curl -LSs "https://raw.githubusercontent.com/rsuntk/KernelSU/main/kernel/setup.sh" | bash -s "$BRANCH" | |
| - name: Run build.sh | |
| run: | | |
| chmod +x ./build.sh | |
| ./build.sh | |
| - name: Upload kernel artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: kernel-image | |
| path: | | |
| out/arch/arm64/boot/Image | |
| out/arch/arm64/boot/Image.gz-dtb | |
| if-no-files-found: error |