name: apply susfs patches description: apply susfs patches runs: using: composite steps: - name: clone susfs shell: bash run: | SUSFS_BRANCH="gki-$ANDROID_VER-$KERNEL_VER" git clone https://gitlab.com/simonpunk/susfs4ksu.git -b "$SUSFS_BRANCH" git config --global user.name "github-actions[bot]" git config --global user.email "41898282+github-actions[bot]@://github.com" cd susfs4ksu git fetch https://gitlab.com/pershoot/susfs4ksu.git gki-android14-6.1-dev git log ..FETCH_HEAD --oneline -n 2 | awk '{print $1}' | tac | xargs git cherry-pick #cd susfs4ksu #if [[ "$ANDROID_VER-$KERNEL_VER" == "android12-5.10" ]]; then #COMMIT=ce2c2b2dea28c89d33f61af898cc18a93bf65ae9 #elif [[ "$ANDROID_VER-$KERNEL_VER" == "android13-5.15" ]]; then # COMMIT=529919fbc9f8aee6ee70eb3a8890ef33af0a109c #elif [[ "$ANDROID_VER-$KERNEL_VER" == "android14-6.1" ]]; then #COMMIT=d1327b62e0854603cfc26e2226e0a993ec9b0656 #elif [[ "$ANDROID_VER-$KERNEL_VER" == "android15-6.6" ]]; then #COMMIT=676d202ed2cc322a2f90bcb2b56bc4f6a864acb8 #fi #git checkout "$COMMIT" SUSFS4KSU="$ROOT/susfs4ksu" echo "SUSFS4KSU=$SUSFS4KSU" >> $GITHUB_ENV - name: Apply to KSUN shell: bash run: | #cd "$COMMON/KernelSU-Next" #SUSFS_VERSION="v2.1.0" # Apply SUSFS to KernelSU-Next #cp "$SUSFS4KSU/kernel_patches/KernelSU/10_enable_susfs_for_ksu.patch" . #patch -p1 < 10_enable_susfs_for_ksu.patch || true #rm -rf 10_enable_susfs_for_ksu.patch #Fix rejects from adding susfs to KSUN #cp "$KERNEL_PATCHES/next/susfs_fix_patches/$SUSFS_VERSION/"*.patch . #rm -rf multi_manager.patch #for p in *.patch; do # patch -p1 < "$p" # rm -f "$p" #done - name: Copy required files shell: bash run: | # Apply SUSFS to kernel cd "$COMMON" cp "$SUSFS4KSU/kernel_patches/fs/"* ./fs/ cp "$SUSFS4KSU/kernel_patches/include/linux/"* ./include/linux/ cp "$SUSFS4KSU/kernel_patches/50_add_susfs_in_gki-$ANDROID_VER-$KERNEL_VER.patch" ./ - name: prepare namespace and open.c for susfs patch because scamsung shell: bash run: | cd "$COMMON" #Prepare open.c for susfs patching sed -i '/#ifdef CONFIG_SECURITY_DEFEX/,/^#endif/d' fs/open.c #Prepare namespace.c for susfs patching sed -i '/copy_flags = CL_COPY_UNBINDABLE | CL_EXPIRE;/,/#endif/ { /#ifdef CONFIG_KDP_NS/,/#endif/ { /#else/,/#endif/!d /#else/d /#endif/d } }' fs/namespace.c - name: apply susfs patch and fix if necessary shell: bash run: | cd "$COMMON" # Apply SUSFS core patch patch -p1 < 50_add_susfs_in_gki-$ANDROID_VER-$KERNEL_VER.patch || true rm -rf 50_add_susfs_in_gki-$ANDROID_VER-$KERNEL_VER.patch shopt -s nullglob patches=("$KERNEL_PATCHES/samsung/$BRANCH"/*.patch) if [ ${#patches[@]} -gt 0 ]; then echo "Patches found, applying..." cp "${patches[@]}" ./ # Fix SUSFS rejects for p in *.patch; do patch -p1 < "$p" rm -f "$p" done shopt -u nullglob else echo "No patch file found, skipping" fi - name: fix VMA_PAD error if: ${{ env.BRANCH == 'SM-X926B-Oneui6.1' || env.BRANCH == 'SM-A546B-Oneui6.0' || env.BRANCH == 'SM-S9180-Oneui6.1' }} shell: bash run: | cd "$COMMON" # Define VMA_PAD_START fallback macro if it does not exist sed -i '/static int show_map_vma/i \ #ifndef VMA_PAD_START\n#define VMA_PAD_START(vma) ((vma)->vm_start)\n#endif\n' fs/proc/task_mmu.c - name: fix __fold function error for s25 ultra oneui7 if: ${{ env.BRANCH == 'SM-S938B-Oneui7' }} shell: bash run: | cd "$COMMON" sed -i '/static int show_map_vma/i \ #ifdef CONFIG_KSU_SUSFS_OPEN_REDIRECT\nstatic inline void __fold_filemap_fixup_entry(struct vma_iterator *vmi, unsigned long *end)\n{\n\tstruct vm_area_struct *next = vma_next(vmi);\n\tif (next) {\n\t\t*end = next->vm_start;\n\t\tvma_prev(vmi);\n\t}\n}\n#endif\n' fs/proc/task_mmu.c - name: add ksu-susfs to config shell: bash run: | "$COMMON/scripts/config" --file "$GKI_DEFCONFIG" --enable CONFIG_KSU_SUSFS