|
| 1 | +# Kernel Auto Builder 🚀 |
| 2 | + |
| 3 | +Latest device released :  |
| 4 | + |
| 5 | +[]() |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | +## 🌟 Overview |
| 10 | +This repository automates kernel compilation using **GitHub Actions**. The built kernel is published to **GitHub Releases**, and a **Discord notification** is sent upon completion. |
| 11 | +this repo WILL NOT patch the kernel with KernelSU-Next for you |
| 12 | + |
| 13 | +## ✨ Features |
| 14 | +- ⚙️ **Automated kernel compilation** via GitHub Actions |
| 15 | +- 📂 **KernelSU-Next handling** - NOT PATCHING ! |
| 16 | +- 🔥 **Flashable ZIP creation through AnyKernel3** |
| 17 | +- 🚀 **GitHub Releases integration** (`latest` + dynamic versioning) |
| 18 | +- 📢 **Discord webhook notifications** |
| 19 | + |
| 20 | +## ⚙️ Configuration & Usage |
| 21 | + |
| 22 | +### 🔹 **Prerequisites** |
| 23 | +- A fork of the kernel source repository |
| 24 | +- **GitHub Secrets Required:** |
| 25 | + - `WEBHOOK` → Discord webhook for notifications |
| 26 | + |
| 27 | +### 📱 **Usage** |
| 28 | + |
| 29 | +Here is the default `.github/workflows/kernel_build.yml`. Modify it to your convenience, then use it. |
| 30 | + |
| 31 | +<details> |
| 32 | +<summary>kernel_build.yml</summary> |
| 33 | + |
| 34 | +```yml |
| 35 | +name: Build Android Kernel then ship it in an AnyKernel3 flashable zip |
| 36 | + |
| 37 | +on: |
| 38 | + push: |
| 39 | + branches: |
| 40 | + - YourBranch |
| 41 | + pull_request: |
| 42 | + branches: |
| 43 | + - YourBranch |
| 44 | + workflow_dispatch: |
| 45 | + |
| 46 | +jobs: |
| 47 | + build: |
| 48 | + runs-on: ubuntu-22.04 |
| 49 | + |
| 50 | + steps: |
| 51 | + - name: ⚡ Checkout kernel's sourcecode and clone submodules |
| 52 | + uses: actions/checkout@v4 |
| 53 | + |
| 54 | + - name: 🔄 Update KernelSU-Next |
| 55 | + run: | |
| 56 | + rm -rf KernelSU-Next |
| 57 | + git clone https://github.com/KernelSU-Next/KernelSU-Next |
| 58 | +
|
| 59 | + - name: 📥 Clone AnyKernel3 |
| 60 | + run: | |
| 61 | + git clone -b b4s4 https://github.com/Oneloutre/AnyKernel3.git anykernel |
| 62 | + rm -rf anykernel/.git |
| 63 | +
|
| 64 | + - name: 📦 Install dépendencies |
| 65 | + run: | |
| 66 | + sudo apt-get update -y -qq |
| 67 | + sudo apt-get install -y --no-install-recommends \ |
| 68 | + python3-pip \ |
| 69 | + git \ |
| 70 | + zip \ |
| 71 | + unzip \ |
| 72 | + gcc \ |
| 73 | + g++ \ |
| 74 | + make \ |
| 75 | + ninja-build \ |
| 76 | + file \ |
| 77 | + bc \ |
| 78 | + bison \ |
| 79 | + flex \ |
| 80 | + libfl-dev \ |
| 81 | + libssl-dev \ |
| 82 | + libelf-dev \ |
| 83 | + wget \ |
| 84 | + build-essential \ |
| 85 | + python3-dev \ |
| 86 | + python3-setuptools \ |
| 87 | + rsync \ |
| 88 | + ccache \ |
| 89 | + llvm-dev |
| 90 | + sudo apt install flex libncurses6 libncurses5 binutils-aarch64-linux-gnu device-tree-compiler \ |
| 91 | + android-sdk-libsparse-utils |
| 92 | + sudo apt install -y gcc-arm-linux-gnueabi |
| 93 | + echo "CROSS_COMPILE_ARM32=arm-linux-gnueabi-" >> $GITHUB_ENV |
| 94 | +
|
| 95 | + - name: 🔧 Install Clang from a Github action |
| 96 | + uses: KyleMayes/install-llvm-action@v2 |
| 97 | + with: |
| 98 | + version: "18.1.8" |
| 99 | + directory: ${{ runner.temp }}/llvm |
| 100 | + |
| 101 | + - name: 🔧 Add Clang to the PATH |
| 102 | + run: | |
| 103 | + echo "${{ runner.temp }}/llvm/bin" >> $GITHUB_PATH |
| 104 | + |
| 105 | + - name: 🛠 Use repo's mkdtimg |
| 106 | + run: | |
| 107 | + chmod +x tools/mkdtimg |
| 108 | + sudo mv tools/mkdtimg /usr/local/bin/mkdtimg |
| 109 | +
|
| 110 | + - name: 🔍 Device's codename and kernel's version |
| 111 | + run: | |
| 112 | + DEVICE_CODENAME=YourDevice |
| 113 | + KERNEL_VERSION=$(make kernelversion) |
| 114 | +
|
| 115 | + echo "Device Codename: $DEVICE_CODENAME" |
| 116 | + echo "Kernel Version: $KERNEL_VERSION" |
| 117 | +
|
| 118 | + echo "DEVICE_CODENAME=$DEVICE_CODENAME" >> $GITHUB_ENV |
| 119 | + echo "KERNEL_VERSION=$KERNEL_VERSION" >> $GITHUB_ENV |
| 120 | +
|
| 121 | + - name: 🚀 Enable ccache to speed the build up |
| 122 | + uses: hendrikmuhs/ccache-action@v1.2 |
| 123 | + with: |
| 124 | + max-size: 7G |
| 125 | + |
| 126 | + - name: 🛠️ Build the kramel |
| 127 | + run: | |
| 128 | + export ARCH=arm64 |
| 129 | + export SUBARCH=arm64 |
| 130 | + export KBUILD_COMPILER_STRING=$(clang --version | head -n 1) |
| 131 | + export CCACHE_EXEC=$(which ccache) |
| 132 | + export KBUILD_BUILD_HOST="Github-actions-Onelots" |
| 133 | +
|
| 134 | + make O=out ARCH=arm64 YOUR_DEFCONFIG V=1 |
| 135 | + make O=out ARCH=arm64 olddefconfig |
| 136 | + ./scripts/config --file out/.config -e CONFIG_BUILD_ARM64_APPENDED_DTB_IMAGE |
| 137 | +
|
| 138 | + make -j$(nproc --all) O=out \ |
| 139 | + ARCH=arm64 \ |
| 140 | + CC="ccache clang" \ |
| 141 | + LLVM=1 \ |
| 142 | + LLVM_IAS=1 \ |
| 143 | + CLANG_TRIPLE=aarch64-linux-gnu- \ |
| 144 | + CROSS_COMPILE=aarch64-linux-android- \ |
| 145 | + CROSS_COMPILE_ARM32=arm-linux-androideabi- |
| 146 | +
|
| 147 | + - name: 🚀 Copy the compiled kernel to AnyKernel3 then create the zip |
| 148 | + run: | |
| 149 | + ZIP_NAME="Kernel-${DEVICE_CODENAME}-${KERNEL_VERSION}-$(date +%d%m%Y).zip" |
| 150 | +
|
| 151 | + cp out/arch/arm64/boot/Image.lz4-dtb anykernel/ |
| 152 | +
|
| 153 | + cd anykernel && zip -r9 $ZIP_NAME ./* |
| 154 | + mv $ZIP_NAME ../ |
| 155 | +
|
| 156 | + echo "ZIP_NAME=$ZIP_NAME" >> $GITHUB_ENV |
| 157 | +
|
| 158 | + - name: 📤 Publish github release |
| 159 | + uses: softprops/action-gh-release@v2 |
| 160 | + with: |
| 161 | + files: ${{ env.ZIP_NAME }} |
| 162 | + tag_name: "latest" |
| 163 | + draft: false |
| 164 | + prerelease: false |
| 165 | + |
| 166 | + - name: 📤 Publish with tag associated to the kernel |
| 167 | + uses: softprops/action-gh-release@v2 |
| 168 | + with: |
| 169 | + files: ${{ env.ZIP_NAME }} |
| 170 | + tag_name: "${{ env.ZIP_NAME }}" |
| 171 | + draft: false |
| 172 | + prerelease: false |
| 173 | + |
| 174 | + - name: 🚀 Notify people on Discord |
| 175 | + env: |
| 176 | + DEVICE_CODENAME: ${{ env.DEVICE_CODENAME }} |
| 177 | + KERNEL_VERSION: ${{ env.KERNEL_VERSION }} |
| 178 | + WEBHOOK: ${{ secrets.WEBHOOK }} |
| 179 | + NAME: ${{ env.ZIP_NAME }} |
| 180 | + run: | |
| 181 | + python3 .github/webhook.py |
| 182 | +``` |
| 183 | +
|
| 184 | +</details> |
0 commit comments