|
| 1 | +name: Build KernelSU-Next for B4S4 (Bonito/Sargo) |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - b4s4 |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - b4s4 |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +jobs: |
| 13 | + build: |
| 14 | + runs-on: ubuntu-22.04 |
| 15 | + |
| 16 | + steps: |
| 17 | + - name: ⚡ Checkout kernel's sourcecode and clone submodules |
| 18 | + run: | |
| 19 | + git clone https://github.com/Evolution-X-Devices/kernel_google_b4s4 -b vic |
| 20 | + cd kernel_google_b4s4 |
| 21 | + |
| 22 | + - name: 📅 Export date of build |
| 23 | + run: | |
| 24 | + echo "DATE=$(date +%d%m%Y)" >> $GITHUB_ENV |
| 25 | +
|
| 26 | + - name: 🔄 Update KernelSU-Next |
| 27 | + run: | |
| 28 | + rm -rf KernelSU-Next |
| 29 | + git clone https://github.com/KernelSU-Next/KernelSU-Next -b v1.0.5 |
| 30 | +
|
| 31 | + - name: 📥 Clone AnyKernel3 |
| 32 | + run: | |
| 33 | + git clone -b b4s4 https://github.com/Oneloutre/AnyKernel3.git anykernel |
| 34 | + rm -rf anykernel/.git |
| 35 | +
|
| 36 | + - name: 📦 Install dépendencies |
| 37 | + run: | |
| 38 | + sudo apt-get update -y -qq |
| 39 | + sudo apt-get install -y --no-install-recommends \ |
| 40 | + python3-pip \ |
| 41 | + git \ |
| 42 | + zip \ |
| 43 | + unzip \ |
| 44 | + gcc \ |
| 45 | + g++ \ |
| 46 | + make \ |
| 47 | + ninja-build \ |
| 48 | + file \ |
| 49 | + bc \ |
| 50 | + bison \ |
| 51 | + flex \ |
| 52 | + libfl-dev \ |
| 53 | + libssl-dev \ |
| 54 | + libelf-dev \ |
| 55 | + wget \ |
| 56 | + build-essential \ |
| 57 | + python3-dev \ |
| 58 | + python3-setuptools \ |
| 59 | + rsync \ |
| 60 | + ccache \ |
| 61 | + llvm-dev |
| 62 | + sudo apt install flex libncurses6 libncurses5 binutils-aarch64-linux-gnu device-tree-compiler \ |
| 63 | + android-sdk-libsparse-utils |
| 64 | + sudo apt install -y gcc-arm-linux-gnueabi |
| 65 | + echo "CROSS_COMPILE_ARM32=arm-linux-gnueabi-" >> $GITHUB_ENV |
| 66 | +
|
| 67 | + - name: 🔧 Install Clang from a Github action |
| 68 | + uses: KyleMayes/install-llvm-action@v2 |
| 69 | + with: |
| 70 | + version: "18.1.8" |
| 71 | + directory: ${{ runner.temp }}/llvm |
| 72 | + |
| 73 | + - name: 🔧 Add Clang to the PATH |
| 74 | + run: | |
| 75 | + echo "${{ runner.temp }}/llvm/bin" >> $GITHUB_PATH |
| 76 | + |
| 77 | + - name: 🛠 Use repo's mkdtimg |
| 78 | + run: | |
| 79 | + chmod +x tools/mkdtimg |
| 80 | + sudo mv tools/mkdtimg /usr/local/bin/mkdtimg |
| 81 | +
|
| 82 | + - name: 🔍 Device's codename and kernel's version |
| 83 | + run: | |
| 84 | + DEVICE_CODENAME=sargo-bonito |
| 85 | + KERNEL_VERSION=$(make kernelversion) |
| 86 | +
|
| 87 | + echo "Device Codename: $DEVICE_CODENAME" |
| 88 | + echo "Kernel Version: $KERNEL_VERSION" |
| 89 | +
|
| 90 | + echo "DEVICE_CODENAME=$DEVICE_CODENAME" >> $GITHUB_ENV |
| 91 | + echo "KERNEL_VERSION=$KERNEL_VERSION" >> $GITHUB_ENV |
| 92 | +
|
| 93 | + - name: 🚀 Enable ccache to speed the build up |
| 94 | + uses: hendrikmuhs/ccache-action@v1.2 |
| 95 | + with: |
| 96 | + max-size: 7G |
| 97 | + |
| 98 | + - name: 🛠️ Build the kramel |
| 99 | + run: | |
| 100 | + export ARCH=arm64 |
| 101 | + export SUBARCH=arm64 |
| 102 | + export KBUILD_COMPILER_STRING=$(clang --version | head -n 1) |
| 103 | + export CCACHE_EXEC=$(which ccache) |
| 104 | + export KBUILD_BUILD_HOST="Caelum-Github-actions-Onelots" |
| 105 | +
|
| 106 | + make O=out ARCH=arm64 bonito_defconfig vendor/kernelsu.config V=1 |
| 107 | + make O=out ARCH=arm64 olddefconfig |
| 108 | + ./scripts/config --file out/.config -e CONFIG_BUILD_ARM64_APPENDED_DTB_IMAGE |
| 109 | +
|
| 110 | + make -j$(nproc --all) O=out \ |
| 111 | + ARCH=arm64 \ |
| 112 | + CC="ccache clang" \ |
| 113 | + LLVM=1 \ |
| 114 | + LLVM_IAS=1 \ |
| 115 | + CLANG_TRIPLE=aarch64-linux-gnu- \ |
| 116 | + CROSS_COMPILE=aarch64-linux-android- \ |
| 117 | + CROSS_COMPILE_ARM32=arm-linux-androideabi- |
| 118 | +
|
| 119 | + - name: 🚀 Copy the compiled kernel to AnyKernel3 then create the zip |
| 120 | + run: | |
| 121 | + ZIP_NAME="Kernel-Caelum-${DEVICE_CODENAME}-${KERNEL_VERSION}-$(date +%d%m%Y).zip" |
| 122 | +
|
| 123 | + cp out/arch/arm64/boot/Image.lz4-dtb anykernel/ |
| 124 | +
|
| 125 | + cd anykernel && zip -r9 $ZIP_NAME ./* |
| 126 | + mv $ZIP_NAME ../ |
| 127 | +
|
| 128 | + echo "ZIP_NAME=$ZIP_NAME" >> $GITHUB_ENV |
| 129 | +
|
| 130 | + - name: 🤌 Copy zip file to get 2 different zip files |
| 131 | + run: | |
| 132 | +
|
| 133 | + ZIP_ALTERNATIVE="KernelSU-Next-Caelum-${DEVICE_CODENAME}-latest.zip" |
| 134 | + cp ${ZIP_NAME} $ZIP_ALTERNATIVE |
| 135 | +
|
| 136 | + echo "Copied ${ZIP_NAME} as $ZIP_ALTERNATIVE" |
| 137 | + echo "ZIP_ALTERNATIVE=$ZIP_ALTERNATIVE" >> $GITHUB_ENV |
| 138 | + |
| 139 | + - name: 📤 Publish github release |
| 140 | + uses: softprops/action-gh-release@v2 |
| 141 | + with: |
| 142 | + files: ${{ env.ZIP_ALTERNATIVE }} |
| 143 | + tag_name: "latest" |
| 144 | + draft: false |
| 145 | + prerelease: false |
| 146 | + |
| 147 | + - name: 📤 Publish with tag associated to the kernel and the date |
| 148 | + uses: softprops/action-gh-release@v2 |
| 149 | + with: |
| 150 | + files: ${{ env.ZIP_NAME }} |
| 151 | + tag_name: Kernel-Caelum-${{ env.DEVICE_CODENAME }}-${{ env.KERNEL_VERSION }}-${{ env.DATE }} |
| 152 | + draft: false |
| 153 | + prerelease: false |
| 154 | + |
| 155 | + - name: 🚀 Notify people on Discord |
| 156 | + env: |
| 157 | + DEVICE_CODENAME: ${{ env.DEVICE_CODENAME }} |
| 158 | + KERNEL_VERSION: ${{ env.KERNEL_VERSION }} |
| 159 | + WEBHOOK: ${{ secrets.WEBHOOK }} |
| 160 | + NAME: ${{ env.ZIP_NAME }} |
| 161 | + run: | |
| 162 | + python3 .github/webhook.py |
0 commit comments