Build KernelSU Next + SuSFS #48
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 Next + SuSFS | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| device_name: | |
| description: 'Select target device' | |
| required: true | |
| default: 'star' | |
| type: choice | |
| options: [star, mars, venus] | |
| localversion: | |
| description: 'Custom version suffix' | |
| required: true | |
| default: '-next-palaziks' | |
| swap_size: | |
| description: 'Swap size in GB' | |
| required: true | |
| default: '16' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Dynamic Memory Allocation (Swap) | |
| uses: pierotofy/set-swap-space@master | |
| with: | |
| swap-size-gb: ${{ inputs.swap_size || '16' }} | |
| - name: Install Dependencies | |
| run: | | |
| sudo apt update | |
| sudo apt install -y clang lld llvm git make gcc flex bison bc \ | |
| libssl-dev ccache libncurses5-dev libncursesw5-dev cmake \ | |
| python3 python-is-python3 cpio curl patch rsync | |
| - name: "⚡ Setup KernelSU Next (legacy-susfs-v2)" | |
| run: | | |
| set -e | |
| echo "=== Setting up KernelSU Next (legacy-susfs-v2) ===" | |
| KERNEL_REPO="$(pwd)" | |
| git clone --depth=1 -b legacy-susfs-v2 https://github.com/sidex15/KernelSU-Next.git KernelSU-Next | |
| # ✅ run setup.sh FROM kernel root | |
| bash KernelSU-Next/kernel/setup.sh "$KERNEL_REPO" | |
| # ✅ fix pgtable after setup | |
| sed -i '/pgtable.h/c\#include <asm/pgtable.h>' drivers/kernelsu/feature/sucompat.c | |
| echo "✅ KernelSU Next integrated + pgtable fixed" | |
| - name: Setup SuSFS for KSU Next | |
| run: | | |
| set -e | |
| KERNEL_REPO="$(pwd)" | |
| git clone --depth=1 https://gitlab.com/simonpunk/susfs4ksu.git \ | |
| -b gki-android12-5.10 ../susfs4ksu | |
| SUSFS_DIR="$KERNEL_REPO/../susfs4ksu" | |
| cd "$KERNEL_REPO" | |
| cp "$SUSFS_DIR/kernel_patches/fs/susfs.c" "$KERNEL_REPO/fs/" | |
| cp "$SUSFS_DIR/kernel_patches/include/linux/susfs.h" "$KERNEL_REPO/include/linux/" | |
| cp "$SUSFS_DIR/kernel_patches/include/linux/susfs_def.h" "$KERNEL_REPO/include/linux/" | |
| grep -q "linux/cred.h" "$KERNEL_REPO/include/linux/susfs_def.h" || \ | |
| sed -i '1s/^/#include <linux\/cred.h>\n/' "$KERNEL_REPO/include/linux/susfs_def.h" | |
| grep -q "susfs.o" fs/Makefile || echo 'obj-$(CONFIG_KSU_SUSFS) += susfs.o' >> fs/Makefile | |
| # Fix fsnotify for 5.4: rewrite 3-line 5.9+ signature to 5.4 handle_event prototype | |
| perl -i -0pe 's/static int susfs_handle_sdcard_inode_event\(struct fsnotify_mark \*mark, u32 mask,\s*struct inode \*inode, struct inode \*dir,\s*const struct qstr \*file_name, u32 cookie\)/static int susfs_handle_sdcard_inode_event(struct fsnotify_group *group, struct inode *inode, u32 mask, const void *data, int data_type, const struct qstr *file_name, u32 cookie, struct fsnotify_iter_info *iter_info)/s' fs/susfs.c | |
| # Rename ops field to match 5.4 | |
| sed -i 's/\.handle_inode_event = /.handle_event = /' fs/susfs.c | |
| echo "✅ SuSFS copied + fsnotify fixed for 5.4" | |
| - name: Apply SuSFS 5.4 Patch (JackA1ltman) | |
| run: | | |
| set -e | |
| git clone --depth=1 https://github.com/JackA1ltman/NonGKI_Kernel_Build_2nd.git ../jacka_repo | |
| PATCH_FILE="../jacka_repo/Patches/Patch/susfs_patch_to_5.4.patch" | |
| if [ ! -f "$PATCH_FILE" ]; then | |
| echo "❌ Patch not found, available:" | |
| ls ../jacka_repo/Patches/Patch/ || true | |
| exit 1 | |
| fi | |
| patch -p1 --forward --batch < "$PATCH_FILE" || echo "⚠️ Patch partially applied" | |
| echo "✅ JackA1ltman susfs 5.4 patch applied" | |
| # supercall.c — needs susfs.h for susfs functions | |
| grep -q "susfs.h" drivers/kernelsu/supercall/supercall.c || \ | |
| sed -i '1s/^/#include <linux\/susfs.h>\n/' drivers/kernelsu/supercall/supercall.c | |
| # fs/open.c — needs susfs.h for open_redirect hooks | |
| grep -q "susfs.h" fs/open.c || \ | |
| sed -i '/#include <linux\/fs.h>/a #include <linux\/susfs.h>' fs/open.c | |
| - name: Append Defconfig Flags | |
| run: | | |
| set -e | |
| DEVICE="${{ inputs.device_name || 'star' }}" | |
| DEFCONFIG=$(find arch/arm64/configs -name "*${DEVICE}*defconfig" | head -n 1) | |
| if [ -z "$DEFCONFIG" ] || [ ! -f "$DEFCONFIG" ]; then | |
| echo "❌ Defconfig not found!" | |
| exit 1 | |
| fi | |
| echo "✅ Using defconfig: $DEFCONFIG" | |
| # KSU base | |
| echo "CONFIG_KSU=y" >> "$DEFCONFIG" | |
| echo "CONFIG_TMPFS_XATTR=y" >> "$DEFCONFIG" | |
| echo "CONFIG_TMPFS_POSIX_ACL=y" >> "$DEFCONFIG" | |
| # SuSFS v2.x features | |
| echo "CONFIG_KSU_SUSFS=y" >> "$DEFCONFIG" | |
| echo "CONFIG_KSU_SUSFS_SUS_PATH=y" >> "$DEFCONFIG" | |
| echo "CONFIG_KSU_SUSFS_SUS_MOUNT=y" >> "$DEFCONFIG" | |
| echo "CONFIG_KSU_SUSFS_SUS_KSTAT=y" >> "$DEFCONFIG" | |
| echo "CONFIG_KSU_SUSFS_SPOOF_UNAME=y" >> "$DEFCONFIG" | |
| echo "CONFIG_KSU_SUSFS_ENABLE_LOG=y" >> "$DEFCONFIG" | |
| echo "CONFIG_KSU_SUSFS_HIDE_KSU_SUSFS_SYMBOLS=y" >> "$DEFCONFIG" | |
| echo "CONFIG_KSU_SUSFS_SPOOF_CMDLINE_OR_BOOTCONFIG=y" >> "$DEFCONFIG" | |
| echo "CONFIG_KSU_SUSFS_OPEN_REDIRECT=y" >> "$DEFCONFIG" | |
| echo "CONFIG_KSU_SUSFS_AUTO_ADD_SUS_BIND_MOUNT=y" >> "$DEFCONFIG" | |
| echo "CONFIG_KSU_SUSFS_TRY_UMOUNT=y" >> "$DEFCONFIG" | |
| - name: Build Project | |
| run: | | |
| git config --global user.email "bot@example.com" | |
| git config --global user.name "wannq" | |
| export LOCALVERSION="${{ inputs.localversion || '-next-palaziks' }}" | |
| chmod +x ./build.sh | |
| ./build.sh all ${{ inputs.device_name || 'star' }} 2>&1 | tee /tmp/kbuild.log | |
| if [ ! -f arch/arm64/boot/Image ]; then | |
| echo "BUILD FAILED" | |
| grep -E "error:|FAILED" /tmp/kbuild.log | tail -50 | |
| exit 1 | |
| fi | |
| - name: Compress & Upload | |
| run: | | |
| mkdir -p upload | |
| cp arch/arm64/boot/Image upload/ || true | |
| find ../out -name "*.zip" -exec cp {} upload/ \; || true | |
| tar -czvf kernel-star-ksunext.tar.gz upload/ | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: KernelSU-Next-SuSFS-${{ inputs.device_name }} | |
| path: kernel-star-ksunext.tar.gz |