Build kernelsu-susfs #4
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 kernelsu-susfs | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| codename: | |
| required: true | |
| type: string | |
| default: 'lineage_sm8150' | |
| repo: | |
| required: true | |
| type: string | |
| default: 'android_kernel_oneplus_sm8150' | |
| jobs: | |
| build-kernelsu-susfs: | |
| runs-on: ubuntu-latest | |
| env: | |
| # General Build Environment | |
| CCACHE_MAXSIZE: "2G" | |
| GITHUB_TOKEN: ${{ secrets.GH_PAT }} | |
| # Kernel & Device Configuration | |
| KERNEL_SOURCE: "https://github.com/LineageOS/${{ inputs.repo }}" | |
| KERNEL_BRANCH: "lineage-23.0" # Stable branch for this kernel version | |
| KERNEL_VERSION: "4.14" # Required for sm8150 patches | |
| KERNEL_DEFCONFIG: "vendor/sm8150_defconfig" | |
| DEVICE_CODENAME: "guacamole" # Correct codename for OnePlus 7 Pro | |
| KERNEL_DIR: "device_kernel" # Define a consistent kernel directory | |
| # KernelSU Configuration | |
| KERNELSU_SOURCE: "https://github.com/tiann/KernelSU.git" | |
| KERNELSU_BRANCH: "main" | |
| # SUSFS Configuration | |
| SUSFS_ENABLE: "true" | |
| SUSFS_SOURCE: "https://gitlab.com/simonpunk/susfs4ksu.git" | |
| SUSFS_BRANCH: "kernel-4.14" # CORRECTED: Hardcoded value to fix the error | |
| # AnyKernel3 Configuration | |
| AK3_SOURCE: "https://github.com/ayuschatterjee/AnyKernel3" | |
| AK3_BRANCH: "master" | |
| steps: | |
| - name: Install Dependencies | |
| run: | | |
| sudo apt-get update -y | |
| sudo apt-get install -y --no-install-recommends \ | |
| bc bison build-essential ccache cpio curl flex git git-lfs \ | |
| gcc-aarch64-linux-gnu gcc-arm-linux-gnueabi libssl-dev libelf-dev \ | |
| clang llvm lld device-tree-compiler python3 unzip xz-utils zlib1g-dev | |
| - name: Setup ccache | |
| uses: hendrikmuhs/ccache-action@v1.2 | |
| with: | |
| key: build-kernel-${{ env.DEVICE_CODENAME }} | |
| max-size: ${{ env.CCACHE_MAXSIZE }} | |
| - name: Clone Kernel Source and Dependencies | |
| run: | | |
| git clone --depth=1 --branch ${{ env.KERNEL_BRANCH }} ${{ env.KERNEL_SOURCE }} ${{ env.KERNEL_DIR }} | |
| git clone --depth=1 --branch ${{ env.AK3_BRANCH }} ${{ env.AK3_SOURCE }} AnyKernel3 | |
| git clone --depth=1 --branch ${{ env.KERNELSU_BRANCH }} ${{ env.KERNELSU_SOURCE }} KernelSU | |
| if [[ "${{ env.SUSFS_ENABLE }}" == "true" ]]; then | |
| git clone --depth=1 --branch ${{ env.SUSFS_BRANCH }} ${{ env.SUSFS_SOURCE }} susfs4ksu | |
| fi | |
| - name: Integrate KernelSU and SUSFS | |
| working-directory: ./${{ env.KERNEL_DIR }} | |
| run: | | |
| ln -sf ../KernelSU/kernel ./drivers/kernelsu | |
| echo "obj-\$(CONFIG_KSU) += kernelsu/" >> drivers/Makefile | |
| sed -i '/endmenu/i\source "drivers/kernelsu/Kconfig"' drivers/Kconfig | |
| echo "CONFIG_KSU=y" >> arch/arm64/configs/${{ env.KERNEL_DEFCONFIG }} | |
| if [[ "${{ env.SUSFS_ENABLE }}" == "true" ]]; then | |
| echo "CONFIG_KSU_SUSFS=y" >> arch/arm64/configs/${{ env.KERNEL_DEFCONFIG }} | |
| fi | |
| - name: Apply SUSFS Patches | |
| if: env.SUSFS_ENABLE == 'true' | |
| run: | | |
| # Apply kernel patches | |
| cd ./${{ env.KERNEL_DIR }} | |
| cp ../susfs4ksu/kernel_patches/fs/* fs/ | |
| cp ../susfs4ksu/kernel_patches/include/linux/* include/linux/ | |
| cp ../susfs4ksu/kernel_patches/50_add_susfs_in_kernel-${{ env.KERNEL_VERSION }}.patch ./ | |
| patch -p1 < 50_add_susfs_in_kernel-${{ env.KERNEL_VERSION }}.patch || true | |
| # Apply KernelSU patches | |
| cd ../KernelSU/ | |
| cp ../susfs4ksu/kernel_patches/KernelSU/10_enable_susfs_for_ksu.patch ./ | |
| patch -p1 < 10_enable_susfs_for_ksu.patch || true | |
| - name: Build the Kernel | |
| working-directory: ./${{ env.KERNEL_DIR }} | |
| run: | | |
| export ARCH=arm64 | |
| export CLANG_TRIPLE=aarch64-linux-gnu- | |
| export CROSS_COMPILE=aarch64-linux-gnu- | |
| export LLVM=1 | |
| make O=out ${{ env.KERNEL_DEFCONFIG }} CC="ccache clang" | |
| make O=out -j$(nproc --all) CC="ccache clang" LD=ld.lld | |
| cp out/arch/arm64/boot/Image ../AnyKernel3/ | |
| - name: Package Kernel into Flashable Zip | |
| working-directory: ./AnyKernel3 | |
| run: | | |
| KSU_VER=$(cd ../KernelSU && git rev-parse --short HEAD) | |
| ZIP_NAME="Kernel-sm8150-KSU-${KSU_VER}-$(date +%Y%m%d).zip" | |
| zip -r9 "../${ZIP_NAME}" * | |
| echo "OUTPUT_ZIP=${ZIP_NAME}" >> $GITHUB_ENV | |
| echo "Created kernel zip: ${ZIP_NAME}" | |
| - name: Upload to Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: ${{ env.OUTPUT_ZIP }} |